本文整理汇总了C++中UList::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ UList::empty方法的具体用法?C++ UList::empty怎么用?C++ UList::empty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UList
的用法示例。
在下文中一共展示了UList::empty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: boundBox
// Construct as the bounding box of the given pointField
Foam::treeBoundBox::treeBoundBox
(
const UList<point>& points,
const UList<label>& meshPoints
)
:
boundBox()
{
if (points.empty() || meshPoints.empty())
{
WarningIn
(
"treeBoundBox::treeBoundBox"
"(const UList<point>&, const UList<label>&)"
) << "cannot find bounding box for zero-sized pointField"
<< "returning zero" << endl;
return;
}
min() = points[meshPoints[0]];
max() = points[meshPoints[0]];
for (label i = 1; i < meshPoints.size(); i++)
{
min() = ::Foam::min(min(), points[meshPoints[i]]);
max() = ::Foam::max(max(), points[meshPoints[i]]);
}
}
示例2: point
void Foam::boundBox::calculate(const UList<point>& points, const bool doReduce)
{
if (points.empty())
{
min_ = Zero;
max_ = Zero;
if (doReduce && Pstream::parRun())
{
// Use values that get overwritten by reduce minOp, maxOp below
min_ = point(VGREAT, VGREAT, VGREAT);
max_ = point(-VGREAT, -VGREAT, -VGREAT);
}
}
else
{
min_ = points[0];
max_ = points[0];
for (label i = 1; i < points.size(); i++)
{
min_ = ::Foam::min(min_, points[i]);
max_ = ::Foam::max(max_, points[i]);
}
}
// Reduce parallel information
if (doReduce)
{
reduce(min_, minOp<point>());
reduce(max_, maxOp<point>());
}
}
示例3: sum
Foam::label Foam::mergePoints
(
const UList<Type>& points,
const scalar mergeTol,
const bool verbose,
labelList& pointMap,
const Type& origin
)
{
Type compareOrigin = origin;
if (origin == Type::max)
{
if (points.size())
{
compareOrigin = sum(points)/points.size();
}
}
// Create a old to new point mapping array
pointMap.setSize(points.size());
pointMap = -1;
if (points.empty())
{
return points.size();
}
// We're comparing distance squared to origin first.
// Say if starting from two close points:
// x, y, z
// x+mergeTol, y+mergeTol, z+mergeTol
// Then the magSqr of both will be
// x^2+y^2+z^2
// x^2+y^2+z^2 + 2*mergeTol*(x+z+y) + mergeTol^2*...
// so the difference will be 2*mergeTol*(x+y+z)
const scalar mergeTolSqr = Foam::sqr(scalar(mergeTol));
// Sort points by magSqr
const Field<Type> d(points - compareOrigin);
List<scalar> magSqrD(d.size());
forAll(d, pointI)
{
magSqrD[pointI] = magSqr(d[pointI]);
}
示例4: boundBox
Foam::treeBoundBox::treeBoundBox
(
const UList<point>& points,
const FixedList<label, Size>& indices
)
:
boundBox(points, indices, false)
{
// points may be empty, but a FixedList is never empty
if (points.empty())
{
WarningInFunction
<< "cannot find bounding box for zero-sized pointField, "
<< "returning zero" << endl;
return;
}
}