예제 #1
0
파일: xfemmanager.C 프로젝트: xyuan/oofem
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;
}
예제 #2
0
파일: xfemmanager.C 프로젝트: Micket/oofem
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;
}
예제 #3
0
파일: xfemmanager.C 프로젝트: xyuan/oofem
void XfemManager :: updateYourself()
{
    // Update level sets
    for ( auto &ei: enrichmentItemList ) {
        ei->updateGeometry();
    }

    updateNodeEnrichmentItemMap();
}
예제 #4
0
파일: xfemmanager.C 프로젝트: Micket/oofem
void XfemManager :: appendEnrichmentItems(std :: vector< std :: unique_ptr< EnrichmentItem > > &iEIlist)
{
	for( auto &ei : iEIlist ) {
		enrichmentItemList.push_back(std::move(ei));
	}

	numberOfEnrichmentItems = enrichmentItemList.size();
    updateNodeEnrichmentItemMap();
}
예제 #5
0
int XfemStructureManager :: instanciateYourself(DataReader *dr)
{
    int result = XfemManager :: instanciateYourself(dr);

    if ( mSplitCracks ) {
        splitCracks();
    }

    mergeCloseCracks();

    updateNodeEnrichmentItemMap();

    return result;
}
예제 #6
0
void XfemStructureManager :: propagateFronts(bool &oAnyFronHasPropagated)
{
    oAnyFronHasPropagated = false;

    for ( auto &ei: enrichmentItemList ) {

        bool eiHasPropagated = false;
        ei->propagateFronts(eiHasPropagated);

        if(eiHasPropagated) {
            oAnyFronHasPropagated = true;
        }
    }

    updateNodeEnrichmentItemMap();
}
예제 #7
0
파일: xfemmanager.C 프로젝트: xyuan/oofem
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();
}
예제 #8
0
파일: xfemmanager.C 프로젝트: Micket/oofem
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();
}
예제 #9
0
파일: xfemmanager.C 프로젝트: Micket/oofem
void XfemManager :: clearEnrichmentItems()
{
	enrichmentItemList.clear();
    updateNodeEnrichmentItemMap();
}
예제 #10
0
파일: xfemmanager.C 프로젝트: Micket/oofem
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();
}