Ejemplo n.º 1
0
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;
}
Ejemplo n.º 2
0
void
NonLinearStatic :: updateAttributes(MetaStep *mStep)
{
    const char *__proc = "updateAttributes"; // Required by IR_GIVE_FIELD macro
    IRResultType result;                  // Required by IR_GIVE_FIELD macro

    MetaStep *mStep1 = this->giveMetaStep( mStep->giveNumber() );//this line ensures correct input file in staggered problem
    InputRecord *ir = mStep1->giveAttributesRecord();

    LinearStatic :: updateAttributes(mStep1);

    /*
     * if ((mstep->giveFirstStepNumber() == atTime->giveNumber()) && hasString(initString, "fixload")) {
     * double factor;
     *
     * printf ("NonLinearStatic: fixed load level");
     * if (initialLoadVector.isEmpty()) initialLoadVector.resize(loadVector.giveSize());
     * if ((controlMode == nls_directControl) || (controlMode == nls_directControl2)) factor = 1.0;
     * else factor = loadLevel;
     * loadVector.times (factor);
     * initialLoadVector.add(loadVector);
     * loadVector.zero();
     * this->loadInitFlag = 1;
     * this->loadLevel = 0.0;
     * }
     */
    int _val = nls_indirectControl;
    IR_GIVE_OPTIONAL_FIELD(ir, _val, IFT_NonLinearStatic_controlmode, "controlmode"); // Macro
    IR_GIVE_OPTIONAL_FIELD(ir, _val, IFT_NonLinearStatic_controlmode, "controllmode"); // for backward compatibility
    this->controlMode = ( NonLinearStatic_controlType ) _val;

    _val = IG_None;
    IR_GIVE_OPTIONAL_FIELD(ir, _val, IFT_EngngModel_initialGuess, "initialguess");
    this->initialGuessType = ( InitialGuess ) _val;

    deltaT = 1.0;
    IR_GIVE_OPTIONAL_FIELD(ir, deltaT, IFT_NonLinearStatic_deltat, "deltat"); // Macro
    if ( deltaT < 0. ) {
        _error("updateAttributes: deltaT < 0");
    }

    _val = nls_tangentStiffness;
    IR_GIVE_OPTIONAL_FIELD(ir, _val, IFT_NonLinearStatic_stiffmode, "stiffmode"); // Macro
    this->stiffMode = ( NonLinearStatic_stiffnessMode ) _val;

    _val = SparseNonLinearSystemNM :: rlm_total;
    IR_GIVE_OPTIONAL_FIELD(ir, _val, IFT_NonLinearStatic_refloadmode, "refloadmode"); // Macro
    this->refLoadInputMode = ( SparseNonLinearSystemNM :: referenceLoadInputModeType ) _val;

    if ( ir->hasField(IFT_NonLinearStatic_keepll, "keepll") ) {
        mstepCumulateLoadLevelFlag = true;
    } else {
        mstepCumulateLoadLevelFlag = false;
    }

    // called just to mart filed as recognized, used later
    ir->hasField(IFT_NonLinearStatic_donotfixload, "donotfixload");
}
Ejemplo n.º 3
0
void
NonLinearStatic :: updateAttributes(MetaStep *mStep)
{
    IRResultType result;                  // Required by IR_GIVE_FIELD macro

    MetaStep *mStep1 = this->giveMetaStep( mStep->giveNumber() ); //this line ensures correct input file in staggered problem
    InputRecord *ir = mStep1->giveAttributesRecord();

    LinearStatic :: updateAttributes(mStep1);

    /*
     * if ((mstep->giveFirstStepNumber() == tStep->giveNumber()) && hasString(initString, "fixload")) {
     * double factor;
     *
     * printf ("NonLinearStatic: fixed load level");
     * if (initialLoadVector.isEmpty()) initialLoadVector.resize(loadVector.giveSize());
     * if ((controlMode == nls_directControl) || (controlMode == nls_directControl2)) factor = 1.0;
     * else factor = loadLevel;
     * loadVector.times (factor);
     * initialLoadVector.add(loadVector);
     * loadVector.zero();
     * this->loadInitFlag = 1;
     * this->loadLevel = 0.0;
     * }
     */
    int _val = nls_indirectControl;
    IR_GIVE_OPTIONAL_FIELD(ir, _val, _IFT_NonLinearStatic_controlmode);
    IR_GIVE_OPTIONAL_FIELD(ir, _val, "controllmode"); /// @todo If there is ever a major version change, remove this (for backward compatibility)
    this->controlMode = ( NonLinearStatic_controlType ) _val;

    _val = IG_None;
    IR_GIVE_OPTIONAL_FIELD(ir, _val, _IFT_EngngModel_initialGuess);
    this->initialGuessType = ( InitialGuess ) _val;

    deltaT = 1.0;
    IR_GIVE_OPTIONAL_FIELD(ir, deltaT, _IFT_NonLinearStatic_deltat);
    if ( deltaT < 0. ) {
        OOFEM_ERROR("deltaT < 0");
    }

    _val = nls_tangentStiffness;
    IR_GIVE_OPTIONAL_FIELD(ir, _val, _IFT_NonLinearStatic_stiffmode);
    this->stiffMode = ( NonLinearStatic_stiffnessMode ) _val;

    _val = SparseNonLinearSystemNM :: rlm_total;
    IR_GIVE_OPTIONAL_FIELD(ir, _val, _IFT_NonLinearStatic_refloadmode);
    this->refLoadInputMode = ( SparseNonLinearSystemNM :: referenceLoadInputModeType ) _val;

    mstepCumulateLoadLevelFlag = ir->hasField(_IFT_NonLinearStatic_keepll);

    // called just to mark field as recognized, used later
    ir->hasField(_IFT_NonLinearStatic_donotfixload);
}
Ejemplo n.º 4
0
int 
ContactManager :: instanciateYourself(DataReader *dr)
{
    IRResultType result = IRRT_OK; // Required by IR_GIVE_FIELD macro
    std :: string name;

    // Create and instantiate contact definitions
    for ( int i = 1; i <= this->giveNumberOfContactDefinitions(); i++ ) {
        InputRecord *ir = dr->giveInputRecord(DataReader :: IR_contactDefRec, i);
        result = ir->giveRecordKeywordField(name);  
        this->contactDefinitionList[i-1].reset( classFactory.createContactDefinition( name.c_str(), this ) );
        if ( this->contactDefinitionList[i-1] ) {
            this->contactDefinitionList[i-1]->initializeFrom(ir);
            this->contactDefinitionList[i-1]->instanciateYourself(dr);
        } else {
            OOFEM_ERROR("Failed to create contact definition (%s)", name.c_str() );
        }
    }

    return result;
}
Ejemplo n.º 5
0
EngngModel *InstanciateProblem(DataReader *dr, problemMode mode, int contextFlag, EngngModel *_master, bool parallelFlag)
{
    const char *__proc = "InstanciateProblem"; // Required by IR_GIVE_FIELD macro
    IRResultType result;                       // Required by IR_GIVE_FIELD macro
    EngngModel *problem;
    std::string problemName, dataOutputFileName, desc;

    dataOutputFileName = dr->giveOutputFileName();
    desc = dr->giveDescription();

    /* here we need copy of input record. The pointer returned by dr->giveInputRecord can (and will)
     * be updated as reading e-model components (nodes, etc). But we need this record being available
     * through the whole e-model instanciation
     */
    InputRecord *emodelir = dr->giveInputRecord(DataReader :: IR_emodelRec, 1)->GiveCopy();
    result = emodelir->giveRecordKeywordField(problemName); ///@todo Make this function robust, it can't be allowed to fail (the record keyword is not a normal field-id)
    if ( result != IRRT_OK ) {
        IR_IOERR("", __proc, "", emodelir, result);
    }

    problem = classFactory.createEngngModel(problemName.c_str(), 1, _master);
    if (!problem) {
        OOFEM_ERROR2("EngngModel::InstanciateProblem - Failed to construct engineering model if type \"%s\".\n", problemName.c_str());
    }
    problem->setProblemMode(mode);
    problem->setParallelMode(parallelFlag);

    if ( contextFlag ) {
        problem->setContextOutputMode(COM_Always);
    }

    problem->instanciateYourself(dr, emodelir, dataOutputFileName.c_str(), desc.c_str());

    delete emodelir;

    return problem;
}
Ejemplo n.º 6
0
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();
        mpEnrichmentFrontEnd = new EnrFrontDoNothing();
    } 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);
        } 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);
        } 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;
}
Ejemplo n.º 7
0
void StructuralFE2MaterialStatus :: copyStateVariables(const MaterialStatus &iStatus)
{
    //static int num = 0;
    //printf("Entering StructuralFE2MaterialStatus :: copyStateVariables.\n");

    this->oldTangent = true;

//    if ( !this->createRVE(this->giveNumber(), gp, mInputFile) ) {
//        OOFEM_ERROR("Couldn't create RVE");
//    }


    StructuralMaterialStatus :: copyStateVariables(iStatus);


    //////////////////////////////
    MaterialStatus &tmpStat = const_cast< MaterialStatus & >(iStatus);
    StructuralFE2MaterialStatus *fe2ms = dynamic_cast<StructuralFE2MaterialStatus*>(&tmpStat);

    if ( !fe2ms ) {
        OOFEM_ERROR("Failed to cast StructuralFE2MaterialStatus.")
    }


    this->mNewlyInitialized = fe2ms->mNewlyInitialized;

    // The proper way to do this would be to clone the RVE from iStatus.
    // However, this is a mess due to all pointers that need to be tracked.
    // Therefore, we consider a simplified version: copy only the enrichment items.

    Domain *ext_domain = fe2ms->giveRVE()->giveDomain(1);
    if ( ext_domain->hasXfemManager() ) {

        Domain *rve_domain = rve->giveDomain(1);

        XfemManager *ext_xMan = ext_domain->giveXfemManager();
        XfemManager *this_xMan = rve->giveDomain(1)->giveXfemManager();
        DynamicDataReader dataReader("fe2");
        if ( ext_xMan != NULL ) {

            IRResultType result; // Required by IR_GIVE_FIELD macro
            std::vector<std::unique_ptr<EnrichmentItem>> eiList;

            //DynamicInputRecord *xmanRec = new DynamicInputRecord();
            //ext_xMan->giveInputRecord(* xmanRec);
            //dataReader.insertInputRecord(DataReader :: IR_xfemManRec, xmanRec);

            // Enrichment items
            int nEI = ext_xMan->giveNumberOfEnrichmentItems();
            for ( int i = 1; i <= nEI; i++ ) {
                EnrichmentItem *ext_ei = ext_xMan->giveEnrichmentItem(i);
                ext_ei->appendInputRecords(dataReader);


                InputRecord *mir = dataReader.giveInputRecord(DataReader :: IR_enrichItemRec, i);
                std :: string name;
                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_xMan, rve_domain ) );
                if ( ei.get() == NULL ) {
                    OOFEM_ERROR( "unknown enrichment item (%s)", name.c_str() );
                }

                ei->initializeFrom(mir);
                ei->instanciateYourself(dataReader);
                eiList.push_back( std :: move(ei) );

            }

            this_xMan->clearEnrichmentItems();
            this_xMan->appendEnrichmentItems(eiList);

            rve_domain->postInitialize();
            rve->forceEquationNumbering();
        }

    }

    //printf("done.\n");

