------------------------------------------------------------------------------
| 505 | |
| 506 | //------------------------------------------------------------------------------ |
| 507 | void vtkAMRBox::GetGhostVector(int r, int nghost[6]) const |
| 508 | { |
| 509 | // STEP 0: initialize nghost |
| 510 | for (int i = 0; i < 3; ++i) |
| 511 | { |
| 512 | nghost[i * 2] = nghost[i * 2 + 1] = 0; |
| 513 | } |
| 514 | |
| 515 | // STEP 1: compute number of ghost layers along each dimension's min and max. |
| 516 | // Detecting partially overlapping boxes is based on the following: |
| 517 | // Cell location k at level L-1 holds the range [k*r,k*r+(r-1)] of |
| 518 | // level L, where r is the refinement ratio. Consequently, if the |
| 519 | // min extent of the box is greater than k*r or if the max extent |
| 520 | // of the box is less than k*r+(r-1), then the grid partially overlaps. |
| 521 | |
| 522 | vtkAMRBox coarsenedBox = *this; |
| 523 | coarsenedBox.Coarsen(r); |
| 524 | for (int i = 0; i < 3; ++i) |
| 525 | { |
| 526 | if (!this->EmptyDimension(i)) |
| 527 | { |
| 528 | int minRange[2]; |
| 529 | minRange[0] = coarsenedBox.LoCorner[i] * r; |
| 530 | minRange[1] = coarsenedBox.LoCorner[i] * r + (r - 1); |
| 531 | if (this->LoCorner[i] > minRange[0]) |
| 532 | { |
| 533 | nghost[i * 2] = (minRange[1] + 1) - this->LoCorner[i]; |
| 534 | } |
| 535 | |
| 536 | int maxRange[2]; |
| 537 | maxRange[0] = coarsenedBox.HiCorner[i] * r; |
| 538 | maxRange[1] = coarsenedBox.HiCorner[i] * r + (r - 1); |
| 539 | if (this->HiCorner[i] < maxRange[1]) |
| 540 | { |
| 541 | nghost[i * 2 + 1] = this->HiCorner[i] - (maxRange[0] - 1); |
| 542 | } |
| 543 | } |
| 544 | } // END for all dimensions |
| 545 | } |
| 546 | |
| 547 | void vtkAMRBox::RemoveGhosts(int r) |
| 548 | { |
no test coverage detected