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

Function CheckTree

Filters/HyperTree/Testing/Cxx/TestHyperTreeGridGenerateFields.cxx:69–100  ·  view source on GitHub ↗

* Return true if the cell validity and volume fields correspond to expected values for the root * tree pointed by the cursor. */

Source from the content-addressed store, hash-verified

67 * tree pointed by the cursor.
68 */
69bool CheckTree(vtkHyperTreeGridNonOrientedGeometryCursor* cursor, vtkHyperTreeGrid* outputHTG)
70{
71 vtkIdType currentId = cursor->GetGlobalNodeIndex();
72
73 double expectedValidity = 0.0;
74 if (cursor->IsLeaf() && !cursor->IsMasked() && !outputHTG->GetGhostCells()->GetTuple1(currentId))
75 {
76 // Cell is only tagged as valid if it is a non-masked, non-ghost leaf cell
77 expectedValidity = 1.0;
78 }
79
80 // Verify cell field values
81 if (!::CheckCellValidity(expectedValidity, currentId, outputHTG) ||
82 !::CheckVolume(currentId, outputHTG))
83 {
84 return false;
85 }
86
87 // Recurse over children
88 bool result = true;
89 if (!cursor->IsLeaf() && !cursor->IsMasked())
90 {
91 for (int child = 0; child < cursor->GetNumberOfChildren(); ++child)
92 {
93 cursor->ToChild(child);
94 result &= ::CheckTree(cursor, outputHTG);
95 cursor->ToParent();
96 }
97 }
98
99 return result;
100}
101
102/**
103 * Test the filter with ghost and masked cells.

Callers 1

TestMaskGhostSizesFunction · 0.70

Calls 10

CheckCellValidityFunction · 0.85
CheckVolumeFunction · 0.85
GetTuple1Method · 0.80
GetGhostCellsMethod · 0.80
GetGlobalNodeIndexMethod · 0.45
IsLeafMethod · 0.45
IsMaskedMethod · 0.45
GetNumberOfChildrenMethod · 0.45
ToChildMethod · 0.45
ToParentMethod · 0.45

Tested by

no test coverage detected