33 std::list<std::vector<std::pair<SimplexId, bool>>> &storage) {
35 queue<pair<bool, idNode>> growingNodes;
36 pair<bool, idNode> head;
39 idNode correspondingNodeId, parentId, node1, node2;
40 Node *currentNode, *parentNode;
42 const bool DEBUG =
false;
45 SimplexId nbAddedleavesST = 0, nbAddedleavesJT = 0;
53 growingNodes.emplace(
false, nId);
59 if(nbAddedleavesST == 1) {
69 if(nbAddedleavesJT > 1)
73 if(nbAddedleavesJT > 1) {
77 growingNodes.emplace(
true, nId);
83 cout <<
"growingNodes : " << growingNodes.size() << endl;
86 if(nbAddedleavesST == 1 && nbAddedleavesJT == 1) {
96 if(growingNodes.empty()) {
97 cout <<
"[ContourForestsTree::combine ] Nothing to combine" << endl;
102 = (seed0 == -1) ? nullVertex :
scalars_->sortedVertices[seed0];
106 while(!growingNodes.empty()) {
108 head = growingNodes.front();
120 currentNode = xt->
getNode(head.second);
127 cout <<
"node : " << currentNode->
getVertexId() << endl;
131 = yt->getCorrespondingNodeId(currentNode->
getVertexId());
149 || yt->getNode(correspondingNodeId)->getNumberOfDownSuperArcs() > 1) {
160 if(yt->getNode(correspondingNodeId)->getNumberOfDownSuperArcs() > 1) {
162 cout <<
"re-enqueue and ignore " << yt->printNode(correspondingNodeId)
166 growingNodes.emplace(head.first, head.second);
171 cout <<
" ignore" << endl;
180 curUpArc = xt->
getSuperArc(curUpArc)->getReplacantArcId();
181 parentId = xt->
getSuperArc(curUpArc)->getUpNodeId();
182 if(parentId == nullNodes) {
192 parentNode = xt->
getNode(parentId);
208 pair<SimplexId, bool> *arcVertList =
nullptr;
216 bool overlapB =
false, overlapA =
false;
219 if(s0 != nullVertex) {
223 if(s1 != nullVertex) {
233 node1, node2, overlapB, overlapA, arcVertList, arcVertSize);
236 node2, node1, overlapB, overlapA, arcVertList, arcVertSize);
247 for(
SimplexId vert = 0; vert < arcVertSize; vert++) {
248 const SimplexId &v = arcVertList[vert].first;
258 cout <<
" arc added : (segm: " << nbv <<
") ";
259 cout <<
printArc(createdArc) << endl;
266 cout <<
" delete xt (" << (xt == &
jt_)
267 <<
") node :" << xt->getNode(head.second)->getVertexId() << endl;
270 xt->
delNode(head.second, storage);
275 if(yt->getNode(correspondingNodeId)->getNumberOfDownSuperArcs() < 2) {
277 cout <<
" delete yt (" << head.first <<
") node :";
278 cout << yt->getNode(correspondingNodeId)->getVertexId();
280 cout << static_cast<unsigned>(
281 yt->getNode(correspondingNodeId)->getNumberOfDownSuperArcs());
284 <<
static_cast<unsigned>(
285 yt->getNode(correspondingNodeId)->getNumberOfUpSuperArcs())
289 yt->delNode(correspondingNodeId, storage, arcVertList, arcVertSize);
295 growingNodes.emplace(head.first, parentId);
298 cout <<
"will see : " << parentNode->
getVertexId() << endl;
int combine(const SimplexId &seed0, const SimplexId &seed1, std::list< std::vector< std::pair< SimplexId, bool > > > &storage)
Combine tree with Natarajan's algorithm.
void delNode(const idNode &node, std::list< std::vector< std::pair< SimplexId, bool > > > &storage, const std::pair< SimplexId, bool > *mv=nullptr, const SimplexId &nbm=0)
idSuperArc makeSuperArc(const idNode &downNodeId, const idNode &upNodeId, const bool overlapB, const bool overlapA, std::pair< SimplexId, bool > *vertexList=nullptr, SimplexId vertexSize=-1)