#if 0
    Domain *newDomain = fe2ms->giveRVE()->giveDomain(1)->Clone();
    newDomain->SetEngngModel(rve.get());
    bool deallocateOld = true;
    rve->setDomain(1, newDomain, deallocateOld);

    //rve->giveDomain(1)->postInitialize();
    rve->giveNumericalMethod(NULL)->setDomain(newDomain);

    rve->postInitialize();
    //rve->forceEquationNumbering();

    rve->initMetaStepAttributes( rve->giveMetaStep(1) );
    rve->giveNextStep(); // Makes sure there is a timestep (which we will modify before solving a step)
    rve->init();


//    std :: ostringstream name;
//    name << this->rve->giveOutputBaseFileName() << "-gp" << n;
//    this->rve->letOutputBaseFileNameBe( name.str() );
//    n++;

    double crackLength = 0.0;
    XfemStructureManager *xMan = dynamic_cast<XfemStructureManager*>( rve->giveDomain(1)->giveXfemManager() );
    if ( xMan ) {
        crackLength = xMan->computeTotalCrackLength();
    }

    std :: ostringstream name;
    name << this->rve->giveOutputBaseFileName() << "-gp" << num << "crackLength" << crackLength;
    if ( this->domain->giveEngngModel()->isParallel() && this->domain->giveEngngModel()->giveNumberOfProcesses() > 1 ) {
        name << "." << this->domain->giveEngngModel()->giveRank();
    }

    num++;

    this->rve->letOutputBaseFileNameBe( name.str() );


    // Update BC
    this->bc = dynamic_cast< PrescribedGradientHomogenization * >( this->rve->giveDomain(1)->giveBc(1) );

