TTK
Loading...
Searching...
No Matches
DelaunayRipsPersistenceDiagram.cpp
Go to the documentation of this file.
2
3using namespace ttk::rpd;
4
6 // inherited from Debug: prefix will be printed at the beginning of every msg
7 this->setDebugMsgPrefix("DelaunayRipsPD");
8}
9
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
52 const PointCloud &points,
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}
#define TTK_FORCE_USE(x)
Force the compiler to use the function/method parameter.
Definition BaseClass.h:57
int getThreadNumber() const
Definition BaseClass.h:76
int debugLevel_
Definition Debug.h:379
int printWrn(const std::string &msg, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cerr) const
Definition Debug.h:159
void setDebugMsgPrefix(const std::string &prefix)
Definition Debug.h:364
int printErr(const std::string &msg, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cerr) const
Definition Debug.h:149
int execute(const rpd::PointCloud &points, rpd::MultidimensionalDiagram &ph) const
Main entry point (without generators)
TTK base class that computes the persistence diagram of a Rips complex of a planar point cloud using ...
constexpr value_t inf
std::vector< std::vector< value_t > > PointCloud
std::vector< Diagram > MultidimensionalDiagram
std::pair< Simplex, value_t > FiltratedSimplex