------------------------------------------------------------------------------
| 152 | |
| 153 | //------------------------------------------------------------------------------ |
| 154 | void vtkHyperTreeGridGeometryUnlimitedEntry::ToChild(const vtkHyperTreeGrid* grid, |
| 155 | const vtkHyperTree* tree, unsigned int vtkNotUsed(level), const double* sizeChild, |
| 156 | unsigned char ichild) |
| 157 | { |
| 158 | assert("pre: not_tree" && tree); |
| 159 | assert("pre: is_masked" && !IsMasked(grid, tree)); |
| 160 | |
| 161 | size_t indexMax = 0; |
| 162 | tree->GetElderChildIndexArray(indexMax); |
| 163 | if (this->Index >= 0 && this->Index < static_cast<vtkIdType>(indexMax)) |
| 164 | { |
| 165 | vtkIdType elder = tree->GetElderChildIndex(this->Index); |
| 166 | if (elder != static_cast<vtkIdType>(std::numeric_limits<unsigned int>::max())) |
| 167 | { |
| 168 | this->Index = elder + ichild; |
| 169 | this->LastRealIndex = this->Index; |
| 170 | } |
| 171 | else |
| 172 | { |
| 173 | // first virtual cell |
| 174 | this->Index = vtkHyperTreeGrid::InvalidIndex; |
| 175 | } |
| 176 | } |
| 177 | else |
| 178 | { |
| 179 | // cell is already virtual |
| 180 | this->Index = vtkHyperTreeGrid::InvalidIndex; |
| 181 | } |
| 182 | |
| 183 | // Divide cell size and translate origin per template parameter |
| 184 | switch (tree->GetNumberOfChildren()) |
| 185 | { |
| 186 | case 2: // dimension = 1, branch factor = 2 |
| 187 | { |
| 188 | unsigned int axis = grid->GetOrientation(); |
| 189 | this->Origin[axis] += (ichild & 1) * sizeChild[axis]; |
| 190 | break; |
| 191 | } |
| 192 | case 3: // dimension = 1, branch factor = 3 |
| 193 | { |
| 194 | unsigned int axis = grid->GetOrientation(); |
| 195 | this->Origin[axis] += (ichild % 3) * sizeChild[axis]; |
| 196 | break; |
| 197 | } |
| 198 | case 4: // dimension = 2, branch factor = 2 |
| 199 | { |
| 200 | unsigned int axis1 = 0; |
| 201 | unsigned int axis2 = 1; |
| 202 | switch (grid->GetOrientation()) |
| 203 | { |
| 204 | case 0: |
| 205 | axis1 = 1; |
| 206 | [[fallthrough]]; |
| 207 | case 1: |
| 208 | axis2 = 2; |
| 209 | } |
| 210 | this->Origin[axis1] += (ichild & 1) * sizeChild[axis1]; |
| 211 | this->Origin[axis2] += ((ichild & 2) >> 1) * sizeChild[axis2]; |
nothing calls this directly
no test coverage detected