本文整理汇总了C++中Labels::count方法的典型用法代码示例。如果您正苦于以下问题:C++ Labels::count方法的具体用法?C++ Labels::count怎么用?C++ Labels::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Labels
的用法示例。
在下文中一共展示了Labels::count方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: criticalCellsAreSelfLabelled
Result criticalCellsAreSelfLabelled(VolumeData const& candidate)
{
CubicalComplex const& complex = candidate.complex;
Field const& field = candidate.field;
for (int up = 0; up <= 1; ++up)
{
Labels const labels = markCells(candidate, up);
for (Cell v = 0; v < complex.cellIdLimit(); ++v)
{
if (complex.isCell(v) and field.isCritical(v))
{
if (labels.count(v) == 0 or labels.at(v).count(v) < 1)
{
std::stringstream msg;
msg << "Critical cell " << complex.cellPosition(v)
<< " is not in its own " << (up ? "unstable" : "stable")
<< " set";
return failure(msg.str());
}
else if (labels.at(v).size() > 1)
{
std::stringstream msg;
msg << "Critical cell " << complex.cellPosition(v)
<< " is in other " << (up ? "unstable" : "stable")
<< " sets";
return failure(msg.str());
}
}
}
}
return success();
}
示例2: traversalsAreConsistent
Result traversalsAreConsistent(VolumeData const& candidate)
{
CubicalComplex const& complex = candidate.complex;
Field const& field = candidate.field;
for (int up = 0; up <= 1; ++up)
{
Labels const labels = markCells(candidate, up);
Field::Vectors V = up ? field.coV() : field.V();
Facets I(complex.xdim(), complex.ydim(), complex.zdim(), up);
for (Cell v = 0; v < complex.cellIdLimit(); ++v)
{
if (not complex.isCell(v))
continue;
if (labels.count(v) > 0)
{
int const n = I.count(v);
for (int i = 0; i < n; ++i) {
Cell const b = I(v, i);
if (not V.defined(b) or V(b) == b)
continue;
Result r = labelsPropagate(labels, v, V(b), up, complex);
if (!r)
return r;
}
}
}
}
return success();
}
示例3: checkLabelCounts
Result checkLabelCounts(
VolumeData const& candidate,
int const dim,
bool const upstream,
int const min = 1,
int const max = 1)
{
CubicalComplex const& complex = candidate.complex;
Labels const labels = markCells(candidate, upstream);
for (Cell v = 0; v < complex.cellIdLimit(); ++v)
{
if (complex.isCell(v) and complex.cellDimension(v) == dim)
{
int const count = labels.count(v) == 0 ? 0 : labels.at(v).size();
if (count < min)
{
std::stringstream msg;
msg << "Cell " << complex.cellPosition(v);
if (min == 1)
msg << " has no label";
else
msg << " has too few labels (" << count << ")";
return failure(msg.str());
}
else if (count > max)
{
std::stringstream msg;
msg << "Cell " << complex.cellPosition(v)
<< " has too many labels (" << count << ")";
return failure(msg.str());
}
}
}
return success();
}