23#ifndef TTK_ENABLE_KAMIKAZE
45 std::vector<SegmInfo> segmentation_;
47#ifdef TTK_ENABLE_FTR_VERT_STATS
48 std::vector<idVertex> nbTouch_;
49 std::vector<idSuperArc> nbArcActif_;
64 leaves_ = std::move(other.leaves_);
65 nodes_ = std::move(other.nodes_);
66 arcs_ = std::move(other.arcs_);
67 segmentation_ = std::move(other.segmentation_);
68 valDown_ = std::move(other.valDown_);
69 valUp_ = std::move(other.valUp_);
70#ifdef TTK_ENABLE_FTR_VERT_STATS
71 nbTouch_ = std::move(other.nbTouch_);
72 nbArcActif_ = std::move(other.nbArcActif_);
73 avoided_ = std::move(other.avoided_);
94 for(
const auto &arc : arcs_) {
102 return leaves_.
size();
106 return std::get<0>(leaves_[
id]);
110 return std::get<1>(leaves_[
id]);
130 return segmentation_[v].corArc != nullSuperArc
131 || segmentation_[v].corNode != nullNode;
136 if(segmentation_[v].corArc == nullSuperArc) {
137 segmentation_[v].corArc = id;
140 if(segmentation_[v].corNode == nullNode) {
141 segmentation_[v].corNode = id;
146#ifdef TTK_ENABLE_FTR_VERT_STATS
148#ifdef TTK_ENABLE_OPENMP
149#pragma omp atomic update
159#ifdef TTK_ENABLE_OPENMP
160#pragma omp atomic write
166 return nbArcActif_[v];
170#ifdef TTK_ENABLE_OPENMP
171#pragma omp atomic update
181 auto gt1 = [](uint i) {
return i > 1; };
182 return std::count_if(nbTouch_.cbegin(), nbTouch_.cend(), gt1);
187 segmentation_[v].corArc = id;
191 return {segmentation_[v].corNode, segmentation_[v].corArc};
195 return segmentation_[v].corArc != nullSuperArc;
199 return segmentation_[v].corArc == id;
203 return segmentation_[v].corNode != nullNode;
207 return segmentation_[v].corNode != id;
211 return segmentation_[v].corNode;
215 return segmentation_[v].corArc;
262 nodes_[newNode].setVerterIdentifier(v);
263 visit(v, newNode,
false);
264 return {newNode,
true};
269 arcs_[newArc].setDownNodeId(downId);
271 arcs_[newArc].setUfProp(p->getId());
273#ifndef TTK_ENABLE_KAMIKAZE
275 std::cout <<
"NULL PROP IN ARC " <<
static_cast<unsigned>(newArc)
283 arcs_[arc].setUpNodeId(upId);
292 arcs_[newArc].hide();
293 arcs_[newArc].setUfProp(lp->
getId());
302 template <
typename ScalarType>
304 const bool parallel =
false) {
306 = [&](std::tuple<idVertex, bool> a, std::tuple<idVertex, bool> b) {
307 return s->
isLower(std::get<0>(a), std::get<0>(b));
313 std::sort(leaves_.begin(), leaves_.
end(), compare_fun);
318 std::shuffle(leaves_.begin(), leaves_.
end(), std::random_device());
324 template <
typename ScalarType>
328 template <
typename ScalarType>
332 template <
typename ScalarType>
338 std::string
print(
const int verbosity)
const;
352 void alloc()
override;
354 void init()
override;
362 template <
typename ScalarType>
#define TTK_PSORT(NTHREADS,...)
Parallel sort macro.
TTK processing package that manage a parallel version of vector Same as in FTM: Common ?
void emplace_back(const type &elmt)
TTK FTRGraph graph skeleton.
std::tuple< idNode, bool > getOrCreateNode(const idVertex v)
idSuperArc openArc(const idNode downId, Propagation *p=nullptr)
bool isLeafFromMin(const idNode id) const
const valence & valUp(const idVertex v) const
idNode makeNode(const idVertex v)
std::string printNode(const idNode nodeId) const
void closeArc(const idSuperArc arc, const idNode upId)
bool isArc(const idVertex v, const idSuperArc id) const
idNode getNumberOfLeaves() const
bool isNode(const idVertex v, const idNode id) const
Graph & operator=(Graph &&other) noexcept
const valence & valDown(const idVertex v) const
idNode getNumberOfNodes() const
void arcs2nodes(const Scalars< ScalarType > *const s)
void buildArcSegmentation(const Scalars< ScalarType > *const s)
SuperArc & getArc(const idSuperArc id)
idSuperArc getNumberOfArcs() const
bool isArc(const idVertex v) const
void sortLeaves(const Scalars< ScalarType > *s, const bool parallel=false)
std::string printArc(const idSuperArc arcId) const
std::string printVisit() const
std::vector< valence > valUp_
void visit(const idVertex v, const idSegmentation id, bool isArc=true)
bool isNode(const idVertex v) const
Graph(Graph &&other) noexcept=default
valence & valDown(const idVertex v)
idSuperArc getArcId(const idVertex v) const
const SuperArc & getArc(const idSuperArc id) const
const Node & getNode(const idNode id) const
bool isVisited(const idVertex v) const
std::vector< valence > valDown_
idVertex getLeaf(const idNode id) const
Graph(const Graph &other)=delete
idSuperArc makeHiddenArc(Propagation *const lp)
Node & getNode(const idNode id)
void makeArc(const idNode downId, const idNode upId)
idNode getNodeId(const idVertex v) const
void addLeaf(const idVertex v, bool isMax)
void setArc(const idVertex v, const idSegmentation id)
void mergeArcs(const Scalars< ScalarType > *const s)
Graph & operator=(Graph &other)=delete
const Node & getDownNode(const idSuperArc a) const
std::tuple< idNode, idSuperArc > visit(const idVertex v) const
valence & valUp(const idVertex v)
std::string print(const int verbosity) const
idSuperArc getNumberOfVisibleArcs() const
TTK FTRGraph node of the Graph.
TTK fTRGraph propagation management with Fibonacci heaps.
bool isLower(const idVertex a, const idVertex b) const
long int idSegmentation
retains history
long unsigned int idSuperArc
SuperArc index in vect_superArcs_.
SimplexId valence
for vertex up/down valence
SimplexId idVertex
Vertex index in scalars_.
unsigned int idNode
Node index in vect_nodes_.