• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ fsi::vector类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中fsi::vector的典型用法代码示例。如果您正苦于以下问题:C++ vector类的具体用法?C++ vector怎么用?C++ vector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: getSourceTerm

    void ESDIRK::getSourceTerm(
        const bool /*corrector*/,
        const int k,
        const int /*sweep*/,
        const scalar deltaT,
        fsi::vector & rhs,
        fsi::vector & qold
        )
    {
        assert( k <= nbStages - 1 );

        qold = this->qold;

        // Compute the time step from the stage deltaT
        if ( dt < 0 )
        {
            // first time step, first prediction step
            dt = deltaT / A( k, k );
        }

        assert( dt > 0 );

        rhs.setZero();

        // Calculate sum of the stage residuals
        for ( int iStage = 0; iStage < k; iStage++ )
            rhs += A( k, iStage ) * F.row( iStage ).transpose();

        rhs.array() *= dt;

        this->stageIndex = k;
    }
开发者ID:gunnups,项目名称:FOAM-FSI,代码行数:32,代码来源:ESDIRK.C


示例2: optimize

void ImplicitMultiLevelFsiSolver::optimize(
    const fsi::vector & y,
    const fsi::vector & x0,
    fsi::vector & xk
    )
{
    assert( init );

    assert( y.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        || y.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        + fsi->fluidSolver->couplingGridSize * fsi->fluid->dim );

    assert( x0.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        || x0.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        + fsi->fluidSolver->couplingGridSize * fsi->fluid->dim );

    assert( xk.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        || xk.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        + fsi->fluidSolver->couplingGridSize * fsi->fluid->dim );

    assert( x0.rows() == xk.rows() );
    assert( y.rows() == xk.rows() );

    fsi->newMeasurementSeries();

    postProcessing->performPostProcessing( y, x0, xk );
}
开发者ID:KangX1,项目名称:FOAM-FSI,代码行数:27,代码来源:ImplicitMultiLevelFsiSolver.C


示例3: storeFunction

 void DataStorage::storeFunction(
     const fsi::vector & f,
     int substep
     )
 {
     assert( f.rows() == F.cols() );
     assert( substep <= F.rows() );
     assert( not std::isnan( f.norm() ) );
     F.row( substep ) = f;
 }
开发者ID:shravankottapalli,项目名称:FOAM-FSI,代码行数:10,代码来源:DataStorage.C


示例4: storeSolution

 void DataStorage::storeSolution(
     const fsi::vector & sol,
     int substep
     )
 {
     assert( sol.rows() == solStages.cols() );
     assert( substep <= solStages.rows() );
     assert( not std::isnan( sol.norm() ) );
     solStages.row( substep ) = sol;
 }
开发者ID:shravankottapalli,项目名称:FOAM-FSI,代码行数:10,代码来源:DataStorage.C


示例5: evaluate

void ImplicitMultiLevelFsiSolver::evaluate(
    const fsi::vector & x,
    fsi::vector & output,
    fsi::vector & R
    )
{
    assert( init );

    assert( x.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        || x.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        + fsi->fluidSolver->couplingGridSize * fsi->fluid->dim );

    assert( output.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        || output.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        + fsi->fluidSolver->couplingGridSize * fsi->fluid->dim );

    assert( R.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        || R.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        + fsi->fluidSolver->couplingGridSize * fsi->fluid->dim );

    assert( x.rows() == output.rows() );
    assert( x.rows() == R.rows() );

    fsi->evaluate( x, output, R );
}
开发者ID:KangX1,项目名称:FOAM-FSI,代码行数:25,代码来源:ImplicitMultiLevelFsiSolver.C


示例6: optimize

    virtual void optimize(
        const fsi::vector & y,
        const fsi::vector & /*x0*/,
        fsi::vector & xk
        )
    {
        assert( y.rows() == 3 );
        assert( xk.rows() == 2 );

        // Analytical optimum
        xk( 0 ) = (y[2] - y[0]) / 2.0;
        xk( 1 ) = (y[0] + y[1] + y[2]) / 3.0;
    }
开发者ID:davidsblom,项目名称:FOAM-FSI,代码行数:13,代码来源:test_manifoldmapping.C


示例7: solFluid

