本文整理汇总了C++中Visitor::init方法的典型用法代码示例。如果您正苦于以下问题:C++ Visitor::init方法的具体用法?C++ Visitor::init怎么用?C++ Visitor::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Visitor
的用法示例。
在下文中一共展示了Visitor::init方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: outmap
void
StaticPersistence<D, CT, OT, E, Cmp>::
pair_simplices(iterator bg, iterator end, bool store_negative, const Visitor& visitor)
{
#if LOGGING
typename ContainerTraits::OutputMap outmap(order_);
#endif
// FIXME: need sane output for logging
rLog(rlPersistence, "Entered: pair_simplices");
for (iterator j = bg; j != end; ++j)
{
visitor.init(j);
rLog(rlPersistence, "Simplex %s", outmap(j).c_str());
Cycle z;
swap_cycle(j, z);
rLog(rlPersistence, " has boundary: %s", z.tostring(outmap).c_str());
// Sparsify the cycle by removing the negative elements
if (!store_negative)
{
typename OrderElement::Cycle zz;
BOOST_FOREACH(OrderIndex i, z)
if (i->sign()) // positive
zz.push_back(i);
z.swap(zz);
}
// --------------------------
CountNum(cPersistencePairBoundaries, z.size());
#ifdef COUNTERS
Count(cPersistencePair);
#endif // COUNTERS
while(!z.empty())
{
OrderIndex i = z.top(ocmp_); // take the youngest element with respect to the OrderComparison
rLog(rlPersistence, " %s: %s", outmap(i).c_str(), outmap(i->pair).c_str());
// TODO: is this even a meaningful assert?
AssertMsg(!ocmp_(i, index(j)),
"Simplices in the cycle must precede current simplex: (%s in cycle of %s)",
outmap(i).c_str(), outmap(j).c_str());
// i is not paired, so we pair j with i
if (iterator_to(i->pair) == iterator_to(i))
{
rLog(rlPersistence, " Pairing %s and %s with cycle %s",
outmap(i).c_str(), outmap(j).c_str(),
z.tostring(outmap).c_str());
set_pair(i, j);
swap_cycle(j, z);
set_pair(j, i);
CountNum(cPersistencePairCycleLength, j->cycle.size());
CountBy (cPersistencePairCycleLength, j->cycle.size());
break;
}
// update element
z.add(i->pair->cycle, ocmp_);
visitor.update(j, iterator_to(i));
rLog(rlPersistence, " new cycle: %s", z.tostring(outmap).c_str());
}
// if z was empty, so is (already) j->cycle, so nothing to do
visitor.finished(j);
rLog(rlPersistence, "Finished with %s: %s",
outmap(j).c_str(), outmap(j->pair).c_str());
}