43#ifdef TTK_ENABLE_OPENMP
44 ParallelGuard
const pg{params_.threadNumber};
46#ifdef TTK_ENABLE_OMP_PRIORITY
48 this->printWrn(
"OpenMP max priority is lower than 5");
59 "alloc time: ", 1.0, timeAlloc.
getElapsedTime(), this->threadNumber_);
64 "init time: ", 1.0, timeInit.
getElapsedTime(), this->threadNumber_);
71 std::cout <<
"Profiling enabled ..." << std::endl;
72 ProfilerStart(
"ftr.log");
77 "sort time: ", 1.0, timeSort.
getElapsedTime(), this->threadNumber_);
79 Timer timePreSortSimplices;
81 return scalars_.isLower(a, b);
84 return scalars_.isLower(a, b);
86 this->
printMsg(
"simplices sort time: ", 1.0,
94#ifdef TTK_ENABLE_OPENMP
95#pragma omp parallel num_threads(params_.threadNumber)
98#ifdef TTK_ENABLE_OPENMP
99#pragma omp single nowait
102 Timer timeCritSearch;
104 this->
printMsg(
"leaf search time ", 1.0,
110 this->
printMsg(
"sweepFrowSeeds time: ", 1.0,
115 "build time: ", 1.0, timeBuild.
getElapsedTime(), this->threadNumber_);
129 graph_.mergeArcs<ScalarType>(&scalars_);
130 graph_.arcs2nodes<ScalarType>(&scalars_);
132 this->threadNumber_);
142 "*TOTAL* time: ", 1.0, finTime.
getElapsedTime(), this->threadNumber_);
150 if(params_.samplingLvl) {
151 graph_.buildArcSegmentation<ScalarType>(&scalars_);
161 std::vector<std::vector<std::string>>{
162 {
"#Visible arcs", std::to_string(graph_.getNumberOfVisibleArcs())},
163 {
"#Arcs", std::to_string(graph_.getNumberOfArcs())},
167#ifdef TTK_ENABLE_FTR_TASK_STATS
168 std::cout <<
"propTimes_ :" << std::endl;
169 copy(propTimes_.crbegin(), propTimes_.crend(),
170 std::ostream_iterator<float>(std::cout,
" "));
171 std::cout << std::endl;
174#ifdef TTK_ENABLE_FTR_VERT_STATS
175 idVertex nbRevisit = graph_.getNbMultiTouch();
176 std::cout <<
"revisit: " << nbRevisit <<
" / "
177 << mesh_.getNumberOfVertices();
179 << ((float)nbRevisit / mesh_.getNumberOfVertices()) * 100
181 std::cout <<
"avoided: " << graph_.getNbAvoided() << std::endl;
189 const bool addMin =
true;
190 const bool addMax = !params_.singleSweep;
194 TaskChunk leafChunkParams(scalars_.getSize());
198 for(
idPropagation leafChunkId = 0; leafChunkId < std::get<1>(leafChunk);
200#ifdef TTK_ENABLE_OPENMP
201#pragma omp task firstprivate(leafChunkId)
207 leafChunkId, std::get<0>(leafChunk), scalars_.getSize());
210 for(
idVertex v = lowerBound; v < upperBound; ++v) {
211 bool lBoundary =
false, uBoundary =
false;
212 std::vector<std::vector<ttk::SimplexId>> upperComponents;
213 std::vector<std::vector<ttk::SimplexId>> lowerComponents;
215 v, scalars_.getOffsets(), mesh_.getTriangulation(), lBoundary,
216 uBoundary, &upperComponents, &lowerComponents);
217 valences_.lower[v] = lowerComponents.size();
218 valences_.upper[v] = upperComponents.size();
220 if(addMin && valences_.lower[v] == 0) {
221 graph_.addLeaf(v,
true);
223 if(addMax && valences_.upper[v] == 0) {
224 graph_.addLeaf(v,
false);
229#ifdef TTK_ENABLE_OPENMP
232#ifdef TTK_ENABLE_FTR_TASK_STATS
234 nbProp_ = graph_.getNumberOfLeaves();
235 propTimes_.resize(nbProp_);
237 this->
printMsg(std::vector<std::vector<std::string>>{
238 {
"#Leaves", std::to_string(graph_.getNumberOfLeaves())}});
243 const idNode nbSeed = graph_.getNumberOfLeaves();
247 graph_.sortLeaves<ScalarType>(&scalars_);
249#ifdef TTK_ENABLE_FTR_TASK_STATS
250 sweepStart_.reStart();
252#ifdef TTK_ENABLE_OPENMP4
256 for(
idNode i = 0; i < nbSeed; i++) {
258 idVertex const l = (i % 2) ? i / 2 : nbSeed - 1 - i / 2;
262 const idVertex corLeaf = graph_.getLeaf(l);
263 const bool fromMin = graph_.isLeafFromMin(l);
264 Propagation *localPropagation = newPropagation(corLeaf, fromMin);
266 = graph_.openArc(graph_.makeNode(corLeaf), localPropagation);
269#ifdef TTK_ENABLE_OPENMP4
270#pragma omp task OPTIONAL_PRIORITY(PriorityLevel::Higher)
272 growthFromSeed(corLeaf, localPropagation, newArc);
286 scalars_.setSize(mesh_.getNumberOfVertices());
289 graph_.setNumberOfElmt(mesh_.getNumberOfVertices());
292 propagations_.setNumberOfElmt(mesh_.getNumberOfVertices());
293 propagations_.alloc();
295 dynGraphs_.up.setNumberOfElmt(mesh_.getNumberOfEdges());
296 dynGraphs_.up.alloc();
298 dynGraphs_.down.setNumberOfElmt(mesh_.getNumberOfEdges());
299 dynGraphs_.down.alloc();
301#ifndef TTK_DISABLE_FTR_LAZY
302 lazy_.setNumberOfElmt(mesh_.getNumberOfVertices() * 2);
306 valences_.lower.resize(mesh_.getNumberOfVertices());
307 valences_.upper.resize(mesh_.getNumberOfVertices());
int getLowerUpperComponents(const SimplexId vertexId, const SimplexId *const offsets, const triangulationType *triangulation, bool &isLowerOnBoundary, bool &isUpperOnBoundary, std::vector< std::vector< ttk::SimplexId > > *upperComponents, std::vector< std::vector< ttk::SimplexId > > *lowerComponents) const
printMsg(debug::output::BOLD+" | | | | | . \\ | | (__| | / __/| |_| / __/|__ _|"+debug::output::ENDCOLOR, debug::Priority::PERFORMANCE, debug::LineMode::NEW, stream)