------------------------------------------------------------------------------ The shift is a request along each of the axes I,J,K which in 2D depending on the Orientation corresponds to an IJ request which translates according to the orientation value The call to this method must be consistent with the existence of a neighboring cell following the requested shift.
| 1386 | // The call to this method must be consistent with the existence of a neighboring |
| 1387 | // cell following the requested shift. |
| 1388 | vtkIdType vtkHyperTreeGrid::GetShiftedLevelZeroIndex( |
| 1389 | vtkIdType treeindex, int di, int dj, int dk) const |
| 1390 | { |
| 1391 | unsigned int local_i, local_j, local_k; |
| 1392 | // It is very important to use the GetLevelZeroCoordinatesFromIndex method |
| 1393 | // to convert HyperTree indexes to HyperTree coordinates. |
| 1394 | // This method takes into account the choice made for TransposedRootIndexing. |
| 1395 | this->GetLevelZeroCoordinatesFromIndex(treeindex, local_i, local_j, local_k); |
| 1396 | std::array<unsigned int, 3> local_ijk{ local_i, local_j, local_k }; |
| 1397 | switch (this->Dimension) |
| 1398 | { |
| 1399 | case 1: |
| 1400 | { |
| 1401 | // The axis used for 1D |
| 1402 | assert(di >= 0 || |
| 1403 | ("there is no neighbor axis 0" && |
| 1404 | local_ijk[this->GetAxes()[0]] >= static_cast<unsigned int>(-di))); |
| 1405 | local_ijk[this->GetAxes()[0]] += di; |
| 1406 | // No expected values |
| 1407 | assert(dj == 0); |
| 1408 | assert(dk == 0); |
| 1409 | break; |
| 1410 | } |
| 1411 | case 2: |
| 1412 | { |
| 1413 | // Axes used for 2D |
| 1414 | assert(di >= 0 || |
| 1415 | ("there is no neighbor axis 0" && |
| 1416 | local_ijk[this->GetAxes()[0]] >= static_cast<unsigned int>(-di))); |
| 1417 | local_ijk[this->GetAxes()[0]] += di; |
| 1418 | assert(dj >= 0 || |
| 1419 | ("there is no neighbor axis 1" && |
| 1420 | local_ijk[this->GetAxes()[1]] >= static_cast<unsigned int>(-dj))); |
| 1421 | local_ijk[this->GetAxes()[1]] += dj; |
| 1422 | // No expected values |
| 1423 | assert(dk == 0); |
| 1424 | break; |
| 1425 | } |
| 1426 | case 3: |
| 1427 | { |
| 1428 | assert(di >= 0 || |
| 1429 | ("there is no neighbor before axis i" && local_ijk[0] >= static_cast<unsigned int>(-di))); |
| 1430 | local_ijk[0] += di; |
| 1431 | assert(dj >= 0 || |
| 1432 | ("there is no neighbor before axis j" && local_ijk[1] >= static_cast<unsigned int>(-dj))); |
| 1433 | local_ijk[1] += dj; |
| 1434 | assert(dk >= 0 || |
| 1435 | ("there is no neighbor before axis k" && local_ijk[2] >= static_cast<unsigned int>(-dk))); |
| 1436 | local_ijk[2] += dk; |
| 1437 | break; |
| 1438 | } |
| 1439 | default: |
| 1440 | break; |
| 1441 | } |
| 1442 | vtkIdType shifttreeindex; |
| 1443 | // It is very important to use the GetIndexFromLevelZeroCoordinates method, |
| 1444 | // GetLevelZeroCoordinatesFromIndex's reciprocal method to convert HyperTree |
| 1445 | // coordinates to HyperTree indexes. |
no test coverage detected