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


C++ shared_ptr::Barrier方法代码示例

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


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

示例1: globalRadius

/*!
 * @param point Vector of real containing the coordinates of the point within the radius
 * @param radius Radius used to find point.
 * @param appliedCurrentVector    Vector epetra containing the applied current.
 * @param valueAppliedCurrent    Value of the current to apply at the specified point.
 * @param fullMesh   Pointer to the mesh.
 * @param Comm   EpetraMpi comunicator.
 */
template<typename Mesh> inline void appliedCurrentClosestPointWithinRadius (std::vector<Real>& point, Real Radius, boost::shared_ptr<VectorEpetra> appliedCurrentVector, Real valueAppliedCurrent,  boost::shared_ptr< Mesh > fullMesh, boost::shared_ptr<Epetra_Comm> Comm )
{
    Int n = appliedCurrentVector -> epetraVector().MyLength();

    Int ids;
    for ( UInt i (0); i < n; i++)
    {
        int iGID = appliedCurrentVector -> blockMap().GID ( static_cast<EpetraInt_Type> (i) );
        Real px = fullMesh -> point ( iGID ).x();
        Real py = fullMesh -> point ( iGID ).y();
        Real pz = fullMesh -> point ( iGID ).z();

        Real distance = std::sqrt ( ( point[0] - px) * (point[0] - px)
                                    + ( point[1] - py) * (point[1] - py)
                                    + ( point[2] - pz) * (point[2] - pz) );
        if (distance <= Radius)
        {
            ids = iGID;
            Radius = distance;
        }


    }
    Real localRadius = Radius;
    Real globalRadius (0);
    Comm->Barrier();
    Comm->MinAll (&localRadius, &globalRadius, 1);

    if (globalRadius == localRadius)
    {
        appliedCurrentVector-> operator [] ( ids ) = valueAppliedCurrent;
    }

}
开发者ID:Danniel-UCAS,项目名称:lifev,代码行数:42,代码来源:ElectrophysiologyUtility.hpp


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