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); } mNucleationCriteria.resize(numberOfNucleationCriteria); for ( int i = 1; i <= numberOfNucleationCriteria; i++ ) { InputRecord *mir = dr.giveInputRecord(DataReader :: IR_crackNucleationRec, i); result = mir->giveRecordKeywordField(name); if ( result != IRRT_OK ) { mir->report_error(this->giveClassName(), __func__, "", result, __FILE__, __LINE__); } std :: unique_ptr< NucleationCriterion >nc( classFactory.createNucleationCriterion( name.c_str(), this->giveDomain() ) ); if ( nc.get() == NULL ) { OOFEM_ERROR( "Unknown nucleation criterion: (%s)", name.c_str() ); } nc->initializeFrom(mir); nc->instanciateYourself(dr); this->mNucleationCriteria [ i - 1 ] = std :: move(nc); } updateNodeEnrichmentItemMap(); return 1; }
int Delamination :: instanciateYourself(DataReader &dr) { IRResultType result; // Required by IR_GIVE_FIELD macro std :: string name; // Instantiate enrichment function InputRecord *mir = dr.giveInputRecord(DataReader :: IR_enrichFuncRec, 1); result = mir->giveRecordKeywordField(name); if ( result != IRRT_OK ) { mir->report_error(this->giveClassName(), __func__, "", result, __FILE__, __LINE__); } mpEnrichmentFunc = classFactory.createEnrichmentFunction( name.c_str(), 1, this->giveDomain() ); if ( mpEnrichmentFunc != NULL ) { mpEnrichmentFunc->initializeFrom(mir); } else { OOFEM_ERROR( "failed to create enrichment function (%s)", name.c_str() ); } // Instantiate enrichment domain mir = dr.giveInputRecord(DataReader :: IR_geoRec, 1); result = mir->giveRecordKeywordField(name); if ( result != IRRT_OK ) { mir->report_error(this->giveClassName(), __func__, "", result, __FILE__, __LINE__); } IntArray idList; IR_GIVE_FIELD(mir, idList, _IFT_ListBasedEI_list); for ( int i = 1; i <= idList.giveSize(); i++ ) { this->dofManList.push_back( idList.at(i) ); } std :: sort( dofManList.begin(), this->dofManList.end() ); //IR_GIVE_FIELD(ir, this->xi, _IFT_DofManList_DelaminationLevel); // Instantiate EnrichmentFront if ( mEnrFrontIndex == 0 ) { mpEnrichmentFrontStart = new EnrFrontDoNothing(this->giveNumber()); mpEnrichmentFrontEnd = new EnrFrontDoNothing(this->giveNumber()); } else { std :: string enrFrontNameStart, enrFrontNameEnd; InputRecord *enrFrontStartIr = dr.giveInputRecord(DataReader :: IR_enrichFrontRec, mEnrFrontIndex); result = enrFrontStartIr->giveRecordKeywordField(enrFrontNameStart); mpEnrichmentFrontStart = classFactory.createEnrichmentFront( enrFrontNameStart.c_str() ); if ( mpEnrichmentFrontStart != NULL ) { mpEnrichmentFrontStart->initializeFrom(enrFrontStartIr); //printf("EnrichmentFrontStart : %s \n", mpEnrichmentFrontStart->giveClassName()); } else { OOFEM_ERROR( "Failed to create enrichment front (%s)", enrFrontNameStart.c_str() ); } InputRecord *enrFrontEndIr = dr.giveInputRecord(DataReader :: IR_enrichFrontRec, mEnrFrontIndex); result = enrFrontEndIr->giveRecordKeywordField(enrFrontNameEnd); mpEnrichmentFrontEnd = classFactory.createEnrichmentFront( enrFrontNameEnd.c_str() ); if ( mpEnrichmentFrontEnd != NULL ) { mpEnrichmentFrontEnd->initializeFrom(enrFrontEndIr); //printf("EnrichmentFrontEnd : %s \n", mpEnrichmentFrontEnd->giveClassName()); } else { OOFEM_ERROR( "Failed to create enrichment front (%s)", enrFrontNameEnd.c_str() ); } } // Instantiate PropagationLaw if ( mPropLawIndex == 0 ) { mpPropagationLaw = new PLDoNothing(); } else { std :: string propLawName; InputRecord *propLawir = dr.giveInputRecord(DataReader :: IR_propagationLawRec, mPropLawIndex); result = propLawir->giveRecordKeywordField(propLawName); mpPropagationLaw = classFactory.createPropagationLaw( propLawName.c_str() ); if ( mpPropagationLaw != NULL ) { mpPropagationLaw->initializeFrom(propLawir); } else { OOFEM_ERROR( "Failed to create propagation law (%s)", propLawName.c_str() ); } } // Set start of the enrichment dof pool for the given EI int xDofPoolAllocSize = this->giveDofPoolSize(); this->startOfDofIdPool = this->giveDomain()->giveNextFreeDofID(xDofPoolAllocSize); this->endOfDofIdPool = this->startOfDofIdPool + xDofPoolAllocSize - 1; XfemManager *xMan = this->giveDomain()->giveXfemManager(); // mpEnrichmentDomain->CallNodeEnrMarkerUpdate(* this, * xMan); this->updateNodeEnrMarker(* xMan); //writeVtkDebug(); return 1; }