------------------------------------------------------------------------------
| 789 | |
| 790 | //------------------------------------------------------------------------------ |
| 791 | inline void vtkStructuredGridConnectivity::DetermineNeighborOrientation( |
| 792 | int idx, int A[2], int B[2], int overlap[2], int orient[3]) |
| 793 | { |
| 794 | assert("pre: idx is out-of-bounds" && (idx >= 0) && (idx < 3)); |
| 795 | |
| 796 | // A. Non-overlapping cases |
| 797 | if (overlap[0] == overlap[1]) |
| 798 | { |
| 799 | if (A[1] == B[0]) |
| 800 | { |
| 801 | orient[idx] = vtkStructuredNeighbor::HI; |
| 802 | } |
| 803 | else if (A[0] == B[1]) |
| 804 | { |
| 805 | orient[idx] = vtkStructuredNeighbor::LO; |
| 806 | } |
| 807 | else |
| 808 | { |
| 809 | orient[idx] = vtkStructuredNeighbor::UNDEFINED; |
| 810 | assert("ERROR: Code should not reach here!" && false); |
| 811 | } |
| 812 | } // END non-overlapping cases |
| 813 | // B. Sub-set cases |
| 814 | else if (this->IsSubset(A, B)) |
| 815 | { |
| 816 | if ((A[0] == B[0]) && (A[1] == B[1])) |
| 817 | { |
| 818 | orient[idx] = vtkStructuredNeighbor::ONE_TO_ONE; |
| 819 | } |
| 820 | else if (this->StrictlyInsideBounds(A[0], B[0], B[1]) && |
| 821 | this->StrictlyInsideBounds(A[1], B[0], B[1])) |
| 822 | { |
| 823 | orient[idx] = vtkStructuredNeighbor::SUBSET_BOTH; |
| 824 | } |
| 825 | else if (A[0] == B[0]) |
| 826 | { |
| 827 | orient[idx] = vtkStructuredNeighbor::SUBSET_HI; |
| 828 | } |
| 829 | else if (A[1] == B[1]) |
| 830 | { |
| 831 | orient[idx] = vtkStructuredNeighbor::SUBSET_LO; |
| 832 | } |
| 833 | else |
| 834 | { |
| 835 | orient[idx] = vtkStructuredNeighbor::UNDEFINED; |
| 836 | assert("ERROR: Code should not reach here!" && false); |
| 837 | } |
| 838 | } |
| 839 | // C. Super-set cases |
| 840 | else if (this->IsSubset(B, A)) |
| 841 | { |
| 842 | orient[idx] = vtkStructuredNeighbor::SUPERSET; |
| 843 | } |
| 844 | // D. Partially-overlapping (non-subset) cases |
| 845 | else if (!(this->IsSubset(A, B) || this->IsSubset(A, B))) |
| 846 | { |
| 847 | if (this->InBounds(A[0], B[0], B[1])) |
| 848 | { |
no test coverage detected