void SDCFsiSolver::setSolution(
    const fsi::vector & solution,
    const fsi::vector & f
    )
{
    Eigen::Map<const fsi::vector> solFluid( solution.data(), dofFluid );
    Eigen::Map<const fsi::vector> solSolid( solution.data() + dofFluid, dofSolid );

    Eigen::Map<const fsi::vector> fFluid( f.data(), dofFluid );
    Eigen::Map<const fsi::vector> fSolid( f.data() + dofFluid, dofSolid );

    fluid->setSolution( solFluid, fFluid );
    solid->setSolution( solSolid, fSolid );
}
开发者ID:shravankottapalli,项目名称:FOAM-FSI,代码行数:14,代码来源:SDCFsiSolver.C


示例8: evaluate

    virtual void evaluate(
        const fsi::vector & x,
        fsi::vector & output,
        fsi::vector & R
        )
    {
        assert( x.rows() == 2 );
        assert( R.rows() == 3 );

        fsi::vector t( 3 );
        t << -1, 0, 1;

        R = x( 0 ) * t + x( 1 ) * Eigen::MatrixXd::Ones( 3, 1 );
        output = R;
    }
开发者ID:KangX1,项目名称:FOAM-FSI,代码行数:15,代码来源:test_manifoldmapping.C


示例9: isConvergence

    virtual bool isConvergence(
        const fsi::vector & x,
        const fsi::vector & xprev
        )
    {
        assert( x.rows() == xprev.rows() );

        iter++;

        allConverged_ = false;

        if ( (x - xprev).norm() < tol * x.norm() )
            allConverged_ = true;

        return allConverged_;
    }
开发者ID:KangX1,项目名称:FOAM-FSI,代码行数:16,代码来源:test_manifoldmapping.C


示例10: qoldFluid

void SDCFsiSolver::implicitSolve(
    bool corrector,
    const int k,
    const int kold,
    const scalar t,
    const scalar dt,
    const fsi::vector & qold,
    const fsi::vector & rhs,
    fsi::vector & f,
    fsi::vector & result
    )
{
    Eigen::Map<const fsi::vector> qoldFluid( qold.data(), dofFluid );
    Eigen::Map<const fsi::vector> qoldSolid( qold.data() + dofFluid, dofSolid );

    Eigen::Map<const fsi::vector> rhsFluid( rhs.data(), dofFluid );
    Eigen::Map<const fsi::vector> rhsSolid( rhs.data() + dofFluid, dofSolid );

    fluid->prepareImplicitSolve( corrector, k, kold, t, dt, qoldFluid, rhsFluid );
    solid->prepareImplicitSolve( corrector, k, kold, t, dt, qoldSolid, rhsSolid );

    // Perform FSI iterations to solve the coupled problem

    postProcessing->fsi->newMeasurementSeries();

    // Initial solution
    fsi::vector x0;

    if ( corrector )
        x0 = xStages.at( k + 1 );
    else
        x0 = xStages.at( k );

    postProcessing->initStage( k );
    postProcessing->performPostProcessing( x0, postProcessing->fsi->x );
    postProcessing->finalizeStage();

    getSolution( result, f );
    evaluateFunction( k, result, t, f );

    xStages.at( k + 1 ) = postProcessing->fsi->x;

    fluid->finalizeImplicitSolve( k );
    solid->finalizeImplicitSolve( k );
}
开发者ID:shravankottapalli,项目名称:FOAM-FSI,代码行数:45,代码来源:SDCFsiSolver.C


示例11: fFluid

void SDCFsiSolver::evaluateFunction(
    const int k,
    const fsi::vector & q,
    const scalar t,
    fsi::vector & f
    )
{
    fsi::vector fFluid( dofFluid ), fSolid( dofSolid );

    Eigen::Map<const fsi::vector> qFluid( q.data(), dofFluid );
    Eigen::Map<const fsi::vector> qSolid( q.data() + dofFluid, dofSolid );

    fluid->evaluateFunction( k, qFluid, t, fFluid );
    solid->evaluateFunction( k, qSolid, t, fSolid );

    f.head( dofFluid ) = fFluid;
    f.tail( dofSolid ) = fSolid;
}
开发者ID:shravankottapalli,项目名称:FOAM-FSI,代码行数:18,代码来源:SDCFsiSolver.C


示例12: setFunction

    void ESDIRK::setFunction(
        const int k,
        const fsi::vector & f,
        const fsi::vector & result
        )
    {
        assert( f.rows() == result.rows() );
        assert( k <= nbStages - 1 );

        if ( F.cols() == 0 )
            F.resize( nbStages, f.rows() );

        if ( solStages.cols() == 0 )
            solStages.resize( nbStages, f.rows() );

        F.row( k ) = f;
        solStages.row( k ) = result;
    }
