------------------------------------------------------------------------------
| 32 | |
| 33 | //------------------------------------------------------------------------------ |
| 34 | bool vtkAMRUtilities::HasPartiallyOverlappingGhostCells(vtkOverlappingAMR* amr) |
| 35 | { |
| 36 | assert("pre: input AMR data is nullptr" && (amr != nullptr)); |
| 37 | int numLevels = static_cast<int>(amr->GetNumberOfLevels()); |
| 38 | int levelIdx = numLevels - 1; |
| 39 | for (; levelIdx > 0; --levelIdx) |
| 40 | { |
| 41 | int r = amr->GetRefinementRatio(levelIdx); |
| 42 | unsigned int numDataSets = amr->GetNumberOfBlocks(levelIdx); |
| 43 | for (unsigned int dataIdx = 0; dataIdx < numDataSets; ++dataIdx) |
| 44 | { |
| 45 | const vtkAMRBox& myBox = amr->GetAMRBox(levelIdx, dataIdx); |
| 46 | const int* lo = myBox.GetLoCorner(); |
| 47 | int hi[3]; |
| 48 | myBox.GetValidHiCorner(hi); |
| 49 | vtkAMRBox coarsenedBox = myBox; |
| 50 | coarsenedBox.Coarsen(r); |
| 51 | |
| 52 | // Detecting partially overlapping boxes is based on the following: |
| 53 | // Cell location k at level L-1 holds the range [k*r,k*r+(r-1)] of |
| 54 | // level L, where r is the refinement ratio. Consequently, if the |
| 55 | // min extent of the box is greater than k*r or if the max extent |
| 56 | // of the box is less than k*r+(r-1), then the grid partially overlaps. |
| 57 | for (int i = 0; i < 3; ++i) |
| 58 | { |
| 59 | if (myBox.EmptyDimension(i)) |
| 60 | { |
| 61 | continue; |
| 62 | } |
| 63 | int minRange[2]; |
| 64 | minRange[0] = coarsenedBox.GetLoCorner()[i] * r; |
| 65 | minRange[1] = coarsenedBox.GetLoCorner()[i] * r + (r - 1); |
| 66 | if (lo[i] > minRange[0]) |
| 67 | { |
| 68 | return true; |
| 69 | } |
| 70 | |
| 71 | int coarseHi[3]; |
| 72 | coarsenedBox.GetValidHiCorner(coarseHi); |
| 73 | int maxRange[2]; |
| 74 | maxRange[0] = coarseHi[i] * r; |
| 75 | maxRange[1] = coarseHi[i] * r + (r - 1); |
| 76 | if (hi[i] < maxRange[1]) |
| 77 | { |
| 78 | return true; |
| 79 | } |
| 80 | } // END for all dimensions |
| 81 | |
| 82 | } // END for all data at the current level |
| 83 | } // END for all levels |
| 84 | return false; |
| 85 | } |
| 86 | |
| 87 | //------------------------------------------------------------------------------ |
| 88 | void vtkAMRUtilities::CopyFieldData( |
nothing calls this directly
no test coverage detected