#if 1

    XfemSolverInterface *xfemSolInt = dynamic_cast<XfemSolverInterface*>(rve.get());
    StaticStructural *statStruct = dynamic_cast<StaticStructural*>(rve.get());
    if ( xfemSolInt && statStruct ) {
        //printf("Successfully casted to XfemSolverInterface.\n");

        TimeStep *tStep = rve->giveCurrentStep();

        EModelDefaultEquationNumbering num;
        int numDofsNew = rve->giveNumberOfDomainEquations( 1, num );
        FloatArray u;
        u.resize(numDofsNew);
        u.zero();

        xfemSolInt->xfemUpdatePrimaryField(*statStruct, tStep, u);

        // Set domain pointer to various components ...
        rve->giveNumericalMethod(NULL)->setDomain(newDomain);
        //ioEngngModel.nMethod->setDomain(domain);

    }

//    TimeStep *tStep = rve->giveNextStep();
//    setTimeStep(tStep);
//    rve->solveYourselfAt(tStep);


    int numExpModules = rve->giveExportModuleManager()->giveNumberOfModules();
    for ( int i = 1; i <= numExpModules; i++ ) {
        //  ... by diving deep into the hierarchies ... :-/
        VTKXMLExportModule *vtkxmlMod = dynamic_cast< VTKXMLExportModule * >( rve->giveExportModuleManager()->giveModule(i) );
        if ( vtkxmlMod != NULL ) {
            vtkxmlMod->giveSmoother()->setDomain(newDomain);
            vtkxmlMod->givePrimVarSmoother()->setDomain(newDomain);
        }
    }
