示例#1
0
void
AdaptiveNonLinearStatic :: solveYourselfAt(TimeStep *tStep)
{
    proceedStep(1, tStep);
    this->updateYourself(tStep);

#ifdef __OOFEG
    ESIEventLoop( YES, const_cast< char * >("AdaptiveNonLinearStatic: Solution finished; Press Ctrl-p to continue") );
#endif

    this->terminate( this->giveCurrentStep() );

#ifdef __PARALLEL_MODE
    if ( preMappingLoadBalancingFlag ) {
        this->balanceLoad( this->giveCurrentStep() );
    }

#endif

    // evaluate error of the reached solution
    this->defaultErrEstimator->estimateError( equilibratedEM, this->giveCurrentStep() );
    //this->defaultErrEstimator->estimateError( temporaryEM, this->giveCurrentStep() );
    this->defaultErrEstimator->giveRemeshingCrit()->estimateMeshDensities( this->giveCurrentStep() );
    RemeshingStrategy strategy = this->defaultErrEstimator->giveRemeshingCrit()->giveRemeshingStrategy( this->giveCurrentStep() );

    // if ((strategy == RemeshingFromCurrentState_RS) && (this->giveDomain(1)->giveSerialNumber() == 0))
    //  strategy = RemeshingFromPreviousState_RS;

    if ( strategy == NoRemeshing_RS ) {
        //
    } else if ( ( strategy == RemeshingFromCurrentState_RS ) || ( strategy == RemeshingFromPreviousState_RS ) ) {
        // do remeshing
        MesherInterface *mesher = classFactory.createMesherInterface( meshPackage, this->giveDomain(1) );

        Domain *newDomain;
        MesherInterface :: returnCode result = mesher->createMesh(this->giveCurrentStep(), 1,
                                                                  this->giveDomain(1)->giveSerialNumber() + 1, & newDomain);

        delete mesher;

        if ( result == MesherInterface :: MI_OK ) {
            this->initFlag = 1;
            this->adaptiveRemap(newDomain);
        } else if ( result == MesherInterface :: MI_NEEDS_EXTERNAL_ACTION ) {
            if ( strategy == RemeshingFromCurrentState_RS ) {
                // ensure the updating the step
                this->setContextOutputMode(COM_Always);
                //this->terminate (this->giveCurrentStep());
            } else {
                // save previous step (because update not called)
            }

            this->terminateAnalysis();
            throw OOFEM_Terminate();
        } else {
            OOFEM_ERROR("createMesh failed");
        }
    }
}
void
NonLinearStatic :: solveYourselfAt(TimeStep *tStep)
{
    proceedStep(1, tStep);
}