------------------------------------------------------------------------------
| 1739 | |
| 1740 | //------------------------------------------------------------------------------ |
| 1741 | vtkStructuredAMRNeighbor vtkStructuredAMRGridConnectivity::GetAMRNeighbor(int vtkNotUsed(i), |
| 1742 | int iLevel, int next1[6], int j, int jLevel, int next2[6], int normalizedLevel, int levelDiff, |
| 1743 | vtkStructuredNeighbor& nei) |
| 1744 | { |
| 1745 | // STEP 0: Get the overlap extent data-description & dimension |
| 1746 | int overlapDim = vtkStructuredData::GetDataDimension(nei.OverlapExtent); |
| 1747 | |
| 1748 | // STEP 1: Get orientation vector and ndim for the domain which is used to |
| 1749 | // determine which dimensions of the overlap extent to refine/coarsen as |
| 1750 | // necessary. |
| 1751 | int ndim = 0; |
| 1752 | int orient[3]; |
| 1753 | this->GetOrientationVector(this->DataDescription, orient, ndim); |
| 1754 | |
| 1755 | // STEP 2: Compute grid overlap extent (grid i) and nei overlap extent, i.e., |
| 1756 | // grid j. |
| 1757 | int gridOverlap[6]; |
| 1758 | int neiOverlap[6]; |
| 1759 | this->ComputeAMRNeighborOverlapExtents( |
| 1760 | iLevel, jLevel, normalizedLevel, nei, orient, ndim, gridOverlap, neiOverlap); |
| 1761 | |
| 1762 | // STEP 3: Detect relationship type |
| 1763 | int relationShip = vtkStructuredAMRNeighbor::UNDEFINED; |
| 1764 | if (iLevel == jLevel) |
| 1765 | { |
| 1766 | // If the grids are at the same level, the AMR hierarchy is valid iff they |
| 1767 | // are siblings. Hence, the grids should not be overlapping. A necessary |
| 1768 | // and sufficient condition for non-overlapping grids at the same level is |
| 1769 | // that their interface, i.e., overlap extent, will be a geometric object |
| 1770 | // whose dimensionality is one less the dimensionality of the domain. |
| 1771 | // For example, in 2-D the interface will be a 1-D line and in 3-D the |
| 1772 | // the interface will be a 2-D plane. |
| 1773 | assert("pre: Detected overlapping grids at the same level" && |
| 1774 | (overlapDim == this->DataDimension - 1)); |
| 1775 | relationShip = vtkStructuredAMRNeighbor::SAME_LEVEL_SIBLING; |
| 1776 | } // END if |
| 1777 | else if (iLevel < jLevel) |
| 1778 | { |
| 1779 | if (overlapDim == this->DataDimension - 1) |
| 1780 | { |
| 1781 | // Grid i is adjacent with a finder grid |
| 1782 | relationShip = vtkStructuredAMRNeighbor::COARSE_TO_FINE_SIBLING; |
| 1783 | } // END if |
| 1784 | else |
| 1785 | { |
| 1786 | // Grid j is a child of i |
| 1787 | // NOTE: child relationships can only differ by one level! |
| 1788 | if (levelDiff <= 1) |
| 1789 | { |
| 1790 | if (this->AreExtentsEqual(nei.OverlapExtent, next2)) |
| 1791 | { |
| 1792 | relationShip = vtkStructuredAMRNeighbor::CHILD; |
| 1793 | } |
| 1794 | else |
| 1795 | { |
| 1796 | relationShip = vtkStructuredAMRNeighbor::PARTIALLY_OVERLAPPING_CHILD; |
| 1797 | } |
| 1798 | } // END if levelDiff |
no test coverage detected