------------------------------------------------------------------------------
| 533 | |
| 534 | //------------------------------------------------------------------------------ |
| 535 | void vtkHyperTreeGridGeometry3DImpl::CompleteLinkage( |
| 536 | std::map<unsigned int, std::pair<vtkHyperTreeGridGeometry3DImpl::HTG3DPoint*, unsigned int>>& |
| 537 | internalFace, |
| 538 | unsigned int edgePointId1, unsigned int edgePointId2) |
| 539 | { |
| 540 | if (edgePointId1 == VTK_DEFAULT_EDGE_INDEX || edgePointId2 == VTK_DEFAULT_EDGE_INDEX) |
| 541 | { |
| 542 | // XXX: this seems to happen quite often. |
| 543 | // We must clarify if it is intended |
| 544 | return; |
| 545 | } |
| 546 | if (edgePointId1 == edgePointId2) |
| 547 | { |
| 548 | vtkErrorWithObjectMacro(nullptr, "Edge with 2 identical points found !"); |
| 549 | return; |
| 550 | } |
| 551 | |
| 552 | // Build link between edgePointId1 et edgePointId2 |
| 553 | // XXX: need to clarify naming for nextEdgePointId1 and nextEdgePointId2 |
| 554 | unsigned int nextEdgePointId1 = internalFace[edgePointId1].second; |
| 555 | unsigned int nextEdgePointId2 = internalFace[edgePointId2].second; |
| 556 | if (nextEdgePointId1 == VTK_DEFAULT_EDGE_INDEX) |
| 557 | { |
| 558 | if (nextEdgePointId2 == VTK_DEFAULT_EDGE_INDEX || nextEdgePointId2 != edgePointId1) |
| 559 | { |
| 560 | // Arbitrary choice of linking direction, |
| 561 | // or nextEdgePointId2 already describes a different linking |
| 562 | internalFace[edgePointId1].second = edgePointId2; |
| 563 | } |
| 564 | } |
| 565 | else if (nextEdgePointId2 == VTK_DEFAULT_EDGE_INDEX) |
| 566 | { |
| 567 | // Arbitrary choice of linking direction |
| 568 | internalFace[edgePointId2].second = edgePointId1; |
| 569 | } |
| 570 | else if (nextEdgePointId2 != edgePointId1) |
| 571 | { |
| 572 | // If nextEdgePointId1 is involved in a different linkage, this is also the case for |
| 573 | // nextEdgePointId2 We have to invert both linkages and connect them together |
| 574 | std::vector<unsigned int> chainette; |
| 575 | chainette.emplace_back(edgePointId1); |
| 576 | unsigned int next = internalFace[edgePointId1].second; |
| 577 | while (next != VTK_DEFAULT_EDGE_INDEX) |
| 578 | { |
| 579 | // XXX: think adding an "emergency" breaking condition to |
| 580 | // avoid potential infinite looping |
| 581 | chainette.emplace_back(next); |
| 582 | next = internalFace[next].second; |
| 583 | } |
| 584 | unsigned int current = VTK_DEFAULT_EDGE_INDEX; |
| 585 | for (std::vector<unsigned int>::reverse_iterator it = chainette.rbegin(); |
| 586 | it != chainette.rend(); ++it) |
| 587 | { |
| 588 | if (current == VTK_DEFAULT_EDGE_INDEX) |
| 589 | { |
| 590 | current = *it; |
| 591 | } |
| 592 | else |
no test coverage detected