24 parallelParams_(), parallelData_() {
27 "DEPRECATED This module will be removed in a future release, please use "
28 "FTM instead for contour trees and FTR for Reeb graphs.");
71 scalars_->sortedVertices[partitionSize * (i + 1)]);
81 stringstream partition;
82 partition <<
"seeds :";
83 for(
const auto &i : parallelData_.
interfaces) {
84 partition << i.getSeed() <<
" ";
121 const bool DEBUG =
false;
127 return parallelData_.
trees[i].getJoinTree();
130 return parallelData_.
trees[i].getSplitTree();
132 return ¶llelData_.
trees[i];
135 vector<bool> seenSeed(parallelParams_.
nbInterfaces,
false);
141 = make_pair(parallelData_.
interfaces[i].getSeed(),
false);
144 cout <<
"partition : " <<
static_cast<unsigned>(i);
145 cout <<
" seed is : " << seedPair.first << endl << endl;
169 MergeTree *otherTree = getTreePart(otherPartition);
172 cout <<
"crossing arc is " << curTree->
printArc(arc) << endl;
176 cout <<
"stitch vertex : " << stitchVertex << endl;
177 cout <<
"on partition " <<
static_cast<unsigned>(otherPartition)
179 cout <<
"crossing arc is now " << curTree->
printArc(arc) << endl;
182 const idNode &curTreeStitchNodeId
184 Node *curTreeStitchNode = curTree->
getNode(curTreeStitchNodeId);
186 bool otherTreeAlreadyHide =
false;
191 cout <<
"other tree arc is : " << otherTree->
printArc(sa) << endl;
193 const auto &arcToHide
198 otherTreeAlreadyHide =
true;
201 cout <<
"hide arc in other : " << otherTree->
printArc(arcToHide)
206 const idNode &otherTreeStitchNodeId
208 Node *otherTreeStitchNode = otherTree->
getNode(otherTreeStitchNodeId);
211 cout <<
"Stitch nodes : " << endl;
212 cout <<
"current : " << curTree->
printNode(curTreeStitchNodeId) << endl;
213 cout <<
"other : " << otherTree->
printNode(otherTreeStitchNodeId)
226 if(stitchVertex == seedPair.first) {
228 cout <<
"stitch vertex is seed" << endl;
231 if(!seenSeed[otherPartition]) {
232 seenSeed[otherPartition] =
true;
235 cout <<
"clear below stitch vert " << endl;
238 }
else if(!otherTreeAlreadyHide && crossing->
getDownCT() == i) {
242 otherTreeStitchNodeId, currentBelowSeed);
245 cout <<
"hide arc leading to: ";
246 if(arcToHide != nullSuperArc) {
247 cout << otherTree->
printArc(arcToHide) << endl;
249 cout <<
"not found" << endl;
258 otherTreeStitchNodeId,
false,
259 true, i, otherPartition);
264 bool crossNextInterface =
false;
267 = parallelData_.
interfaces[otherPartition].getSeed();
268 crossNextInterface =
isLower(nextSeed, stitchVertex);
271 curTreeStitchNodeId, otherTreeStitchNodeId,
true, crossNextInterface, i,
275 if(crossNextInterface) {
278 cout <<
"new crossing above" << endl;
283 cout <<
"arc added :" << endl;
289 cout << endl << endl;
313 const bool DEBUG =
false;
318 return parallelData_.
trees[i].getJoinTree();
321 return parallelData_.
trees[i].getSplitTree();
323 return ¶llelData_.
trees[i];
336 queue<tuple<idInterface, idNode>> leavesNodes;
337 vector<unsigned> nbVisit(
scalars_->size, 0);
342 MergeTree *currentTree = getTreePart(partition);
353 leafVert, parallelData_.
interfaces[partition - 1].getSeed()))
379 if(!nbVisit[leafVert]) {
381 leavesNodes.emplace(partition, l);
384 cout <<
"will see : partition : " <<
static_cast<unsigned>(partition);
385 cout <<
" leaf node " << currentTree->
printNode(l) << endl;
400 while(!leavesNodes.empty()) {
404 tie(currentPartition, currentNodeId) = leavesNodes.front();
408 MergeTree *currentTree = getTreePart(currentPartition);
409 Node *currentNode = currentTree->
getNode(currentNodeId);
413 cout <<
"process : partition : "
414 <<
static_cast<unsigned>(currentPartition) << endl;
415 cout <<
" node " << currentTree->
printNode(currentNodeId) << endl;
423 const idNode refNodeId = currentNodeId;
426 for(
idSuperArc upArcPos = 0; upArcPos < nbUpArc; upArcPos++) {
428 currentTree = getTreePart(refPartition);
429 currentNodeId = refNodeId;
430 currentNode = currentTree->
getNode(currentNodeId);
436 cout <<
" process arc " << currentTree->
printArc(upArcId) << endl;
441 cout <<
" - ignore not visible" << endl;
451 list<pair<SimplexId, bool> *> listVertList;
452 list<SimplexId> listVertSize;
463 currentPartition = upArc->
getUpCT();
464 currentTree = getTreePart(currentPartition);
466 currentNode = currentTree->
getNode(currentNodeId);
479 cout <<
"stop at " << currentTree->
printNode(currentNodeId) << endl;
489 listVertList, listVertSize, this->storage_, totalSize);
492 tmpTree.
closeSuperArc(newArcId_tt, closingNode_tt,
false,
false);
495 cout <<
" Create arc : " << tmpTree.
printArc(newArcId_tt) << endl;
500 ++nbVisit[closingVertex];
505 MergeTree *closingTree = getTreePart(closingPartition);
506 const idNode &closingNodeId
508 const unsigned &downVal
511 if(nbVisit[closingVertex] == downVal) {
512 leavesNodes.emplace(closingPartition, closingNodeId);
514 cout <<
" push : partition : "
515 <<
static_cast<unsigned>(closingPartition) << endl;
516 cout <<
" push : node : " << closingTree->
printNode(closingNodeId)
520 cout <<
" visit : " << nbVisit[closingVertex] << endl;
521 cout <<
" downVal : " << downVal << endl;
532 }
else if(treetype == 1) {
534 }
else if(treetype == 2) {
547 int arcCTUp, arcCTDown;
550 cout <<
"CT " << nb << endl;
551 cout <<
"Nodes" << endl;
553 for(
const auto &n : parallelData_.
trees[nb].getNodes()) {
555 cout <<
"Node " << n.getVertexId();
561 cout <<
" arc up : ";
563 for(
idSuperArc i = 0; i < n.getNumberOfUpSuperArcs(); ++i) {
564 cout << n.getUpSuperArcId(i) <<
" ";
567 cout << endl <<
" arc down : ";
569 for(
idSuperArc i = 0; i < n.getNumberOfDownSuperArcs(); ++i) {
570 cout << n.getDownSuperArcId(i) <<
" ";
577 cout <<
"Arcs" << endl;
579 for(
const auto &sa : parallelData_.
trees[nb].getSuperArc()) {
581 arcCTDown = sa.getDownCT();
582 arcCTUp = sa.getUpCT();
584 if(sa.getDownNodeId() == nullNodes) {
587 cout << static_cast<unsigned>(arcCTDown) <<
":";
588 cout << parallelData_.
trees[arcCTDown]
589 .getNode(sa.getDownNodeId())
595 else if(!sa.isVisible())
600 if(sa.getUpNodeId() == nullNodes) {
603 cout << static_cast<unsigned>(arcCTUp) <<
":";
604 cout << parallelData_.
trees[arcCTUp]
605 .getNode(sa.getUpNodeId())
614 cout <<
"Leaves" << endl;
616 for(
const auto &l : parallelData_.
trees[nb].getLeaves())
621 cout <<
"Roots" << endl;
623 for(
const auto &r : parallelData_.
trees[nb].getRoots())
Legacy backward compatibility.
int printWrn(const std::string &msg, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cerr) const
void setDebugMsgPrefix(const std::string &prefix)
~ContourForests() override
void stitchTree(const char tree)
idPartition vertex2partition(const SimplexId &v)
void printDebug(DebugTimer &timer, const std::string &str)
void unifyTree(const char treetype)
Interface(const SimplexId &seed)
void hideArc(const idSuperArc &sa)
idSuperArc getNumberOfVisibleArcs() const
idNode makeNode(const SimplexId &vertexId, const SimplexId &linked=nullVertex)
idSuperArc openSuperArc(const idNode &downNodeId, const bool overlapB, const bool overlapA)
std::string printArc(const idSuperArc &a)
std::shared_ptr< Scalars > scalars_
bool isCorrespondingArc(const SimplexId &val) const
void removeInternalDownArcs(const idNode &node)
std::shared_ptr< MergeTree > clone() const
void addCrossingAbove(const idSuperArc &sa)
idSuperArc getNumberOfSuperArcs() const
idSuperArc reverseInsertNode(Node *node, const bool segment)
SimplexId getVertBelowSeed(const idSuperArc &arc, const std::pair< SimplexId, bool > &seed, const std::vector< idCorresp > &vert2treeOther)
std::string printNode(const idNode &n)
bool isHigher(const SimplexId &a, const SimplexId &b) const
idNode getCorrespondingNodeId(const SimplexId &val) const
idSuperArc getCorrespondingSuperArcId(const SimplexId &val) const
void closeSuperArc(const idSuperArc &superArcId, const idNode &upNodeId, const bool overlapB, const bool overlapA)
void flush()
clear local data for new computation
bool isLower(const SimplexId &a, const SimplexId &b) const
idSuperArc hideAndClearLeadingTo(const idNode &baseNode, const SimplexId &v)
SimplexId insertNodeAboveSeed(const idSuperArc &arc, const std::pair< SimplexId, bool > &seed)
const std::vector< SuperArc > & getSuperArc() const
Node * getNode(const idNode &nodeId)
std::shared_ptr< Params > params_
SimplexId getVertexId() const
idSuperArc clearUpSuperArcs()
void addUpSuperArcId(const idSuperArc &upSuperArcId)
void addDownSuperArcId(const idSuperArc &downSuperArcId)
idSuperArc getNumberOfUpSuperArcs() const
void setUpValence(const idSuperArc &v)
idSuperArc getUpSuperArcId(const idSuperArc &neighborId) const
void setDownValence(const idSuperArc &v)
idSuperArc getNumberOfDownSuperArcs() const
idPartition getDownCT() const
const idNode & getUpNodeId() const
const SimplexId & getVertSize()
std::pair< SimplexId, bool > * getVertList()
void appendVertLists(const std::list< std::pair< SimplexId, bool > * > &vertLists, std::list< SimplexId > vertSizes, std::list< std::vector< std::pair< SimplexId, bool > > > &storage, const SimplexId &totalSize)
const idNode & getDownNodeId() const
idPartition getUpCT() const
numThread idInterface
index of the interface/partition in vect_interfaces_
long unsigned int idSuperArc
SuperArc index in vect_superArcs_.
unsigned int idNode
Node index in vect_nodes_.
int SimplexId
Identifier type for simplices of any dimension.
std::vector< Interface > interfaces
std::vector< ContourForestsTree > trees
std::vector< idSuperArc > arcsCrossingAbove
std::vector< idNode > leaves
std::vector< Node > nodes
std::vector< SuperArc > superArcs
std::vector< idCorresp > vert2tree
printMsg(debug::output::BOLD+" | | | | | . \\ | | (__| | / __/| |_| / __/|__ _|"+debug::output::ENDCOLOR, debug::Priority::PERFORMANCE, debug::LineMode::NEW, stream)