Skip to content

Commit 6494d2e

Browse files
committed
infinite PH0 pair
1 parent 8fbd603 commit 6494d2e

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

core/base/delaunayRipsPersistenceDiagram/DelaunayRipsPersistenceDiagram.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ int ttk::DelaunayRipsPersistenceDiagram::execute(
3737
gph::tryDimensions(points, ph, getThreadNumber());
3838
ph[0].emplace_back(
3939
FiltratedSimplex{{-1}, 0.}, FiltratedSimplex{{-1}, inf}); // infinite pair
40-
for(auto &diag : ph) {
41-
for(auto &[b, d] : diag) {
42-
b.first = {-1};
43-
d.first = {-1};
44-
}
45-
}
4640
}
4741
return 0;
4842
#else

core/base/delaunayRipsPersistenceDiagram/geoPHd.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ namespace ttk::gph {
249249
}
250250
for(FiltratedDSimplex<DYN_DIM> const &e : MSA)
251251
ph[0].emplace_back(
252-
FiltratedSimplex{{}, 0.}, FiltratedSimplex{e.s, sqrt(e.d)});
252+
FiltratedSimplex{{-1}, 0.}, FiltratedSimplex{e.s, sqrt(e.d)});
253253
}
254254

255255
template <unsigned DIM>
@@ -265,7 +265,7 @@ namespace ttk::gph {
265265
recurse(ph, nextMSA);
266266
} else if constexpr(D == 1) { // this is the 0-dimensional homology
267267
for(FiltratedDSimplex<1> const &e : MSA)
268-
ph[0].emplace_back(FiltratedSimplex{{}, 0.},
268+
ph[0].emplace_back(FiltratedSimplex{{-1}, 0.},
269269
FiltratedSimplex{{e.s[0], e.s[1]}, sqrt(e.d)});
270270
}
271271
}

core/vtk/ttkRipsPersistenceDiagram/ttkRipsPersistenceDiagram.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,17 @@ void DiagramToVTU(vtkUnstructuredGrid *vtu,
2020
int n_pairs = 0;
2121
for(auto const &diagram_d : diagram)
2222
n_pairs += diagram_d.size();
23-
if(SimplexMaximumDiameter == ttk::rpd::inf)
24-
n_pairs--;
23+
24+
if(SimplexMaximumDiameter == ttk::rpd::inf) {
25+
double maxFiniteValue = 0.;
26+
for(auto const &diag : diagram) {
27+
for(auto const &[b, d] : diag) {
28+
if(d.second < ttk::rpd::inf)
29+
maxFiniteValue = std::max(maxFiniteValue, d.second);
30+
}
31+
}
32+
SimplexMaximumDiameter = 1.5 * maxFiniteValue;
33+
}
2534

2635
// point data arrays
2736
vtkNew<ttkSimplexIdTypeArray> vertsId{};
@@ -74,10 +83,6 @@ void DiagramToVTU(vtkUnstructuredGrid *vtu,
7483
double birth_max = 0.;
7584
for(unsigned d = 0; d < diagram.size(); ++d) {
7685
for(auto const &pair : diagram[d]) {
77-
if(d == 0 && pair.second.second == ttk::rpd::inf
78-
&& SimplexMaximumDiameter == ttk::rpd::inf)
79-
continue;
80-
8186
const unsigned i0 = 2 * i, i1 = 2 * i + 1;
8287
pairsId->SetTuple1(i, i);
8388
pairsDim->SetTuple1(i, d);

0 commit comments

Comments
 (0)