当前位置: 首页>>代码示例>>C++>>正文


C++ EngngModel::solveYourself方法代码示例

本文整理汇总了C++中EngngModel::solveYourself方法的典型用法代码示例。如果您正苦于以下问题:C++ EngngModel::solveYourself方法的具体用法?C++ EngngModel::solveYourself怎么用?C++ EngngModel::solveYourself使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EngngModel的用法示例。


在下文中一共展示了EngngModel::solveYourself方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: solveYourselfAt

void
StaticFracture :: solveYourselfAt(TimeStep *tStep)
{
    for ( int subProb = 1; subProb <= this->giveNumberOfSlaveProblems(); subProb++ ) {
        EngngModel *sp = this->giveSlaveProblem(subProb);

        //sp->giveNextStep();
        sp->solveYourself();
        //sp->solveYourselfAt( sp->giveCurrentStep() );
        
    }   
}
开发者ID:JimBrouzoulis,项目名称:OOFEM_LargeDef,代码行数:12,代码来源:staticfracture.C

示例2: solveYourself

void
StaticFracture :: solveYourself()
{
    MetaStep *activeMStep;
    FILE *out = this->giveOutputStream();
    this->timer.startTimer(EngngModelTimer :: EMTT_AnalysisTimer);
    this->giveNumberOfSlaveProblems();
    
    this->timer.startTimer(EngngModelTimer :: EMTT_SolutionStepTimer);
    this->timer.initTimer(EngngModelTimer :: EMTT_NetComputationalStepTimer);


    int numMetaSteps = this->giveNumberOfMetaSteps();
    for (int imstep = 1; imstep <= numMetaSteps; imstep++) { // don't know what will happen if we have several meta steps?
        activeMStep = this->giveMetaStep(imstep);

        int nTimeSteps = activeMStep->giveNumberOfSteps();
        for ( int tStepNum = 1; tStepNum <= nTimeSteps; tStepNum++ ) { //loop over time steps in opt analysis

            for ( int subProb = 1; subProb <= this->giveNumberOfSlaveProblems(); subProb++ ) {
        
                EngngModel *sp = this->giveSlaveProblem(subProb); 
                sp->solveYourself();

                //this->updateYourself( this->giveCurrentStep()); // not neccessary
            
                // optimization
                this->optimize( this->giveCurrentStep() );    

                // Resetting the time step number for each sp after each optimization time step
                TimeStep *tStep =  sp->giveCurrentStep();
                tStep->setNumber(tStepNum); 
                sp->giveExportModuleManager()->doOutput(tStep); // turn off export during regular analysis
            
                tStep->setNumber(0); // otherwise the anlysis wont restart at time 0
                }
        }
    }
    

}
开发者ID:JimBrouzoulis,项目名称:OOFEM_LargeDef,代码行数:41,代码来源:staticfracture.C

示例3: main


//.........这里部分代码省略.........
    }

#if defined ( __PETSC_MODULE ) || defined ( __SLEPC_MODULE )
    int modulesArgc = modulesArgs.size();
    char **modulesArgv = const_cast< char ** >(& modulesArgs [ 0 ]);
#endif

#ifdef __PETSC_MODULE
    PetscInitialize(& modulesArgc, & modulesArgv, PETSC_NULL, PETSC_NULL);
#endif

#ifdef __SLEPC_MODULE
    SlepcInitialize(& modulesArgc, & modulesArgv, PETSC_NULL, PETSC_NULL);
#endif

#ifdef __PYTHON_MODULE
    Py_Initialize();
    // Adding . to the system path allows us to run Python functions stored in the working directory.
    PyRun_SimpleString("import sys");
    PyRun_SimpleString("sys.path.append(\".\")");
#endif

#ifdef __PARALLEL_MODE
    if ( parallelFlag ) {
        inputFileName << "." << rank;
        outputFileName << "." << rank;
        errOutputFileName << "." << rank;
    }
#endif
    if ( outputFileFlag ) {
        oofem_logger.appendLogTo( outputFileName.str() );
    }
    if ( errOutputFileFlag ) {
        oofem_logger.appendErrorTo( errOutputFileName.str() );
    }

    // print header to redirected output
    OOFEM_LOG_FORCED(PRG_HEADER_SM);

    OOFEMTXTDataReader dr( inputFileName.str() );
    EngngModel *problem = :: InstanciateProblem(dr, _processor, contextFlag, NULL, parallelFlag);
    dr.finish();
    if ( !problem ) {
        OOFEM_LOG_ERROR("Couldn't instanciate problem, exiting");
        exit(EXIT_FAILURE);
    }

    problem->checkProblemConsistency();
    problem->init();

    if ( renumberFlag ) {
        problem->setRenumberFlag();
    }

    if ( restartFlag ) {
        try {
            FileDataStream stream(problem->giveContextFileName(restartStep, 0), false);
            problem->restoreContext(stream, CM_State | CM_Definition);
        } catch ( const FileDataStream::CantOpen & e ) {
            printf("%s", e.what());
            exit(1);
        } catch ( ContextIOERR & c ) {
            c.print();
            exit(1);
        }
        problem->initStepIncrements();
    } else if ( adaptiveRestartFlag ) {
        problem->initializeAdaptive(adaptiveRestartFlag);
        problem->saveStepContext(problem->giveCurrentStep(),CM_State);
        // exit (1);
    }

    if ( debugFlag ) {
        oofem_debug(problem);
    }


    try {
        problem->solveYourself();
    } catch(OOFEM_Terminate & c) {
        delete problem;

        oofem_finalize_modules();

        return 1;
    }

    problem->terminateAnalysis();
#ifdef __PARALLEL_MODE
    if ( parallelFlag ) {
        DynamicCommunicationBuffer :: printInfo();
    }
#endif
    oofem_logger.printStatistics();
    delete problem;

    oofem_finalize_modules();

    return 0;
}
开发者ID:aishugang,项目名称:oofem,代码行数:101,代码来源:main.C


注:本文中的EngngModel::solveYourself方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。