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


C++ Boundary::at方法代码示例

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


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

示例1: checkMorseBoundariesUpstreamVersusDownstream

Result checkMorseBoundariesUpstreamVersusDownstream(VolumeData const& candidate)
{
    CubicalComplex const& complex = candidate.complex;
    Field const& field = candidate.field;

    Field::Vectors const& V = field.V();
    Field::Vectors const& coV = field.coV();

    Facets I(complex.xdim(), complex.ydim(), complex.zdim(), false);
    Facets coI(complex.xdim(), complex.ydim(), complex.zdim(), true);

    std::map<Cell, Boundary> M1;
    std::map<Cell, Boundary> M2;

    for (Cell c = 0; c < complex.cellIdLimit(); ++c)
    {
        if (complex.isCell(c) and field.isCritical(c))
        {
            Boundary B = morseBoundary(c, V, I);
            Boundary coB = morseBoundary(c, coV, coI);

            M1[c] = B;

            for (size_t i = 0; i < coB.size(); ++i)
            {
                Cell const d = coB.at(i).first;
                int const n = coB.at(i).second;
                M2[d].push_back(std::pair<Cell, int>(c, n));
            }
        }
    }

    for (Cell c = 0; c < complex.cellIdLimit(); ++c)
    {
        if (complex.isCell(c) and field.isCritical(c))
        {
            if (M1[c] != M2[c]) {
                std::stringstream msg;
                msg << "Mismatching Morse boundaries for cell "
                    << complex.cellPosition(c)
                    << ": " << M1[c] << " vs " << M2[c];
                return failure(msg.str());
            }
        }
    }
    return success();
}
开发者ID:AppliedMathematicsANU,项目名称:diamorse,代码行数:47,代码来源:testTraversal.C

示例2: simpleChainComplex

SimpleComplex simpleChainComplex(
    CubicalComplex const& complex,
    Scalars const& scalars,
    std::map<Cell, Boundary> const& chains,
    std::vector<Cell> const& sources)
{
    size_t const n = sources.size();
    Vertices const vertices(complex.xdim(), complex.ydim(), complex.zdim());

    std::map<Cell, size_t> index;
    for (size_t i = 0; i < n; ++i)
        index[sources.at(i)] = i;

    std::vector<unsigned int> dims;
    std::vector<float> values;
    std::vector<std::vector<Cell> > faceLists;

    for (size_t i = 0; i < n; ++i)
    {
        Cell const v = sources.at(i);
        dims.push_back(complex.cellDimension(v));
        values.push_back(cellValue(v, scalars, vertices));

        Boundary const flin = chains.at(v);
        std::vector<Cell> flout;
        for (size_t j = 0; j < flin.size(); ++j)
        {
            std::pair<Cell, int> p = flin.at(j);
            for (int k = 0; k < p.second; ++k)
                flout.push_back(index.at(p.first));
        }

        faceLists.push_back(flout);
    }

    return SimpleComplex(dims, values, faceLists);
}
开发者ID:AppliedMathematicsANU,项目名称:diamorse,代码行数:37,代码来源:PersistencePairs.C


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