10 const std::vector<SimplexId> &filtOrder,
11 const std::vector<Simplex> &partners)
const {
13 this->addCellBoundary(c, boundary);
17 const auto tau{*std::max_element(
20 return filtOrder[this->getCellId(c.dim_ - 1, a)]
21 < filtOrder[this->getCellId(c.dim_ - 1, b)];
23 const auto &partnerTau{partners[this->getCellId(c.dim_ - 1, tau)]};
24 if(partnerTau.dim_ == -1 || partnerTau.id_ == -1) {
27 this->addCellBoundary(partnerTau, boundary);
33int ttk::PersistentSimplexPairs::pairCells(
34 std::vector<PersistencePair> &pairs,
35 std::array<std::vector<bool>, 3> &boundaries,
36 const std::vector<Simplex> &filtration,
37 const std::vector<SimplexId> &filtOrder)
const {
40 std::vector<SimplexId> visitedIds{};
42 std::vector<Simplex> partners(filtration.size());
48 for(
size_t i = 0; i < filtration.size(); ++i) {
50 const auto &c{filtration[i]};
58 VisitedMask vm{boundaries[c.dim_ - 1], visitedIds};
60 const auto partner = this->eliminateBoundaries(c, vm, filtOrder, partners);
63 filtration[filtOrder[this->getCellId(c.dim_ - 1, partner)]]};
64 partners[c.cellId_] = pc;
65 partners[pc.cellId_] = c;
68 if(c.vertsOrder_[0] != pc.vertsOrder_[0]) {
69 pairs.emplace_back(partner, c.id_, c.dim_ - 1);
73 if(filtration.size() > 10 && i % (filtration.size() / 10) == 0) {
76 std::round(10 * i /
static_cast<float>(filtration.size())) / 10.0f,
81 const auto nRegPairs{pairs.size()};
83 this->
printMsg(
"Computed " + std::to_string(nRegPairs) +
" regular pair"
84 + (nRegPairs > 1 ?
"s" :
""),
85 1.0, tm.getElapsedTime(), 1);
88 for(
SimplexId i = 0; i < this->nVerts_; ++i) {
89 if(partners[i].id_ == -1) {
90 pairs.emplace_back(i, -1, 0);
93 for(
SimplexId i = 0; i < this->nEdges_; ++i) {
94 if(partners[i + this->nVerts_].id_ == -1) {
95 pairs.emplace_back(i, -1, 1);
98 for(
SimplexId i = 0; i < this->nTri_; ++i) {
99 if(partners[i + this->nVerts_ + this->nEdges_].id_ == -1) {
100 pairs.emplace_back(i, -1, 2);
103 for(
SimplexId i = 0; i < this->nTetra_; ++i) {
104 if(partners[i + this->nVerts_ + this->nEdges_ + this->nTri_].id_ == -1) {
105 pairs.emplace_back(i, -1, 3);
109 const auto nInfPairs{pairs.size() - nRegPairs};
111 this->
printMsg(
"Detected " + std::to_string(nInfPairs) +
" infinite pair"
112 + (nInfPairs > 1 ?
"s" :
""));
void setDebugMsgPrefix(const std::string &prefix)
int SimplexId
Identifier type for simplices of any dimension.
Auto-cleaning re-usable graph propagations data structure.
std::vector< SimplexId > & visitedIds_
printMsg(debug::output::BOLD+" | | | | | . \\ | | (__| | / __/| |_| / __/|__ _|"+debug::output::ENDCOLOR, debug::Priority::PERFORMANCE, debug::LineMode::NEW, stream)