TTK
Loading...
Searching...
No Matches
FTRSuperArc.h
Go to the documentation of this file.
1
12
13#pragma once
14
15// local includes
16#include "FTRAtomicUF.h"
17#include "FTRDataTypes.h"
18#include "FTRScalars.h"
19#include "FTRSegmentation.h"
20
21// c++ includes
22#ifndef TTK_ENABLE_KAMIKAZE
23#include <iostream>
24#endif
25
26namespace ttk {
27 namespace ftr {
28 class Node;
29
30 class SuperArc : virtual public Debug {
31 idNode upNodeId_{};
32 idNode downNodeId_{};
33 AtomicUF *ufProp_{};
34 bool visible_{true};
35 idVertex firstReg_{nullVertex}, lastReg_{nullVertex}, endV_{nullVertex};
36 idSuperArc merged_{nullSuperArc};
37 Segment segmentation_{};
38#ifndef NDEBUG
39 bool fromUp_{false};
40#endif
41
42 public:
43 SuperArc(const idNode down = nullNode, const idNode up = nullNode)
44 : upNodeId_{up}, downNodeId_{down} {
45 this->setDebugMsgPrefix("SuperNode");
46 }
47
49 // Caution. can be nullNode
50 return upNodeId_;
51 }
52
53 void setUpNodeId(const idNode id) {
54 upNodeId_ = id;
55 }
56
58#ifndef TTK_ENABLE_KAMIKAZE
59 if(downNodeId_ == nullNode) {
60 this->printErr("Arc have null down node");
61 }
62#endif
63 return downNodeId_;
64 }
65
66 void setDownNodeId(const idNode id) {
67 downNodeId_ = id;
68 }
69
71#ifndef TTK_ENABLE_KAMIKAZE
72 if(!ufProp_) {
73 this->printErr("Arc have null UF propagation");
74 }
75#endif
76 return ufProp_->find()->getPropagation();
77 }
78
79 void setUfProp(AtomicUF *const UFprop) {
80 ufProp_ = UFprop;
81 }
82
83 bool hide() {
84 bool const old = visible_;
85 visible_ = false;
86 return old;
87 }
88
89 bool isVisible() const {
90 return visible_;
91 }
92
93 // for regular vertices
94 void visit(const idVertex v) {
95 // firstV only set once
96 if(firstReg_ == nullVertex)
97 firstReg_ = v;
98
99 lastReg_ = v;
100 }
101
102 // for all vertices:
103 // used to close arc at the end if not close during construct
104 void setEnd(const idVertex v) {
105 // avoid an are being reclosed by a higher join
106 if(endV_ == nullVertex) {
107 endV_ = v;
108 }
109 }
110
111 idVertex getEnd() const {
112 return endV_;
113 }
114
115 bool isEmpty() const {
116 return firstReg_ == nullVertex;
117 }
118
120 return firstReg_;
121 }
122
124 return lastReg_;
125 }
126
127 void merge(const idSuperArc arc) {
128 if(merged_ == nullSuperArc) {
129 merged_ = arc;
130 hide();
131 }
132 }
133
134 bool merged() const {
135 return merged_ != nullSuperArc;
136 }
137
139 return merged_;
140 }
141
142 void restore() {
143 visible_ = true;
144 merged_ = nullSuperArc;
145 }
146
147 const decltype(segmentation_) &segmentation() const {
148 return segmentation_;
149 }
150
151 decltype(segmentation_) &segmentation() {
152 return segmentation_;
153 }
154
155#ifndef NDEBUG
156 void setFromUp(bool up) {
157 fromUp_ = up;
158 }
159
160 bool getFromUp() const {
161 return fromUp_;
162 }
163#endif
164 };
165 } // namespace ftr
166} // namespace ttk
Minimalist debugging class.
Definition Debug.h:88
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
Union find compliant with parallel find and maintaining the current local propagation inspired by ttk...
Definition FTRAtomicUF.h:23
AtomicUF * find()
Definition FTRAtomicUF.h:35
Propagation * getPropagation()
Definition FTRAtomicUF.h:51
TTK fTRGraph propagation management with Fibonacci heaps.
TTK processing package that deal with segmentation of an arc in the Reeb Graph.
TTK FTRGraph graph arc.
Definition FTRSuperArc.h:30
void visit(const idVertex v)
Definition FTRSuperArc.h:94
decltype(segmentation_) & segmentation()
void setUpNodeId(const idNode id)
Definition FTRSuperArc.h:53
void setUfProp(AtomicUF *const UFprop)
Definition FTRSuperArc.h:79
idSuperArc mergedIn() const
idNode getUpNodeId() const
Definition FTRSuperArc.h:48
idNode getDownNodeId() const
Definition FTRSuperArc.h:57
idVertex getLastReg() const
bool getFromUp() const
const decltype(segmentation_) & segmentation() const
idVertex getFirstReg() const
Propagation * getPropagation() const
Definition FTRSuperArc.h:70
bool isVisible() const
Definition FTRSuperArc.h:89
void setEnd(const idVertex v)
void setDownNodeId(const idNode id)
Definition FTRSuperArc.h:66
void setFromUp(bool up)
SuperArc(const idNode down=nullNode, const idNode up=nullNode)
Definition FTRSuperArc.h:43
bool isEmpty() const
bool merged() const
idVertex getEnd() const
void merge(const idSuperArc arc)
long unsigned int idSuperArc
SuperArc index in vect_superArcs_.
SimplexId idVertex
Vertex index in scalars_.
unsigned int idNode
Node index in vect_nodes_.
The Topology ToolKit.