TTK
Loading...
Searching...
No Matches
TopologicalSimplification.h
Go to the documentation of this file.
1
91
92#pragma once
93
94// base code includes
95#include <Debug.h>
98#include <Triangulation.h>
99
100#include <cmath>
101#include <set>
102#include <tuple>
103#include <type_traits>
104
105namespace ttk {
106
107 class TopologicalSimplification : virtual public Debug {
108 public:
110
111 enum class BACKEND { LEGACY, LTS };
112 /*
113 * Either execute this file "legacy" algorithm, or the
114 * lts algorithm. The choice depends on the value of the variable backend_.
115 * Default is lts (localized).
116 */
117 template <typename dataType, typename triangulationType>
118 int execute(const dataType *const inputScalars,
119 dataType *const outputScalars,
120 const SimplexId *const identifiers,
121 const SimplexId *const inputOffsets,
122 SimplexId *const offsets,
123 const SimplexId constraintNumber,
124 const bool addPerturbation,
125 const triangulationType &triangulation);
126
127 inline void setBackend(const BACKEND arg) {
128 backend_ = arg;
129 }
130
132 switch(backend_) {
133 case BACKEND::LEGACY:
137 break;
138
139 case BACKEND::LTS:
143 break;
144
145 default:
146 this->printErr(
147 "Error, the backend for topological simplification is invalid");
148 return -1;
149 }
150 return 0;
151 }
152
153 protected:
157 };
158} // namespace ttk
159
160template <typename dataType, typename triangulationType>
162 const dataType *const inputScalars,
163 dataType *const outputScalars,
164 const SimplexId *const identifiers,
165 const SimplexId *const inputOffsets,
166 SimplexId *const offsets,
167 const SimplexId constraintNumber,
168 const bool addPerturbation,
169 const triangulationType &triangulation) {
170 switch(backend_) {
171 case BACKEND::LTS:
172 return ltsObject_
173 .removeUnauthorizedExtrema<dataType, SimplexId, triangulationType>(
174 outputScalars, offsets, &triangulation, identifiers, constraintNumber,
175 addPerturbation);
176 case BACKEND::LEGACY:
177 return legacyObject_.execute(inputScalars, outputScalars, identifiers,
178 inputOffsets, offsets, constraintNumber,
179 triangulation);
180
181 default:
182 this->printErr(
183 "Error, the backend for topological simplification is invalid");
184 return -1;
185 }
186}
AbstractTriangulation is an interface class that defines an interface for efficient traversal methods...
int threadNumber_
Definition: BaseClass.h:95
virtual int setThreadNumber(const int threadNumber)
Definition: BaseClass.h:80
Minimalist debugging class.
Definition: Debug.h:88
int debugLevel_
Definition: Debug.h:379
virtual int setDebugLevel(const int &debugLevel)
Definition: Debug.cpp:147
int printErr(const std::string &msg, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cerr) const
Definition: Debug.h:149
TTK processing package for the topological simplification of scalar data.
int preconditionTriangulation(AbstractTriangulation *triangulation)
int execute(const dataType *const inputScalars, dataType *const outputScalars, const SimplexId *const identifiers, const SimplexId *const inputOffsets, SimplexId *const offsets, const SimplexId constraintNumber, const triangulationType &triangulation) const
TTK processing package for the topological simplification of scalar data.
int execute(const dataType *const inputScalars, dataType *const outputScalars, const SimplexId *const identifiers, const SimplexId *const inputOffsets, SimplexId *const offsets, const SimplexId constraintNumber, const bool addPerturbation, const triangulationType &triangulation)
LegacyTopologicalSimplification legacyObject_
int preconditionTriangulation(AbstractTriangulation *triangulation)
lts::LocalizedTopologicalSimplification ltsObject_
int preconditionTriangulation(ttk::AbstractTriangulation *triangulation) const
int removeUnauthorizedExtrema(DT *scalars, IT *order, const TT *triangulation, const IT *authorizedExtremaIndices, const IT &nAuthorizedExtremaIndices, const bool &computePerturbation) const
The Topology ToolKit.
int SimplexId
Identifier type for simplices of any dimension.
Definition: DataTypes.h:22