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

Method RecursivelyProcessTree

Filters/HyperTree/vtkHyperTreeGridContour.cxx:790–1017  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

788
789//------------------------------------------------------------------------------
790void vtkHyperTreeGridContour::RecursivelyProcessTree(
791 vtkHyperTreeGridNonOrientedMooreSuperCursor* supercursor, vtkCellArray* newVerts,
792 vtkCellArray* newLines, vtkCellArray* newPolys, vtkPointData* inPd)
793{
794 // Retrieve global index of input cursor
795 vtkIdType id = supercursor->GetGlobalNodeIndex();
796
797 if (this->InGhostArray && this->InGhostArray->GetTuple1(id))
798 {
799 return;
800 }
801 // Retrieve dimensionality
802 unsigned int dim = supercursor->GetDimension();
803
804 // Descend further into input trees only if cursor is not a leaf
805 if (!supercursor->IsLeaf())
806 {
807 // Selected cells are determined in RecursivelyPreProcessTree
808 bool selected = (this->SelectedCells->GetTuple1(id) == 1.0);
809
810 // Iterate over contours
811 for (vtkIdType c = 0; c < this->ContourValues->GetNumberOfContours() && !selected; ++c)
812 {
813 // Retrieve sign with respect to contour value at current cursor
814 bool sign = (this->CellSigns[c]->GetTuple1(id) != 0.0);
815
816 // Iterate over all cursors of Moore neighborhood around center
817 unsigned int nn = supercursor->GetNumberOfCursors() - 1;
818 for (unsigned int neighbor = 0; neighbor < nn && !selected; ++neighbor)
819 {
820 // Retrieve global index of neighbor
821 unsigned int icursorN = MooreCursors[dim - 1][neighbor];
822 if (supercursor->HasTree(icursorN))
823 {
824 vtkIdType idN = supercursor->GetGlobalNodeIndex(icursorN);
825
826 // Decide whether neighbor was selected or must be retained because of a sign change
827 selected = this->SelectedCells->GetTuple1(idN) == 1 ||
828 ((this->CellSigns[c]->GetTuple1(idN) != 0.0) != sign) ||
829 (this->InGhostArray && this->InGhostArray->GetTuple1(idN));
830 }
831 else
832 {
833 selected = false;
834 }
835 } // neighbor
836 } // c
837 if (selected && !supercursor->IsMasked())
838 {
839 // Node has at least one neighbor containing one contour, recurse to all children
840 unsigned int numChildren = supercursor->GetNumberOfChildren();
841 for (unsigned int child = 0; child < numChildren; ++child)
842 {
843 // Create child cursor from parent in input grid
844 supercursor->ToChild(child);
845 // Recurse
846 this->RecursivelyProcessTree(supercursor, newVerts, newLines, newPolys, inPd);
847 supercursor->ToParent();

Callers 1

ProcessTreesMethod · 0.95

Calls 15

AreAllFacesPlanarFunction · 0.85
GetTuple1Method · 0.80
SetNumberOfIdsMethod · 0.80
InsertCellPointMethod · 0.80
GoToNextCellMethod · 0.80
GetGlobalNodeIndexMethod · 0.45
GetDimensionMethod · 0.45
IsLeafMethod · 0.45
GetNumberOfContoursMethod · 0.45
HasTreeMethod · 0.45
IsMaskedMethod · 0.45
GetNumberOfChildrenMethod · 0.45

Tested by

no test coverage detected