MCPcopy Create free account
hub / github.com/Kitware/VTK / CompleteLinkage

Method CompleteLinkage

Filters/HyperTree/vtkHyperTreeGridGeometry3DImpl.cxx:535–606  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

533
534//------------------------------------------------------------------------------
535void 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

Callers 2

ComputeEdgeInterfaceMethod · 0.95
ComputeEdgeMethod · 0.95

Calls 3

rbeginMethod · 0.80
rendMethod · 0.80
emplace_backMethod · 0.45

Tested by

no test coverage detected