63 this->domain = domain;
64 numberOfEnrichmentItems = -1;
65 numberOfNucleationCriteria = 0;
72 mEnrDofScaleFac = 1.0;
76 vtkExportFields.clear();
78 mNodeEnrichmentItemIndices.resize(0);
79 mElementEnrichmentItemIndices.clear();
80 mMaterialModifyingEnrItemIndices.clear();
91 case XFEMST_Enrichment:
92 case XFEMST_LevelSetPhi:
93 case XFEMST_LevelSetGamma:
94 case XFEMST_NumIntersecPoints:
95 case XFEMST_NodeEnrMarker:
134 ei->createEnrichedDofs();
135 ei->givePotentialEIDofIdArray(dofIdArray);
177 if ( vtkDebug == 1 ) {
225 if ( ei.get() == NULL ) {
226 OOFEM_ERROR(
"unknown enrichment item (%s)", name.c_str() );
229 ei->initializeFrom(mir);
230 ei->instanciateYourself(dr);
244 if ( nc.get() == NULL ) {
245 OOFEM_ERROR(
"Unknown nucleation criterion: (%s)", name.c_str() );
248 nc->initializeFrom(mir);
249 nc->instanciateYourself(dr);
264 ei->setDomain(ipDomain);
273 if ( !stream.
write(this->numberOfEnrichmentItems) ) {
280 if ( ( mode & CM_Definition ) ) {
300 if ( !stream.
read(this->numberOfEnrichmentItems) ) {
308 if ( mode & CM_Definition ) {
310 if ( !stream.
read(name) ) {
333 ei->updateGeometry();
341 oAnyFronHasPropagated =
false;
345 bool eiHasPropagated =
false;
346 ei->propagateFronts(eiHasPropagated);
348 if(eiHasPropagated) {
349 oAnyFronHasPropagated =
true;
354 if ( geoEI != NULL ) {
355 std :: vector< FloatArray >points;
358 std :: vector< double >x, y;
359 for (
size_t j = 0; j < points.size(); j++ ) {
360 x.push_back( points [ j ].at(1) );
361 y.push_back( points [ j ].at(2) );
365 char fileName [ 200 ];
366 sprintf( fileName,
"crack%d.dat", ei->giveNumber() );
378 oAnyFronHasPropagated =
false;
384 if (
Delamination *dei = dynamic_cast< Delamination * >( ei.get() ) ) {
385 int CSinterfaceNumber = dei->giveDelamInterfaceNum();
386 for (
int CSnumber : dei->giveDelamCrossSectionNum()) {
388 if (initiationFactors[CSnumber-1].giveSize() < CSinterfaceNumber) {
389 initiationFactors[CSnumber-1].resizeWithValues(CSinterfaceNumber);
391 initiationFactors[CSnumber-1].at(CSinterfaceNumber) = dei->giveInitiationFactor();
396 bool failureChecked =
false;
397 std :: vector < IntArray > CSinterfaceNumbers; CSinterfaceNumbers.resize(CSnumbers.
giveSize());
398 std :: vector < IntArray > CSDofManNumbers; CSDofManNumbers.resize(CSnumbers.
giveSize());
400 for (
auto &ei: enrichmentItemList ) {
402 bool eiHasPropagated =
false;
404 if (
Delamination *dei = dynamic_cast< Delamination * >( ei.get() ) ) {
406 if ( !failureChecked ) {
407 dei->findInitiationFronts(failureChecked, CSnumbers, CSinterfaceNumbers, CSDofManNumbers, initiationFactors, tStep);
410 for (
int CSnum : dei->giveDelamCrossSectionNum()) {
413 int iInt = CSinterfaceNumbers[iCS-1].findSorted(dei->giveDelamInterfaceNum());
424 dei->initiateFronts(eiHasPropagated,propNodes);
428 OOFEM_ERROR(
" XfemManager :: initiateFronts not implemented for other than Delamination.")
431 if(eiHasPropagated) {
432 oAnyFronHasPropagated =
true;
442 if ( ei->hasPropagatingFronts() ) {
453 if ( ei->hasInitiationCriteria() ) {
469 for(
auto &ei : iEIlist ) {
482 std::vector<std::unique_ptr<EnrichmentItem>> eiList = std::move(nucCrit->nucleateEnrichmentItems());
484 if(eiList.size() > 0) {
490 for(
auto &ei : eiList) {
496 oNewItemsWereNucleated =
true;
504 oNewItemsWereNucleated =
false;
523 for (
int i = 1; i <= nElem; i++ ) {
526 if ( i != elPlaceInArray ) {
527 printf(
"i != elPlaceInArray.\n");
535 for (
int eiIndex = 1; eiIndex <= nEI; eiIndex++ ) {
538 const std :: unordered_map< int, NodeEnrichmentType > &enrNodeInd = ei->
giveEnrNodeMap();
541 for (
auto &nodeEiPair: enrNodeInd ) {
552 for (
int i = 1; i <= nodeElements.
giveSize(); i++ ) {
553 int elInd = nodeElements.
at(i);
574 for (
int eiIndex = 1; eiIndex <= nEI; eiIndex++ ) {
587 oElemEnrInd = res->second;
std::vector< std::unique_ptr< NucleationCriterion > > mNucleationCriteria
Nucleation of new enrichment items.
const std::unordered_map< int, NodeEnrichmentType > & giveEnrNodeMap() const
bool isElementEnriched(const Element *element) const
virtual ~XfemManager()
Destructor.
IntArray mXFEMPotentialDofIDs
Abstract class representing entity, which is included in the FE model using one (or more) global func...
void clearEnrichmentItems()
Remove all enrichment items.
void giveSubPolygon(std::vector< FloatArray > &oPoints, const double &iXiStart, const double &iXiEnd) const
EnrichmentItem * createEnrichmentItem(const char *name, int num, XfemManager *xm, Domain *domain)
virtual void giveInputRecord(DynamicInputRecord &input)
virtual void updateYourself(TimeStep *tStep)
Update enrichment items (level sets).
int giveNumberOfDofManagers() const
Returns number of dof managers in domain.
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
bool hasInitiationCriteria()
std::vector< int > mMaterialModifyingEnrItemIndices
Keep track of enrichment items that may assign a different material to some Gauss points...
int giveGlobalNumber() const
InternalStateValueType giveXFEMStateValueType(XFEMStateType type)
void giveElementEnrichmentItemIndices(std::vector< int > &oElemEnrInd, int iElementIndex) const
virtual const char * giveInputRecordName() const =0
virtual void propagateFronts(bool &oAnyFronHasPropagated)
ConnectivityTable * giveConnectivityTable()
Returns receiver's associated connectivity table.
void setDomain(Domain *ipDomain)
bool insertSortedOnce(int value, int allocChunk=0)
Inserts given value into a receiver, which is assumed to be sorted.
contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Stores the state of receiver to output stream.
static void setCharacteristicElementLength(double iCharElLength)
Abstract base class for all finite elements.
InternalStateValueType
Determines the type of internal variable.
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Stores receiver state to output stream.
Base class for dof managers.
Class representing the abstraction for input data source.
int giveNumberOfElements() const
Returns number of elements in domain.
virtual const char * giveInputRecordName() const
int mNumTriRef
The number of times a subtriangle should be refined.
Class implementing an array of integers.
int & at(int i)
Coefficient access function.
virtual int read(int *data, int count)=0
Reads count integer values into array pointed by data.
#define _IFT_XfemManager_VTKExport
bool giveVtkDebug() const
int giveNumberOfEnrichmentItems() const
virtual int write(const int *data, int count)=0
Writes count integer values from array pointed by data.
const IntArray & giveDofManArray() const
std::vector< std::unique_ptr< EnrichmentItem > > enrichmentItemList
Enrichment item list.
bool hasPropagatingFronts()
virtual const char * giveClassName() const
Element * giveElement(int n)
Service for accessing particular domain fe element.
int numberOfNucleationCriteria
int numberOfEnrichmentItems
virtual bool canModifyMaterial() const
contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores the state of receiver from output stream.
void clear()
Clears the array (zero size).
DofIDItem
Type representing particular dof type.
std::unordered_map< int, std::vector< int > > mElementEnrichmentItemIndices
Set of elements, boundaries, edges and/or nodes.
int giveNumberOfCrossSectionModels() const
Returns number of cross section models in domain.
Class representing connectivity table.
Set * giveSet(int n)
Service for accessing particular domain set.
REGISTER_XfemManager(XfemManager)
void resize(int n)
Checks size of receiver towards requested bounds.
void updateNodeEnrichmentItemMap()
virtual InputRecord * giveInputRecord(InputRecordType irType, int recordId)=0
Returns input record corresponding to given InputRecordType value and its record_id.
#define _IFT_XfemManager_numberOfGpPerTri
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
int findSorted(int value) const
Finds the first occurrence of given value, assuming that the receiver is sorted.
bool hasDofID(DofIDItem id) const
Checks if receiver contains dof with given ID.
This class manages the xfem part.
IRResultType
Type defining the return values of InputRecord reading operations.
void giveNodeNeighbourList(IntArray &answer, IntArray &nodeList)
Returns list of elements sharing given nodes.
IntArray vtkExportFields
List with the fields that should be exported to VTK.
int giveNumberOfNucleationCriteria() const
void appendEnrichmentItems(std::vector< std::unique_ptr< EnrichmentItem > > &iEIlist)
NucleationCriterion * createNucleationCriterion(const char *name, Domain *domain)
bool isElementEnriched(const Element *elem)
void followedBy(const IntArray &b, int allocChunk=0)
Appends array b at the end of receiver.
bool mDebugVTK
If extra debug vtk files should be written.
virtual int instanciateYourself(DataReader &dr)
EnrichmentItem * giveEnrichmentItem(int n)
ClassFactory & classFactory
long ContextMode
Context mode (mask), defining the type of information written/read to/from context.
#define _IFT_XfemManager_VTKExportFields
int giveElementPlaceInArray(int iGlobalElNum) const
Returns the array index of the element with global number iGlobalElNum, so that it can be fetched by ...
int mNumGpPerTri
The number of Gauss points to be used in each sub-triangle when subdividing cut elements.
void nucleateEnrichmentItems(bool &oNewItemsWereNucleated)
#define _IFT_XfemManager_numberOfNucleationCriteria
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores the receiver state previously written in stream.
bool hasNucleationCriteria()
#define _IFT_XfemManager_enrDofScaleFac
the oofem namespace is to define a context or scope in which all oofem names are defined.
#define _IFT_XfemManager_debugVTK
const IntArray & giveEnrichedDofIDs() const
void createEnrichedDofs()
int findCommonValuesSorted(const IntArray &iarray, IntArray &common, int allocChunk=0) const
Extracts common values in receiver and iarray.
std::vector< std::vector< int > > mNodeEnrichmentItemIndices
Let the XfemManager keep track of enrichment items enriching each node and each element, to allow more efficient computations.
Class representing solution step.
const IntArray & giveElementList()
Returns list of elements within set.
#define _IFT_XfemManager_numberOfEnrichmentItems
EnrichmentItem with geometry described by BasicGeometry.
void initiateFronts(bool &oAnyFronHasPropagated, TimeStep *tStep)
#define _IFT_XfemManager_numberOfTriRefs
How many times a subtriangle should be refined.