* Return true if the cell validity and volume fields correspond to expected values for the root * tree pointed by the cursor. */
| 67 | * tree pointed by the cursor. |
| 68 | */ |
| 69 | bool 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. |
no test coverage detected