本文整理汇总了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;
}
}