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

Method RecursivelyPreProcessTree

Filters/HyperTree/vtkHyperTreeGridContour.cxx:699–787  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

697
698//------------------------------------------------------------------------------
699bool vtkHyperTreeGridContour::RecursivelyPreProcessTree(vtkHyperTreeGridNonOrientedCursor* cursor)
700{
701 // Retrieve global index of input cursor
702 vtkIdType id = cursor->GetGlobalNodeIndex();
703
704 if (this->InGhostArray && this->InGhostArray->GetTuple1(id))
705 {
706 return false;
707 }
708
709 // Retrieve number of contours
710 vtkIdType numContours = this->ContourValues->GetNumberOfContours();
711
712 // Descend further into input trees only if cursor is not a leaf
713 bool selected = false;
714 if (!cursor->IsLeaf() && !cursor->IsMasked())
715 {
716 // Cursor is not at leaf, recurse to all all children
717 int numChildren = cursor->GetNumberOfChildren();
718 std::vector<bool> signs(numContours);
719 for (int child = 0; child < numChildren; ++child)
720 {
721 if (this->CheckAbort())
722 {
723 break;
724 }
725 // Create storage for signs relative to contour values
726
727 cursor->ToChild(child);
728
729 // Recurse and keep track of whether this branch is selected
730 selected |= this->RecursivelyPreProcessTree(cursor);
731
732 // Check if branch not completely selected
733 if (!selected)
734 {
735 // If not, update contour values
736 for (int c = 0; c < numContours; ++c)
737 {
738 // Retrieve global index of child
739 vtkIdType childId = cursor->GetGlobalNodeIndex();
740
741 // Compute and store selection flags for current contour
742 if (child == 0)
743 {
744 // Initialize sign array with sign of first child
745 signs[c] = (this->CellSigns[c]->GetTuple1(childId) != 0.0);
746 }
747 else
748 {
749 // For subsequent children compare their sign with stored value
750 if (signs[c] != (this->CellSigns[c]->GetTuple1(childId) != 0.0))
751 {
752 // A change of sign occurred, therefore cell must selected
753 selected = true;
754 }
755 } // else
756 } // c

Callers 1

ProcessTreesMethod · 0.95

Calls 11

GetTuple1Method · 0.80
CheckAbortMethod · 0.80
SetTuple1Method · 0.80
GetGlobalNodeIndexMethod · 0.45
GetNumberOfContoursMethod · 0.45
IsLeafMethod · 0.45
IsMaskedMethod · 0.45
GetNumberOfChildrenMethod · 0.45
ToChildMethod · 0.45
ToParentMethod · 0.45
GetValuesMethod · 0.45

Tested by

no test coverage detected