#endif
#endif
}
Ejemplo n.º 8
0
void Root_NTupleManager::fill(
	const InputRecord& irecord,
	const OutputRecord& orecord,
	Real64_t weigth
) {
	n_part_px.clear();
	n_part_py.clear();
	n_part_pz.clear();
	n_part_E.clear();
	n_part_pdgId.clear();
	
	int count = 0;
	const vector<Particle>& parts = irecord.particles();
	for (int j=0; j<parts.size(); ++j) {
		// pick only particles from hard process
		if (!isHardProcess(parts, j))
			continue;
			
		Real64_t px = parts[j].pT() * cos(parts[j].getPhi());
		Real64_t py = parts[j].pT() * sin(parts[j].getPhi());
		Real64_t pz = parts[j].pT() * sinh(parts[j].getEta());
		Real64_t E  = parts[j].pT() * cosh(parts[j].getEta());
		
		n_part_px.push_back(px);
		n_part_py.push_back(py);
		n_part_pz.push_back(pz);
		n_part_E.push_back(E);
		count++;
	}
	n_part_n = count;   

	n_pho_px.clear();
	n_pho_py.clear();
	n_pho_pz.clear();
	n_pho_E.clear();
	n_pho_pdgId.clear();
	
	for (int j=0; j<orecord.Photons.size(); ++j) {
		Real64_t px = orecord.Photons[j].pT * cos(orecord.Photons[j].phi);
		Real64_t py = orecord.Photons[j].pT * sin(orecord.Photons[j].phi);
		Real64_t pz = orecord.Photons[j].pT * sinh(orecord.Photons[j].eta);
		Real64_t E  = orecord.Photons[j].pT * cosh(orecord.Photons[j].eta);
		
		n_pho_px.push_back(px);
		n_pho_py.push_back(py);
		n_pho_pz.push_back(pz);
		n_pho_E.push_back(E);
	}
	n_pho_n = orecord.Photons.size(); 

	n_muo_px.clear();
	n_muo_py.clear();
	n_muo_pz.clear();
	n_muo_E.clear();
	n_muo_pdgId.clear();
	
	for (int j=0; j<orecord.Muons.size(); ++j) {
		Real64_t px = orecord.Muons[j].pT * cos(orecord.Muons[j].phi);
		Real64_t py = orecord.Muons[j].pT * sin(orecord.Muons[j].phi);
		Real64_t pz = orecord.Muons[j].pT * sinh(orecord.Muons[j].eta);
		Real64_t E  = orecord.Muons[j].pT * cosh(orecord.Muons[j].eta);
		
		n_muo_px.push_back(px);
		n_muo_py.push_back(py);
		n_muo_pz.push_back(pz);
		n_muo_E.push_back(E);
	}
	n_muo_n = orecord.Muons.size(); 

	n_ele_px.clear();
	n_ele_py.clear();
	n_ele_pz.clear();
	n_ele_E.clear();
	n_ele_pdgId.clear();
	
	for (int j=0; j<orecord.Electrons.size(); ++j) {
		Real64_t px = orecord.Electrons[j].pT * cos(orecord.Electrons[j].phi);
		Real64_t py = orecord.Electrons[j].pT * sin(orecord.Electrons[j].phi);
		Real64_t pz = orecord.Electrons[j].pT * sinh(orecord.Electrons[j].eta);
		Real64_t E  = orecord.Electrons[j].pT * cosh(orecord.Electrons[j].eta);
		
		n_ele_px.push_back(px);
		n_ele_py.push_back(py);
		n_ele_pz.push_back(pz);
		n_ele_E.push_back(E);
	}
	n_ele_n = orecord.Electrons.size(); 
	
	n_jet_px.clear();
	n_jet_py.clear();
	n_jet_pz.clear();
	n_jet_E.clear();
	n_jet_pdgId.clear();
	
	for (int j=0; j<orecord.Jets.size(); ++j) {
		Real64_t px = orecord.Jets[j].pT * cos(orecord.Jets[j].phi);
		Real64_t py = orecord.Jets[j].pT * sin(orecord.Jets[j].phi);
		Real64_t pz = orecord.Jets[j].pT * sinh(orecord.Jets[j].eta);
		Real64_t E  = orecord.Jets[j].pT * cosh(orecord.Jets[j].eta);
		n_jet_px.push_back(px);
		n_jet_py.push_back(py);
		n_jet_pz.push_back(pz);
		n_jet_E.push_back(E);
	}
	n_jet_n = orecord.Jets.size(); 

	ntuple->Fill();
}
Ejemplo n.º 9
0
void
AdaptiveNonLinearStatic :: assembleInitialLoadVector(FloatArray &loadVector, FloatArray &loadVectorOfPrescribed,
                                                     AdaptiveNonLinearStatic *sourceProblem, int domainIndx,
                                                     TimeStep *tStep)
{
    IRResultType result;                           // Required by IR_GIVE_FIELD macro

    int mStepNum = tStep->giveMetaStepNumber();
    int hasfixed, mode;
    InputRecord *ir;
    MetaStep *iMStep;
    FloatArray _incrementalLoadVector, _incrementalLoadVectorOfPrescribed;
    SparseNonLinearSystemNM :: referenceLoadInputModeType rlm;
    //Domain* sourceDomain = sourceProblem->giveDomain(domainIndx);

    loadVector.resize( this->giveNumberOfDomainEquations( domainIndx, EModelDefaultEquationNumbering() ) );
    loadVectorOfPrescribed.resize( this->giveNumberOfDomainEquations( domainIndx, EModelDefaultPrescribedEquationNumbering() ) );
    loadVector.zero();
    loadVectorOfPrescribed.zero();
    _incrementalLoadVector.resize( this->giveNumberOfDomainEquations( domainIndx, EModelDefaultEquationNumbering() ) );
    _incrementalLoadVectorOfPrescribed.resize( this->giveNumberOfDomainEquations( domainIndx, EModelDefaultPrescribedEquationNumbering() ) );
    _incrementalLoadVector.zero();
    _incrementalLoadVectorOfPrescribed.zero();

    for ( int imstep = 1; imstep < mStepNum; imstep++ ) {
        iMStep = this->giveMetaStep(imstep);
        ir = iMStep->giveAttributesRecord();
        //hasfixed = ir->hasField("fixload");
        hasfixed = 1;
        if ( hasfixed ) {
            // test for control mode
            // here the algorithm works only for direct load control.
            // Direct displacement control requires to know the quasi-rections, and the controlled nodes
            // should have corresponding node on new mesh -> not supported
            // Indirect control -> the load level from prevous steps is required, currently nt supported.

            // additional problem: direct load control supports the reduction of step legth if convergence fails
            // if this happens, this implementation does not work correctly.
            // But there is NO WAY HOW TO TEST IF THIS HAPPEN

            mode = 0;
            IR_GIVE_OPTIONAL_FIELD(ir, mode, _IFT_AdaptiveNonLinearStatic_controlmode);

            // check if displacement control takes place
            if ( ir->hasField(_IFT_AdaptiveNonLinearStatic_ddm) ) {
                OOFEM_ERROR("fixload recovery not supported for direct displacement control");
            }

            int firststep = iMStep->giveFirstStepNumber();
            int laststep  = iMStep->giveLastStepNumber();

            int _val = 0;
            IR_GIVE_OPTIONAL_FIELD(ir, _val, _IFT_AdaptiveNonLinearStatic_refloadmode);
            rlm = ( SparseNonLinearSystemNM :: referenceLoadInputModeType ) _val;

            if ( mode == ( int ) nls_directControl ) { // and only load control
                for ( int istep = firststep; istep <= laststep; istep++ ) {
                    // bad practise here
                    ///@todo Likely memory leak here with new TimeStep; Check.
                    TimeStep *old = new TimeStep(istep, this, imstep, istep - 1.0, deltaT, 0);
                    this->assembleIncrementalReferenceLoadVectors(_incrementalLoadVector, _incrementalLoadVectorOfPrescribed,
                                                                  rlm, this->giveDomain(domainIndx), EID_MomentumBalance, old);

                    _incrementalLoadVector.times( sourceProblem->giveTimeStepLoadLevel(istep) );
                    loadVector.add(_incrementalLoadVector);
                    loadVectorOfPrescribed.add(_incrementalLoadVectorOfPrescribed);
                }
            } else if ( mode == ( int ) nls_indirectControl ) {
                // bad practise here
                if ( !ir->hasField(_IFT_NonLinearStatic_donotfixload) ) {
                    TimeStep *old = new TimeStep(firststep, this, imstep, firststep - 1.0, deltaT, 0);
                    this->assembleIncrementalReferenceLoadVectors(_incrementalLoadVector, _incrementalLoadVectorOfPrescribed,
                                                                  rlm, this->giveDomain(domainIndx), EID_MomentumBalance, old);

                    _incrementalLoadVector.times( sourceProblem->giveTimeStepLoadLevel(laststep) );
                    loadVector.add(_incrementalLoadVector);
                    loadVectorOfPrescribed.add(_incrementalLoadVectorOfPrescribed);
                }
            } else {
                OOFEM_ERROR("fixload recovery not supported");
            }
        }
    } // end loop over meta-steps

    /* if direct control; add to initial load also previous steps in same metestep */
    iMStep = this->giveMetaStep(mStepNum);
    ir = iMStep->giveAttributesRecord();
    mode = 0;
    IR_GIVE_OPTIONAL_FIELD(ir, mode, _IFT_AdaptiveNonLinearStatic_controlmode);
    int firststep = iMStep->giveFirstStepNumber();
    int laststep  = tStep->giveNumber();
    int _val = 0;
    IR_GIVE_OPTIONAL_FIELD(ir, _val, _IFT_AdaptiveNonLinearStatic_refloadmode);
    rlm = ( SparseNonLinearSystemNM :: referenceLoadInputModeType ) _val;

    if ( mode == ( int ) nls_directControl ) { // and only load control
        for ( int istep = firststep; istep <= laststep; istep++ ) {
            // bad practise here
            TimeStep *old = new TimeStep(istep, this, mStepNum, istep - 1.0, deltaT, 0);
            this->assembleIncrementalReferenceLoadVectors(_incrementalLoadVector, _incrementalLoadVectorOfPrescribed,
                                                          rlm, this->giveDomain(domainIndx), EID_MomentumBalance, old);

            _incrementalLoadVector.times( sourceProblem->giveTimeStepLoadLevel(istep) );
            loadVector.add(_incrementalLoadVector);
            loadVectorOfPrescribed.add(_incrementalLoadVectorOfPrescribed);
        }
    }
}