* Recursively process the tree to mask ghost cells. Return true if the current cell has been * masked (i.e. already masked in inMask, ghost in inGhost, or all children masked and/or ghost). */
| 21 | * masked (i.e. already masked in inMask, ghost in inGhost, or all children masked and/or ghost). |
| 22 | */ |
| 23 | bool RecursivelyMaskGhost( |
| 24 | vtkHyperTreeGridNonOrientedCursor* cursor, vtkBitArray* inMask, vtkUnsignedCharArray* inGhost) |
| 25 | { |
| 26 | vtkIdType currentId = cursor->GetGlobalNodeIndex(); |
| 27 | cursor->SetMask(false); |
| 28 | |
| 29 | if (inMask && inMask->GetValue(currentId)) |
| 30 | { |
| 31 | cursor->SetMask(true); |
| 32 | return true; |
| 33 | } |
| 34 | |
| 35 | if (inGhost->GetTuple1(currentId)) |
| 36 | { |
| 37 | cursor->SetMask(true); |
| 38 | return true; |
| 39 | } |
| 40 | |
| 41 | bool allGhostOrMasked = false; |
| 42 | if (!cursor->IsLeaf()) |
| 43 | { |
| 44 | for (int child = 0; child < cursor->GetNumberOfChildren(); ++child) |
| 45 | { |
| 46 | cursor->ToChild(child); |
| 47 | // Coarse cell is masked if it contains only ghosts and/or masked children |
| 48 | allGhostOrMasked = allGhostOrMasked && RecursivelyMaskGhost(cursor, inMask, inGhost); |
| 49 | cursor->ToParent(); |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | cursor->SetMask(allGhostOrMasked); |
| 54 | return allGhostOrMasked; |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | //------------------------------------------------------------------------------ |
no test coverage detected