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


C++ tmp::ref方法代码示例

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


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

示例1: tfield

bool Foam::functionObjects::regionFunctionObject::store
(
    word& fieldName,
    const tmp<ObjectType>& tfield,
    bool cacheable
)
{
    if (cacheable && fieldName == tfield().name())
    {
        WarningInFunction
            << "Cannot store cache-able field with the named used in the cache."
            << nl
            << "    Either choose a different name or cache the field"
            << "    and use the 'writeObjects' functionObject."
            << endl;

        return false;
    }

    if
    (
        fieldName.size()
     && obr_.foundObject<ObjectType>(fieldName)
    )
    {
        const ObjectType& field =
        (
            obr_.lookupObject<ObjectType>(fieldName)
        );

        // If there is a result field already registered assign to the new
        // result field otherwise transfer ownership of the new result field to
        // the object registry
        if (&field != &tfield())
        {
            const_cast<ObjectType&>(field) = tfield;
        }
        else
        {
            obr_.objectRegistry::store(tfield.ptr());
        }
    }
    else
    {
        if (fieldName.size() && fieldName != tfield().name())
        {
            tfield.ref().rename(fieldName);
        }
        else
        {
            fieldName = tfield().name();
        }

        obr_.objectRegistry::store(tfield.ptr());
    }

    return true;
}
开发者ID:avamingli,项目名称:OpenFOAM-dev,代码行数:58,代码来源:regionFunctionObjectTemplates.C

示例2: forAll

Foam::tmp<Foam::volVectorField> Foam::wallLubricationModel::zeroGradWalls
(
    tmp<volVectorField> tFi
) const
{
    volVectorField& Fi = tFi.ref();
    const fvPatchList& patches =  Fi.mesh().boundary();

    forAll(patches, patchi)
    {
        if (isA<wallFvPatch>(patches[patchi]))
        {
            fvPatchVectorField& Fiw = Fi.boundaryField()[patchi];
            Fiw = Fiw.patchInternalField();
        }
    }

    return tFi;
}
开发者ID:embeddedsamurai,项目名称:OpenFOAM-dev,代码行数:19,代码来源:wallLubricationModel.C

示例3: twoDCorrectPoints

            {
                pointLocation_()[pz[i]] = points0()[pz[i]];
            }
        }

        twoDCorrectPoints(pointLocation_().primitiveFieldRef());

        return tmp<pointField>(pointLocation_().primitiveField());
    }
    else
    {
        tmp<pointField> tcurPoints
        (
            points0() + pointDisplacement_.primitiveField()
        );
        pointField& curPoints = tcurPoints.ref();

        // Implement frozen points
        if (frozenPointsZone_ != -1)
        {
            const pointZone& pz = fvMesh_.pointZones()[frozenPointsZone_];

            forAll(pz, i)
            {
                curPoints[pz[i]] = points0()[pz[i]];
            }
        }

        twoDCorrectPoints(curPoints);

        return tcurPoints;
开发者ID:petebachant,项目名称:OpenFOAM-dev,代码行数:31,代码来源:displacementLaplacianFvMotionSolver.C

示例4: fvOptions

      + fvm::Sp(((C1_/2)*epsilon_ + (C1s_/2)*G)*alpha*rho/k_, R)
     ==
        alpha*rho*P
      - ((1.0/3.0)*I)*(((2.0 - C1_)*epsilon_ - C1s_*G)*alpha*rho)
      + (C2_*(alpha*rho*epsilon_))*dev(innerSqr(b))
      + alpha*rho*k_
       *(
            (C3_ - C3s_*mag(b))*dev(S)
          + C4_*dev(twoSymm(b&S))
          + C5_*twoSymm(b&Omega)
        )
      + fvOptions(alpha, rho, R)
    );

    REqn.ref().relax();
    fvOptions.constrain(REqn.ref());
    solve(REqn);
    fvOptions.correct(R);

    this->boundNormalStress(R);

    k_ = 0.5*tr(R);

    correctNut();

    // Correct wall shear-stresses when applying wall-functions
    this->correctWallShearStress(R);
}


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
开发者ID:EricAlex,项目名称:OpenFOAM-dev,代码行数:31,代码来源:SSG.C


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