------------------------------------------------------------------------------
| 121 | |
| 122 | //------------------------------------------------------------------------------ |
| 123 | void vtkHyperTreeGridGeometryLevelEntry::ToChild(const vtkHyperTreeGrid* grid, unsigned char ichild) |
| 124 | { |
| 125 | assert("pre: not_tree" && this->Tree); |
| 126 | assert("pre: not_leaf" && !this->IsLeaf(grid)); |
| 127 | assert("pre: not_valid_child" && ichild < this->Tree->GetNumberOfChildren()); |
| 128 | assert( |
| 129 | "pre: depth_limiter" && this->Level <= const_cast<vtkHyperTreeGrid*>(grid)->GetDepthLimiter()); |
| 130 | assert("pre: is_masked" && !this->IsMasked(grid)); |
| 131 | |
| 132 | const double* sizeChild = this->Tree->GetScales()->ComputeScale(this->Level + 1); |
| 133 | |
| 134 | this->Index = this->Tree->GetElderChildIndex(this->Index) + ichild; |
| 135 | |
| 136 | // Divide cell size and translate origin per template parameter |
| 137 | switch (this->Tree->GetNumberOfChildren()) |
| 138 | { |
| 139 | case 2: // dimension = 1, branch factor = 2 |
| 140 | { |
| 141 | unsigned int axis = grid->GetOrientation(); |
| 142 | this->Origin[axis] += (ichild & 1) * sizeChild[axis]; |
| 143 | break; |
| 144 | } |
| 145 | case 3: // dimension = 1, branch factor = 3 |
| 146 | { |
| 147 | unsigned int axis = grid->GetOrientation(); |
| 148 | this->Origin[axis] += (ichild % 3) * sizeChild[axis]; |
| 149 | break; |
| 150 | } |
| 151 | case 4: // dimension = 2, branch factor = 2 |
| 152 | { |
| 153 | unsigned int axis1 = 0; |
| 154 | unsigned int axis2 = 1; |
| 155 | switch (grid->GetOrientation()) |
| 156 | { |
| 157 | case 0: |
| 158 | axis1 = 1; |
| 159 | [[fallthrough]]; |
| 160 | case 1: |
| 161 | axis2 = 2; |
| 162 | } |
| 163 | this->Origin[axis1] += (ichild & 1) * sizeChild[axis1]; |
| 164 | this->Origin[axis2] += ((ichild & 2) >> 1) * sizeChild[axis2]; |
| 165 | break; |
| 166 | } |
| 167 | case 9: // dimension = 2, branch factor = 3 |
| 168 | { |
| 169 | unsigned int axis1 = 0; |
| 170 | unsigned int axis2 = 1; |
| 171 | switch (grid->GetOrientation()) |
| 172 | { |
| 173 | case 0: |
| 174 | axis1 = 1; |
| 175 | [[fallthrough]]; |
| 176 | case 1: |
| 177 | axis2 = 2; |
| 178 | } |
| 179 | this->Origin[axis1] += (ichild % 3) * sizeChild[axis1]; |
| 180 | this->Origin[axis2] += ((ichild % 9) / 3) * sizeChild[axis2]; |
nothing calls this directly
no test coverage detected