int XfemManager :: instanciateYourself(DataReader *dr) { IRResultType result; // Required by IR_GIVE_FIELD macro std :: string name; enrichmentItemList.resize(numberOfEnrichmentItems); for ( int i = 1; i <= numberOfEnrichmentItems; i++ ) { InputRecord *mir = dr->giveInputRecord(DataReader :: IR_enrichItemRec, i); result = mir->giveRecordKeywordField(name); if ( result != IRRT_OK ) { mir->report_error(this->giveClassName(), __func__, "", result, __FILE__, __LINE__); } std :: unique_ptr< EnrichmentItem > ei( classFactory.createEnrichmentItem( name.c_str(), i, this, this->giveDomain() ) ); if ( ei.get() == NULL ) { OOFEM_ERROR( "unknown enrichment item (%s)", name.c_str() ); } ei->initializeFrom(mir); ei->instanciateYourself(dr); this->enrichmentItemList[i-1] = std :: move(ei); } updateNodeEnrichmentItemMap(); return 1; }
void XfemManager :: nucleateEnrichmentItems(bool &oNewItemsWereNucleated) { // printf("Entering XfemManager :: nucleateEnrichmentItems\n"); for(auto &nucCrit : mNucleationCriteria) { std::vector<std::unique_ptr<EnrichmentItem>> eiList = std::move(nucCrit->nucleateEnrichmentItems()); if(eiList.size() > 0) { // printf("eiList.size(): %lu\n", eiList.size() ); // if(giveNumberOfEnrichmentItems() == 0) { // printf("giveNumberOfEnrichmentItems() == 0\n"); for(auto &ei : eiList) { enrichmentItemList.push_back(std::move(ei)); } // enrichmentItemList.push_back(std::move(ei)); numberOfEnrichmentItems = enrichmentItemList.size(); oNewItemsWereNucleated = true; updateNodeEnrichmentItemMap(); return; // } } } oNewItemsWereNucleated = false; return; }
void XfemManager :: updateYourself() { // Update level sets for ( auto &ei: enrichmentItemList ) { ei->updateGeometry(); } updateNodeEnrichmentItemMap(); }
void XfemManager :: appendEnrichmentItems(std :: vector< std :: unique_ptr< EnrichmentItem > > &iEIlist) { for( auto &ei : iEIlist ) { enrichmentItemList.push_back(std::move(ei)); } numberOfEnrichmentItems = enrichmentItemList.size(); updateNodeEnrichmentItemMap(); }
int XfemStructureManager :: instanciateYourself(DataReader *dr) { int result = XfemManager :: instanciateYourself(dr); if ( mSplitCracks ) { splitCracks(); } mergeCloseCracks(); updateNodeEnrichmentItemMap(); return result; }
void XfemStructureManager :: propagateFronts(bool &oAnyFronHasPropagated) { oAnyFronHasPropagated = false; for ( auto &ei: enrichmentItemList ) { bool eiHasPropagated = false; ei->propagateFronts(eiHasPropagated); if(eiHasPropagated) { oAnyFronHasPropagated = true; } } updateNodeEnrichmentItemMap(); }
void XfemManager :: propagateFronts() { for ( auto &ei: enrichmentItemList ) { ei->propagateFronts(); if ( giveVtkDebug() ) { std :: vector< FloatArray >points; ei->giveSubPolygon(points, -0.1, 1.1); std :: vector< double >x, y; for ( size_t j = 0; j < points.size(); j++ ) { x.push_back( points [ j ].at(1) ); y.push_back( points [ j ].at(2) ); } char fileName [ 200 ]; sprintf(fileName, "crack%d.dat", ei->giveNumber()); XFEMDebugTools :: WriteArrayToGnuplot(fileName, x, y); } } updateNodeEnrichmentItemMap(); }
void XfemManager :: propagateFronts(bool &oAnyFronHasPropagated) { oAnyFronHasPropagated = false; for ( auto &ei: enrichmentItemList ) { bool eiHasPropagated = false; ei->propagateFronts(eiHasPropagated); if(eiHasPropagated) { oAnyFronHasPropagated = true; } #if 0 if ( giveVtkDebug() ) { GeometryBasedEI *geoEI = dynamic_cast< GeometryBasedEI * >( ei ); if ( geoEI != NULL ) { std :: vector< FloatArray >points; geoEI->giveSubPolygon(points, -0.1, 1.1); std :: vector< double >x, y; for ( size_t j = 0; j < points.size(); j++ ) { x.push_back( points [ j ].at(1) ); y.push_back( points [ j ].at(2) ); } char fileName [ 200 ]; sprintf( fileName, "crack%d.dat", ei->giveNumber() ); XFEMDebugTools :: WriteArrayToGnuplot(fileName, x, y); } } #endif } updateNodeEnrichmentItemMap(); }
void XfemManager :: clearEnrichmentItems() { enrichmentItemList.clear(); updateNodeEnrichmentItemMap(); }
void XfemManager :: initiateFronts(bool &oAnyFronHasPropagated, TimeStep *tStep) { oAnyFronHasPropagated = false; // Loop over EI:s and collect cross sections which have delaminaion EI:s IntArray CSnumbers; std :: vector < FloatArray > initiationFactors; initiationFactors.resize(this->domain->giveNumberOfCrossSectionModels()); for ( auto &ei: enrichmentItemList ) { if ( Delamination *dei = dynamic_cast< Delamination * >( ei.get() ) ) { int CSinterfaceNumber = dei->giveDelamInterfaceNum(); for (int CSnumber : dei->giveDelamCrossSectionNum()) { CSnumbers.insertSortedOnce(CSnumber); if (initiationFactors[CSnumber-1].giveSize() < CSinterfaceNumber) { initiationFactors[CSnumber-1].resizeWithValues(CSinterfaceNumber); } initiationFactors[CSnumber-1].at(CSinterfaceNumber) = dei->giveInitiationFactor(); } } } bool failureChecked = false; std :: vector < IntArray > CSinterfaceNumbers; CSinterfaceNumbers.resize(CSnumbers.giveSize()); std :: vector < IntArray > CSDofManNumbers; CSDofManNumbers.resize(CSnumbers.giveSize()); for ( auto &ei: enrichmentItemList ) { bool eiHasPropagated = false; if ( Delamination *dei = dynamic_cast< Delamination * >( ei.get() ) ) { if ( !failureChecked ) { dei->findInitiationFronts(failureChecked, CSnumbers, CSinterfaceNumbers, CSDofManNumbers, initiationFactors, tStep); } for (int CSnum : dei->giveDelamCrossSectionNum()) { int iCS = CSnumbers.findSorted(CSnum); int iInt = CSinterfaceNumbers[iCS-1].findSorted(dei->giveDelamInterfaceNum()); if ( iInt ) { // Check if nodes are viable for enrichment ///TODO: this should actually not inlcude the nodes at the boundary of the delamination, since this will propagate the delamination outside. IntArray delamNodes, propNodes; Set *elSet = this->giveDomain()->giveSet(this->giveDomain()->giveCrossSection(CSnum)->giveSetNumber()); for (int elID : elSet->giveElementList() ) { delamNodes.followedBy(this->giveDomain()->giveElement(elID)->giveDofManArray()); } delamNodes.sort(); delamNodes.findCommonValuesSorted(CSDofManNumbers[iCS-1], propNodes); dei->initiateFronts(eiHasPropagated,propNodes); } } } else { OOFEM_ERROR(" XfemManager :: initiateFronts not implemented for other than Delamination.") } if(eiHasPropagated) { oAnyFronHasPropagated = true; } } updateNodeEnrichmentItemMap(); }