开发者ID:gunnups,项目名称:FOAM-FSI,代码行数:18,代码来源:ESDIRK.C


示例13: b

void TubeFlowLinearizedFluidSolver::solve(
    const fsi::vector & a,
    fsi::vector & p
    )
{
    this->a = a.array() - a0;

    std::cout << "Solve fluid domain" << std::endl;

    // Construct right hand size of linear system

    fsi::vector b( 2 * N ), x( 2 * N );
    b.setZero();

    for ( int i = 1; i < N - 1; i++ )
    {
        // Continuity equation rhs

        b( i ) = dx / dt * ( an( i ) - this->a( i ) );
        b( i ) += 0.5 * u0 * ( this->a( i - 1 ) - this->a( i + 1 ) );

        // Momentum equation rhs

        b( i + N ) = u0 * dx / dt * ( an( i ) - this->a( i ) );
        b( i + N ) += 0.5 * u0 * u0 * ( this->a( i - 1 ) - this->a( i + 1 ) );
        b( i + N ) += a0 * dx / dt * un( i );
    }

    // Boundary conditions

    // Velocity inlet condition
    b( 0 ) = u0 / 10.0 * std::pow( std::sin( M_PI * timeIndex * tau ), 2 );

    // Pressure inlet
    b( N ) = 0;

    // Velocity outlet condition
    b( N - 1 ) = 0;

    // Pressure outlet condition
    b( 2 * N - 1 ) = -cmk * rho * un( N - 1 ) + pn( N - 1 );

    // Solve for x

    x = lu.solve( b );

    // Retrieve solution

    u = x.head( N );
    this->p = x.tail( N );

    // Return pressure p
    p = this->p.array() + p0;

    data.col( 0 ) = p;
}
开发者ID:KangX1,项目名称:FOAM-FSI,代码行数:56,代码来源:TubeFlowLinearizedFluidSolver.C


示例14: operator

 int operator()(
     const fsi::vector & x,
     fsi::vector & fvec
     ) const
 {
     fsi::vector output( x.rows() );
     model->evaluate( x, output, fvec );
     fvec -= *y;
     return 0;
 }
开发者ID:davidsblom,项目名称:FOAM-FSI,代码行数:10,代码来源:test_manifoldmapping.C


示例15: setOldSolution

    void ESDIRK::setOldSolution(
        int timeIndex,
        const fsi::vector & result
        )
    {
        assert( timeIndex >= this->timeIndex );

        if ( qold.rows() == result.rows() )
            qold = solStages.bottomRows( 1 ).transpose();
        else
        if ( timeIndex > this->timeIndex )
            qold = result;

        this->timeIndex = timeIndex;
    }
开发者ID:gunnups,项目名称:FOAM-FSI,代码行数:15,代码来源:ESDIRK.C


示例16: assert

void SDCFsiSolver::getSolution(
    fsi::vector & solution,
    fsi::vector & f
    )
{
    assert( dofFluid > 0 );
    assert( dofSolid >= 0 );
    assert( dofFluid + dofSolid == solution.rows() );
    assert( solution.rows() == f.rows() );

    fsi::vector solFluid( dofFluid ), solSolid( dofSolid ), fFluid( dofFluid ), fSolid( dofSolid );
    fluid->getSolution( solFluid, fFluid );
    solid->getSolution( solSolid, fSolid );

    solution.head( dofFluid ) = solFluid;
    solution.tail( dofSolid ) = solSolid;
    f.head( dofFluid ) = fFluid;
    f.tail( dofSolid ) = fSolid;
}
开发者ID:shravankottapalli,项目名称:FOAM-FSI,代码行数:19,代码来源:SDCFsiSolver.C


示例17: isConvergence

bool ImplicitMultiLevelFsiSolver::isConvergence(
    const fsi::vector & x,
    const fsi::vector & xprev
    )
{
    assert( init );

    assert( x.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        || x.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        + fsi->fluidSolver->couplingGridSize * fsi->fluid->dim );

    assert( xprev.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        || xprev.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        + fsi->fluidSolver->couplingGridSize * fsi->fluid->dim );

    assert( x.rows() == xprev.rows() );

    return fsi->isConvergence( x, xprev );
}
开发者ID:KangX1,项目名称:FOAM-FSI,代码行数:19,代码来源:ImplicitMultiLevelFsiSolver.C



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ftp::Client类代码示例发布时间:2022-05-31
下一篇:
C++ fs::path类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap