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


C++ dataPtr_Type::method方法代码示例

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


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

示例1: readLastVectorALETimeAdvance

void Problem::readLastVectorALETimeAdvance ( vectorPtr_Type fluidDisp,
                                             const std::string loadInitSol)
{
    using namespace LifeV;

    typedef FSIOperator::mesh_Type        mesh_Type;

    //We still need to load the last vector for ALE
    std::string iterationString = loadInitSol;
    fluidDisp.reset (new vector_Type (M_fsi->FSIOper()->mmFESpace().map(), LifeV::Unique) );

    //Setting the exporterData to read: ALE problem
    LifeV::ExporterData<mesh_Type> initSolFluidDisp  (LifeV::ExporterData<mesh_Type>::VectorField, "f-displacement." + iterationString, M_fsi->FSIOper()->mmFESpacePtr(), fluidDisp, UInt (0), LifeV::ExporterData<mesh_Type>::UnsteadyRegime );

    //Initializing
    *fluidDisp *= 0.0;

    //Reading
    M_importerFluid->readVariable (initSolFluidDisp); //Fluid df

    //Output
    std::cout << "Norm of the df " << fluidDisp->norm2() << std::endl;

    //This is ugly but it's the only way I have figured out at the moment
    if ( M_data->method().compare ("monolithicGI") == 0 )
    {
        //Don't be scared by the ten. The goal of 10 is just to make the first if fail
        M_fsi->FSIOper()->setALEVectorInStencil ( fluidDisp, 10, true );
    }

    //Setting the vector in the stencil
    M_fsi->FSIOper()->ALETimeAdvance()->shiftRight ( *fluidDisp );
}
开发者ID:hamed20,项目名称:lifev,代码行数:33,代码来源:main.cpp

示例2: initializeWithVectors

void Problem::initializeWithVectors ( void )
{

    using namespace LifeV;
    // vectors to store the solutions we want.
    vectorPtr_Type vel;
    vectorPtr_Type pressure;
    vectorPtr_Type solidDisp;
    vectorPtr_Type fluidDisp;

    vel.reset (new vector_Type (M_fsi->FSIOper()->uFESpace().map(), LifeV::Unique) );
    pressure.reset (new vector_Type (M_fsi->FSIOper()->pFESpace().map(), LifeV::Unique) );
    solidDisp.reset (new vector_Type (M_fsi->FSIOper()->dFESpace().map(), LifeV::Unique) );
    fluidDisp.reset (new vector_Type (M_fsi->FSIOper()->mmFESpace().map(), LifeV::Unique) );

    // In this case we want to initialize only the pressure
    M_fsi->FSIOper()->pFESpacePtr()->interpolate ( static_cast<FESpace<RegionMesh<LinearTetra>, MapEpetra> ::function_Type> ( pressureInitial ), *pressure, 0.0 );

    *vel *= 0.0;
    *solidDisp *= 0.0;
    *fluidDisp *= 0.0;

    UInt iterInit;

    // Filling the stencils
    for (iterInit = 0; iterInit < M_fsi->FSIOper()->fluidTimeAdvance()->size(); iterInit++ )
    {
        //We send the vectors to the FSIMonolithic class using the interface of FSIOper
        M_fsi->FSIOper()->setVectorInStencils (vel, pressure, solidDisp, iterInit );
    }

    // This was in readLastVectorSolidStencil
    M_fsi->FSIOper()->setSolidVectorInStencil ( solidDisp, iterInit );

    // Ale part
    for (iterInit = 0; iterInit < M_fsi->FSIOper()->ALETimeAdvance()->size(); iterInit++ )
    {
        //Setting the vector in the stencil
        M_fsi->FSIOper()->setALEVectorInStencil ( fluidDisp, iterInit, false );
    }

    //Initializing the vector for the RHS terms of the formulas
    M_fsi->FSIOper()->finalizeRestart();

    // This was read the last vector from ALE
    //This is ugly but it's the only way I have figured out at the moment
    if ( M_data->method().compare ("monolithicGI") == 0 )
    {
        //Don't be scared by the ten. The goal of 10 is just to make the first if fail
        M_fsi->FSIOper()->setALEVectorInStencil ( fluidDisp, 10, true );
    }

    //Setting the vector in the stencil
    M_fsi->FSIOper()->ALETimeAdvance()->shiftRight ( *fluidDisp );

}
开发者ID:Danniel-UCAS,项目名称:lifev,代码行数:56,代码来源:main.cpp

示例3: fluidLeader

// ===================================================
// Methods
// ===================================================
void
FSISolver::setData( const dataPtr_Type& data )
{
    M_data = data;

    int rank, numtasks;
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    MPI_Comm_size(MPI_COMM_WORLD, &numtasks);

    bool fluid = false;
    bool solid = false;

    int  fluidLeader(0);
    int  solidLeader(0);

    if ( ( data->method().compare("monolithicGE") && data->method().compare("monolithicGI") ) )
    {
        MPI_Group  originGroup, newGroup;
        MPI_Comm_group(MPI_COMM_WORLD, &originGroup);

        if ( numtasks == 1 )
        {
            std::cout << "Serial Fluid/Structure computation" << std::endl;
            fluid = true;
            solid = true;
            solidLeader = 0;
            fluidLeader = solidLeader;

            M_epetraWorldComm.reset( new Epetra_MpiComm(MPI_COMM_WORLD));
            M_epetraComm = M_epetraWorldComm;
        }
        else
        {
            std::vector<int> members(numtasks);

            solidLeader = 0;
            fluidLeader = 1-solidLeader;

            if (rank == solidLeader)
            {
                members[0] = solidLeader;
                /* int ierr = */
                MPI_Group_incl(originGroup, 1, &members[0], &newGroup);
                solid = true;
            }
            else
            {
                for (Int ii = 0; ii <= numtasks; ++ii)
                {
                    if ( ii < solidLeader)
                        members[ii] = ii;
                    else if ( ii > solidLeader)
                        members[ii - 1] = ii;
                }

                /* int ierr = */ MPI_Group_incl(originGroup, numtasks - 1, &members[0], &newGroup);
                fluid = true;
            }

            MPI_Comm* localComm = new MPI_Comm;
            MPI_Comm_create(MPI_COMM_WORLD, newGroup, localComm);
            M_localComm.reset(localComm);

            M_epetraComm.reset(new Epetra_MpiComm(*M_localComm.get()));
            M_epetraWorldComm.reset(new Epetra_MpiComm(MPI_COMM_WORLD));
        }
    }
    else // Monolithic or FullMonolithic
    {
        fluid = true;
        solid = true;
        solidLeader = 0;
        fluidLeader = solidLeader;

        M_epetraWorldComm.reset( new Epetra_MpiComm(MPI_COMM_WORLD));
        M_epetraComm = M_epetraWorldComm;
    }

#ifdef DEBUG
    if ( fluid )
    {
        debugStream(6220) << M_epetraComm->MyPID()
        << " ( " << rank << " ) "
        << " out of " << M_epetraComm->NumProc()
        << " ( " << numtasks << " ) "
        << " is fluid." << std::endl;
    }
    if ( solid )
    {
        debugStream(6220) << M_epetraComm->MyPID()
        << " ( " << rank << " ) "
        << " out of " << M_epetraComm->NumProc()
        << " ( " << numtasks << " ) "
        << " is solid." << std::endl;
    }
#endif

//.........这里部分代码省略.........
开发者ID:nuraiman,项目名称:lifev,代码行数:101,代码来源:FSISolver.cpp


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