----------------------------------------------------------------------------------------------
| 111 | |
| 112 | //---------------------------------------------------------------------------------------------- |
| 113 | void vtkHyperTreeGridGeometry3DImpl::RecursivelyProcessTree( |
| 114 | vtkHyperTreeGridNonOrientedVonNeumannSuperCursor* cursor, |
| 115 | unsigned char coarseCellFacesToBeTreated) |
| 116 | { |
| 117 | vtkIdType cellId = cursor->GetGlobalNodeIndex(); |
| 118 | |
| 119 | // For a given cell, we can generate faces if the cell is a leaf or if the cell is masked |
| 120 | if (cursor->IsLeaf() || this->IsMaskedOrGhost(cellId)) |
| 121 | { |
| 122 | // Improvement: coarseCellFacesToBeTreated can also be used there (not used for now) |
| 123 | this->GenerateCellSurface(cursor, coarseCellFacesToBeTreated, cellId); |
| 124 | return; |
| 125 | } |
| 126 | |
| 127 | // Case of a pure, non-masked coarse cell (optimisation) |
| 128 | if (this->InPureMaskArray && this->InPureMaskArray->GetValue(cellId) == 0) |
| 129 | { |
| 130 | // All child cells are in the same material, so we can only treat |
| 131 | // the ones at the border of the coarse cell |
| 132 | std::set<int> childList; |
| 133 | std::vector<unsigned char> childCellFacesToBeTreated(cursor->GetNumberOfChildren(), 0); |
| 134 | |
| 135 | for (unsigned int f = 0; f < 3; ++f) // dimension |
| 136 | { |
| 137 | for (unsigned int o = 0; o < 2; ++o) // left, center, right |
| 138 | { |
| 139 | int neighborIdx = (2 * o - 1) * (f + 1); |
| 140 | if ((coarseCellFacesToBeTreated & (1 << (3 + neighborIdx)))) |
| 141 | { |
| 142 | bool isValidN = cursor->HasTree(3 + neighborIdx); |
| 143 | vtkIdType neighboringCellId = 0; |
| 144 | if (isValidN) |
| 145 | { |
| 146 | neighboringCellId = cursor->GetGlobalNodeIndex(3 + neighborIdx); |
| 147 | } |
| 148 | if (!isValidN || this->InPureMaskArray->GetValue(neighboringCellId)) |
| 149 | { |
| 150 | // If the neighboring cells do not exist or are not pure, |
| 151 | // we have border children |
| 152 | int iMin = (f == 0 && o == 1) ? this->BranchFactor - 1 : 0; |
| 153 | int iMax = (f == 0 && o == 0) ? 1 : this->BranchFactor; |
| 154 | int jMin = (f == 1 && o == 1) ? this->BranchFactor - 1 : 0; |
| 155 | int jMax = (f == 1 && o == 0) ? 1 : this->BranchFactor; |
| 156 | int kMin = (f == 2 && o == 1) ? this->BranchFactor - 1 : 0; |
| 157 | int kMax = (f == 2 && o == 0) ? 1 : this->BranchFactor; |
| 158 | for (int i = iMin; i < iMax; ++i) |
| 159 | { |
| 160 | for (int j = jMin; j < jMax; ++j) |
| 161 | { |
| 162 | for (int k = kMin; k < kMax; ++k) |
| 163 | { |
| 164 | unsigned int ichild = i + this->BranchFactor * (j + this->BranchFactor * k); |
| 165 | |
| 166 | // We can request a border child cell more than one time, |
| 167 | // once for each of it's "exposed" face |
| 168 | childList.insert(ichild); |
| 169 | childCellFacesToBeTreated[ichild] |= (1 << (3 + neighborIdx)); |
| 170 | } // k |
no test coverage detected