1+ #include < DelaunayRipsPersistenceDiagram.h>
2+
3+ using namespace ttk ::rpd;
4+
5+ ttk::DelaunayRipsPersistenceDiagram::DelaunayRipsPersistenceDiagram () {
6+ // inherited from Debug: prefix will be printed at the beginning of every msg
7+ this ->setDebugMsgPrefix (" DelaunayRipsPD" );
8+ }
9+
10+ int ttk::DelaunayRipsPersistenceDiagram::execute (
11+ const PointCloud &points, MultidimensionalDiagram &ph) const {
12+
13+ #ifdef TTK_ENABLE_CGAL
14+ const unsigned dim = points[0 ].size ();
15+ if (points.size () <= dim) {
16+ printErr (" Not enough points" );
17+ return 1 ;
18+ }
19+ if (dim == 2 ) {
20+ FastRipsPersistenceDiagram2 FRPD (points);
21+ FRPD.setDebugLevel (debugLevel_);
22+ FRPD.computeDelaunayRips0And1Persistence (ph);
23+ } else if (dim == 3 ) {
24+ #ifndef CGAL_LINKED_WITH_TBB
25+ if (getThreadNumber () > 1 ) {
26+ printWrn (" TTK was not compiled with TBB:" );
27+ printWrn (" sequential Delaunay triangulation only" );
28+ }
29+ #endif
30+ gph::runDelaunayRipsPersistenceDiagram3 (points, ph, getThreadNumber ());
31+ ph[0 ].emplace_back (
32+ FiltratedSimplex{{-1 }, 0 .}, FiltratedSimplex{{-1 }, inf}); // infinite pair
33+ } else {
34+ if (dim > TTK_DELAUNAY_MAX_COMPILED_DIMENSION)
35+ printWrn (" High dimension: " + std::to_string (dim) + " >"
36+ + std::to_string (TTK_DELAUNAY_MAX_COMPILED_DIMENSION));
37+ gph::tryDimensions (points, ph, getThreadNumber ());
38+ ph[0 ].emplace_back (
39+ FiltratedSimplex{{-1 }, 0 .}, FiltratedSimplex{{-1 }, inf}); // infinite pair
40+ }
41+ return 0 ;
42+ #else
43+ TTK_FORCE_USE (points);
44+ TTK_FORCE_USE (ph);
45+ printErr (" TTK was not compiled with CGAL:" );
46+ printErr (" this filter is not available." );
47+ return 1 ;
48+ #endif
49+ }
50+
51+ int ttk::DelaunayRipsPersistenceDiagram::execute (
52+ const PointCloud &points,
53+ MultidimensionalDiagram &ph,
54+ std::vector<Generator1> &generators1,
55+ std::vector<Generator2> &generators2) const {
56+
57+ #ifdef TTK_ENABLE_CGAL
58+ const unsigned dim = points[0 ].size ();
59+ if (dim > 3 ) {
60+ printErr (" Input dimension too large: " + std::to_string (dim) + " >3" );
61+ return 1 ;
62+ }
63+ if (points.size () <= dim) {
64+ printErr (" Not enough points" );
65+ return 1 ;
66+ }
67+ if (dim == 2 ) {
68+ FastRipsPersistenceDiagram2 FRPD (points);
69+ FRPD.setDebugLevel (debugLevel_);
70+ FRPD.computeDelaunayRips0And1Persistence (ph);
71+ FRPD.exportRips1Generators (generators1);
72+ } else if (dim == 3 ) {
73+ #ifndef CGAL_LINKED_WITH_TBB
74+ if (getThreadNumber () > 1 ) {
75+ printWrn (" TTK was not compiled with TBB:" );
76+ printWrn (" sequential Delaunay triangulation only" );
77+ }
78+ #endif
79+ gph::runDelaunayRipsPersistenceDiagram3 (
80+ points, ph, generators1, generators2, getThreadNumber ());
81+ ph[0 ].emplace_back (
82+ FiltratedSimplex{{-1 }, 0 .}, FiltratedSimplex{{-1 }, inf}); // infinite pair
83+ }
84+ return 0 ;
85+ #else
86+ TTK_FORCE_USE (points);
87+ TTK_FORCE_USE (ph);
88+ TTK_FORCE_USE (generators1);
89+ TTK_FORCE_USE (generators2);
90+ printErr (" TTK was not compiled with CGAL:" );
91+ printErr (" this filter is not available." );
92+ return 1 ;
93+ #endif
94+ }
0 commit comments