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


C++ Labels::count方法代码示例

本文整理汇总了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();
}
开发者ID:AppliedMathematicsANU,项目名称:diamorse,代码行数:34,代码来源:testTraversal.C

示例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();
}
开发者ID:AppliedMathematicsANU,项目名称:diamorse,代码行数:34,代码来源:testTraversal.C

示例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();
}
开发者ID:AppliedMathematicsANU,项目名称:diamorse,代码行数:38,代码来源:testTraversal.C


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