VTK  9.1.0
vtkStructuredGridConnectivity.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkStructuredGridConnectivity.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14 =========================================================================*/
29#ifndef vtkStructuredGridConnectivity_h
30#define vtkStructuredGridConnectivity_h
31
32#define VTK_NO_OVERLAP 0
33#define VTK_NODE_OVERLAP 1
34#define VTK_EDGE_OVERLAP 2
35#define VTK_PARTIAL_OVERLAP 3
36
37// VTK include directives
39#include "vtkFiltersGeometryModule.h" // For export macro
40#include "vtkStructuredData.h" // For data description definitions
41#include "vtkStructuredNeighbor.h" // For Structured Neighbor object definition
42
43// C++ include directives
44#include <cassert> // For assert()
45#include <iostream> // For cout
46#include <map> // For STL map
47#include <utility> // For STL pair and overloaded relational operators
48#include <vector> // For STL vector
49
50// Forward Declarations
51class vtkIdList;
53class vtkPointData;
54class vtkCellData;
55class vtkPoints;
56
57class VTKFILTERSGEOMETRY_EXPORT vtkStructuredGridConnectivity : public vtkAbstractGridConnectivity
58{
59public:
62 void PrintSelf(ostream& os, vtkIndent indent) override;
63
65
68 vtkSetVector6Macro(WholeExtent, int);
69 vtkGetVector6Macro(WholeExtent, int);
71
73
76 vtkGetMacro(DataDimension, int);
78
82 void SetNumberOfGrids(const unsigned int N) override;
83
88 virtual void RegisterGrid(const int gridID, int extents[6], vtkUnsignedCharArray* nodesGhostArray,
89 vtkUnsignedCharArray* cellGhostArray, vtkPointData* pointData, vtkCellData* cellData,
90 vtkPoints* gridNodes);
91
95 void GetGridExtent(const int gridID, int extent[6]);
96
101 void SetGhostedGridExtent(const int gridID, int ext[6]);
102
106 void GetGhostedGridExtent(const int gridID, int ext[6]);
107
111 void ComputeNeighbors() override;
112
117 int GetNumberOfNeighbors(const int gridID)
118 {
119 return (static_cast<int>(this->Neighbors[gridID].size()));
120 }
121
126 vtkStructuredNeighbor GetGridNeighbor(const int gridID, const int nei);
127
135 vtkIdList* GetNeighbors(const int gridID, int* extents);
136
143 const int gridID, vtkUnsignedCharArray* nodesArray, vtkUnsignedCharArray* cellsArray) override;
144
148 void CreateGhostLayers(const int N = 1) override;
149
150protected:
153
157 bool InBounds(const int idx, const int Lo, const int Hi) { return ((idx >= Lo) && (idx <= Hi)); }
158
162 bool StrictlyInsideBounds(const int idx, const int Lo, const int Hi)
163 {
164 return ((idx > Lo) && (idx < Hi));
165 }
166
170 bool IsSubset(int A[2], int B[2])
171 {
172 return (this->InBounds(A[0], B[0], B[1]) && this->InBounds(A[1], B[0], B[1]));
173 }
174
178 int Cardinality(int S[2]) { return (S[1] - S[0] + 1); }
179
181
184 int GetNumberOfNodesPerCell(const int dim)
185 {
186 int numNodes = 0;
187 switch (dim)
188 {
189 case 1:
190 numNodes = 2; // line cell
191 break;
192 case 2:
193 numNodes = 4; // quad cell
194 break;
195 case 3:
196 numNodes = 8; // hex cell
197 break;
198 default:
199 assert("ERROR: code should not reach here!" && false);
200 } // END switch
201 return (numNodes);
202 }
204
208 void FillNodesGhostArray(const int gridID, const int dataDescription, int GridExtent[6],
209 int RealExtent[6], vtkUnsignedCharArray* nodesArray);
210
214 void FillCellsGhostArray(const int dataDescription, const int numNodesPerCell, int dims[3],
215 int CellExtent[6], vtkUnsignedCharArray* nodesArray, vtkUnsignedCharArray* cellsArray);
216
222 void SearchNeighbors(const int gridID, const int i, const int j, const int k, vtkIdList* neiList);
223
228 void MarkNodeProperty(const int gridID, const int i, const int j, const int k, int ext[6],
229 int RealExtent[6], unsigned char& pfield);
230
235 void MarkCellProperty(unsigned char& pfield, unsigned char* nodeGhostFields, const int numNodes);
236
240 void GetRealExtent(const int gridID, int GridExtent[6], int RealExtent[6]);
241
246 bool IsGhostNode(int GridExtent[6], int RealExtent[6], const int i, const int j, const int k);
247
252 bool IsNodeOnBoundaryOfExtent(const int i, const int j, const int k, int ext[6]);
253
260 const int gridID, int RealExtent[6], const int i, const int j, const int k);
261
266 bool IsNodeOnBoundary(const int i, const int j, const int k);
267
272 bool IsNodeInterior(const int i, const int j, const int k, int GridExtent[6]);
273
278 bool IsNodeWithinExtent(const int i, const int j, const int k, int GridExtent[6])
279 {
280 bool status = false;
281
282 switch (this->DataDescription)
283 {
284 case VTK_X_LINE:
285 if ((GridExtent[0] <= i) && (i <= GridExtent[1]))
286 {
287 status = true;
288 }
289 break;
290 case VTK_Y_LINE:
291 if ((GridExtent[2] <= j) && (j <= GridExtent[3]))
292 {
293 status = true;
294 }
295 break;
296 case VTK_Z_LINE:
297 if ((GridExtent[4] <= k) && (k <= GridExtent[5]))
298 {
299 status = true;
300 }
301 break;
302 case VTK_XY_PLANE:
303 if ((GridExtent[0] <= i) && (i <= GridExtent[1]) && (GridExtent[2] <= j) &&
304 (j <= GridExtent[3]))
305 {
306 status = true;
307 }
308 break;
309 case VTK_YZ_PLANE:
310 if ((GridExtent[2] <= j) && (j <= GridExtent[3]) && (GridExtent[4] <= k) &&
311 (k <= GridExtent[5]))
312 {
313 status = true;
314 }
315 break;
316 case VTK_XZ_PLANE:
317 if ((GridExtent[0] <= i) && (i <= GridExtent[1]) && (GridExtent[4] <= k) &&
318 (k <= GridExtent[5]))
319 {
320 status = true;
321 }
322 break;
323 case VTK_XYZ_GRID:
324 if ((GridExtent[0] <= i) && (i <= GridExtent[1]) && (GridExtent[2] <= j) &&
325 (j <= GridExtent[3]) && (GridExtent[4] <= k) && (k <= GridExtent[5]))
326 {
327 status = true;
328 }
329 break;
330 default:
331 std::cout << "Data description is: " << this->DataDescription << "\n";
332 std::cout.flush();
333 assert("pre: Undefined data-description!" && false);
334 } // END switch
335
336 return (status);
337 }
338
343 const int i, const int j, int i2jOrientation[3], int j2iOrientation[3], int overlapExtent[6]);
344
353 void DetermineNeighborOrientation(
354 const int idx, int A[2], int B[2], int overlap[2], int orient[3]);
355
362 const int i, const int j, int ex1[6], int ex2[6], int orientation[3], int ndim);
363
373 int IntervalOverlap(int A[2], int B[2], int overlap[2]);
374
384 int DoPartialOverlap(int s[2], int S[2], int overlap[2]);
385
396 int A[2], const int CardinalityOfA, int B[2], const int CardinalityOfB, int overlap[2]);
397
402 void EstablishNeighbors(const int i, const int j);
403
409
424 bool HasBlockConnection(const int gridID, const int blockDirection);
425
440 void RemoveBlockConnection(const int gridID, const int blockDirection);
441
456 void AddBlockConnection(const int gridID, const int blockDirection);
457
462 void ClearBlockConnections(const int gridID);
463
471 int GetNumberOfConnectingBlockFaces(const int gridID);
472
476 void SetBlockTopology(const int gridID);
477
485 const int i, const int j, const int k, int ext[6], int orientation[3]);
486
491 int Get1DOrientation(const int idx, const int ExtentLo, const int ExtentHi, const int OnLo,
492 const int OnHi, const int NotOnBoundary);
493
498 void CreateGhostedExtent(const int gridID, const int N);
499
505 void GetGhostedExtent(
506 int* ghostedExtent, int GridExtent[6], const int minIdx, const int maxIdx, const int N);
507
512 void CreateGhostedMaskArrays(const int gridID);
513
520 void InitializeGhostData(const int gridID);
521
527 void AllocatePointData(vtkPointData* RPD, const int N, vtkPointData* PD);
528
534 void AllocateCellData(vtkCellData* RCD, const int N, vtkCellData* CD);
535
541
546 void ComputeNeighborSendAndRcvExtent(const int gridID, const int N);
547
553 virtual void TransferGhostDataFromNeighbors(const int gridID);
554
558 void TransferLocalNeighborData(const int gridID, const vtkStructuredNeighbor& Neighbor);
559
564 vtkPoints* source, vtkIdType sourceIdx, vtkPoints* target, vtkIdType targetIdx);
565
573 vtkFieldData* source, vtkIdType sourceIdx, vtkFieldData* target, vtkIdType targetIdx);
574
580 int GetNeighborIndex(const int gridIdx, const int NeighborGridIdx);
581
585 void PrintExtent(int extent[6]);
586
589 int WholeExtent[6];
590
591 std::vector<int> GridExtents;
592 std::vector<int> GhostedExtents;
593 std::vector<unsigned char> BlockTopology;
594 std::vector<std::vector<vtkStructuredNeighbor>> Neighbors;
595 std::map<std::pair<int, int>, int> NeighborPair2NeighborListIndex;
596
597private:
599 void operator=(const vtkStructuredGridConnectivity&) = delete;
600};
601
602//=============================================================================
603// INLINE METHODS
604//=============================================================================
605
606//------------------------------------------------------------------------------
608 const int gridIdx, const int NeighborGridIdx)
609{
610 assert("pre: Grid index is out-of-bounds!" && (gridIdx >= 0) &&
611 (gridIdx < static_cast<int>(this->NumberOfGrids)));
612 assert("pre: Neighbor grid index is out-of-bounds!" && (NeighborGridIdx >= 0) &&
613 (NeighborGridIdx < static_cast<int>(this->NumberOfGrids)));
614
615 std::pair<int, int> gridPair = std::make_pair(gridIdx, NeighborGridIdx);
616 assert("pre: Neighboring grid pair does not exist in hash!" &&
617 (this->NeighborPair2NeighborListIndex.find(gridPair) !=
618 this->NeighborPair2NeighborListIndex.end()));
619
620 return (this->NeighborPair2NeighborListIndex[gridPair]);
621}
622
623//------------------------------------------------------------------------------
625 int* ghostedExtent, int GridExtent[6], const int minIdx, const int maxIdx, const int N)
626{
627 assert("pre: Number of ghost layers must be N >= 1" && (N >= 1));
628 assert("pre: ghosted extent pointer is nullptr" && ghostedExtent != nullptr);
629
630 ghostedExtent[minIdx] = GridExtent[minIdx] - N;
631 ghostedExtent[maxIdx] = GridExtent[maxIdx] + N;
632
633 // Clamp the ghosted extent to be within the WholeExtent
634 ghostedExtent[minIdx] = (ghostedExtent[minIdx] < this->WholeExtent[minIdx])
635 ? this->WholeExtent[minIdx]
636 : ghostedExtent[minIdx];
637 ghostedExtent[maxIdx] = (ghostedExtent[maxIdx] > this->WholeExtent[maxIdx])
638 ? this->WholeExtent[maxIdx]
639 : ghostedExtent[maxIdx];
640}
641
642//------------------------------------------------------------------------------
643inline void vtkStructuredGridConnectivity::SetGhostedGridExtent(const int gridID, int ext[6])
644{
645 assert("pre: gridID is out-of-bounds" && (gridID >= 0) &&
646 (gridID < static_cast<int>(this->NumberOfGrids)));
647 assert("pre: ghosted-extents vector has not been allocated" &&
648 (this->NumberOfGrids == this->GhostedExtents.size() / 6));
649
650 for (int i = 0; i < 6; ++i)
651 {
652 this->GhostedExtents[gridID * 6 + i] = ext[i];
653 }
654}
655
656//------------------------------------------------------------------------------
657inline void vtkStructuredGridConnectivity::GetGridExtent(const int gridID, int ext[6])
658{
659 assert("pre: gridID out-of-bounds!" &&
660 (gridID >= 0 && gridID < static_cast<int>(this->NumberOfGrids)));
661 for (int i = 0; i < 6; ++i)
662 {
663 ext[i] = this->GridExtents[gridID * 6 + i];
664 }
665}
666
667//------------------------------------------------------------------------------
668inline void vtkStructuredGridConnectivity::GetGhostedGridExtent(const int gridID, int ext[6])
669{
670 assert("pre: gridID out-of-bounds!" &&
671 (gridID >= 0 && gridID < static_cast<int>(this->NumberOfGrids)));
672
673 if (this->GhostedExtents.empty())
674 {
675 ext[0] = ext[2] = ext[4] = -1;
676 ext[1] = ext[3] = ext[5] = 0;
677 vtkErrorMacro("No ghosted extents found for registered grid extends!!!");
678 return;
679 }
680
681 assert("GhostedExtents are not aligned with registered grid extents" &&
682 (this->GhostedExtents.size() == this->GridExtents.size()));
683 for (int i = 0; i < 6; ++i)
684 {
685 ext[i] = this->GhostedExtents[gridID * 6 + i];
686 }
687}
688
689//------------------------------------------------------------------------------
691 const int i, const int j, const int k, int ext[6])
692{
693 if (!this->IsNodeWithinExtent(i, j, k, ext))
694 {
695 return false;
696 }
697
698 bool status = false;
699 switch (this->DataDescription)
700 {
701 case VTK_X_LINE:
702 if (i == ext[0] || i == ext[1])
703 {
704 status = true;
705 }
706 break;
707 case VTK_Y_LINE:
708 if (j == ext[2] || j == ext[3])
709 {
710 status = true;
711 }
712 break;
713 case VTK_Z_LINE:
714 if (k == ext[4] || k == ext[5])
715 {
716 status = true;
717 }
718 break;
719 case VTK_XY_PLANE:
720 if ((i == ext[0] || i == ext[1]) || (j == ext[2] || j == ext[3]))
721 {
722 status = true;
723 }
724 break;
725 case VTK_YZ_PLANE:
726 if ((j == ext[2] || j == ext[3]) || (k == ext[4] || k == ext[5]))
727 {
728 status = true;
729 }
730 break;
731 case VTK_XZ_PLANE:
732 if ((i == ext[0] || i == ext[1]) || (k == ext[4] || k == ext[5]))
733 {
734 status = true;
735 }
736 break;
737 case VTK_XYZ_GRID:
738 if ((i == ext[0] || i == ext[1]) || (j == ext[2] || j == ext[3]) ||
739 (k == ext[4] || k == ext[5]))
740 {
741 status = true;
742 }
743 break;
744 default:
745 std::cout << "Data description is: " << this->DataDescription << "\n";
746 std::cout.flush();
747 assert("pre: Undefined data-description!" && false);
748 } // END switch
749
750 return (status);
751}
752
753//------------------------------------------------------------------------------
755 const int i, const int j, const int k, int GridExtent[6])
756{
757 bool status = false;
758
759 switch (this->DataDescription)
760 {
761 case VTK_X_LINE:
762 if ((GridExtent[0] < i) && (i < GridExtent[1]))
763 {
764 status = true;
765 }
766 break;
767 case VTK_Y_LINE:
768 if ((GridExtent[2] < j) && (j < GridExtent[3]))
769 {
770 status = true;
771 }
772 break;
773 case VTK_Z_LINE:
774 if ((GridExtent[4] < k) && (k < GridExtent[5]))
775 {
776 status = true;
777 }
778 break;
779 case VTK_XY_PLANE:
780 if ((GridExtent[0] < i) && (i < GridExtent[1]) && (GridExtent[2] < j) && (j < GridExtent[3]))
781 {
782 status = true;
783 }
784 break;
785 case VTK_YZ_PLANE:
786 if ((GridExtent[2] < j) && (j < GridExtent[3]) && (GridExtent[4] < k) && (k < GridExtent[5]))
787 {
788 status = true;
789 }
790 break;
791 case VTK_XZ_PLANE:
792 if ((GridExtent[0] < i) && (i < GridExtent[1]) && (GridExtent[4] < k) && (k < GridExtent[5]))
793 {
794 status = true;
795 }
796 break;
797 case VTK_XYZ_GRID:
798 if ((GridExtent[0] < i) && (i < GridExtent[1]) && (GridExtent[2] < j) &&
799 (j < GridExtent[3]) && (GridExtent[4] < k) && (k < GridExtent[5]))
800 {
801 status = true;
802 }
803 break;
804 default:
805 std::cout << "Data description is: " << this->DataDescription << "\n";
806 std::cout.flush();
807 assert("pre: Undefined data-description!" && false);
808 } // END switch
809
810 return (status);
811}
812
813//------------------------------------------------------------------------------
815 const int idx, int A[2], int B[2], int overlap[2], int orient[3])
816{
817 assert("pre: idx is out-of-bounds" && (idx >= 0) && (idx < 3));
818
819 // A. Non-overlapping cases
820 if (overlap[0] == overlap[1])
821 {
822 if (A[1] == B[0])
823 {
824 orient[idx] = vtkStructuredNeighbor::HI;
825 }
826 else if (A[0] == B[1])
827 {
828 orient[idx] = vtkStructuredNeighbor::LO;
829 }
830 else
831 {
833 assert("ERROR: Code should not reach here!" && false);
834 }
835 } // END non-overlapping cases
836 // B. Sub-set cases
837 else if (this->IsSubset(A, B))
838 {
839 if ((A[0] == B[0]) && (A[1] == B[1]))
840 {
842 }
843 else if (this->StrictlyInsideBounds(A[0], B[0], B[1]) &&
844 this->StrictlyInsideBounds(A[1], B[0], B[1]))
845 {
847 }
848 else if (A[0] == B[0])
849 {
851 }
852 else if (A[1] == B[1])
853 {
855 }
856 else
857 {
859 assert("ERROR: Code should not reach here!" && false);
860 }
861 }
862 // C. Super-set cases
863 else if (this->IsSubset(B, A))
864 {
866 }
867 // D. Partially-overlapping (non-subset) cases
868 else if (!(this->IsSubset(A, B) || this->IsSubset(A, B)))
869 {
870 if (this->InBounds(A[0], B[0], B[1]))
871 {
872 orient[idx] = vtkStructuredNeighbor::LO;
873 }
874 else if (this->InBounds(A[1], B[0], B[1]))
875 {
876 orient[idx] = vtkStructuredNeighbor::HI;
877 }
878 else
879 {
881 assert("ERROR: Code should not reach here!" && false);
882 }
883 }
884 else
885 {
887 assert("ERROR: Code should not reach here!" && false);
888 }
889}
890
891//------------------------------------------------------------------------------
892inline int vtkStructuredGridConnectivity::Get1DOrientation(const int idx, const int ExtentLo,
893 const int ExtentHi, const int OnLo, const int OnHi, const int NotOnBoundary)
894{
895 if (idx == ExtentLo)
896 {
897 return OnLo;
898 }
899 else if (idx == ExtentHi)
900 {
901 return OnHi;
902 }
903 return NotOnBoundary;
904}
905
906//------------------------------------------------------------------------------
908 const int gridID, const int blockDirection)
909{
910 // Sanity check
911 assert("pre: gridID is out-of-bounds" && (gridID >= 0) &&
912 (gridID < static_cast<int>(this->NumberOfGrids)));
913 assert("pre: BlockTopology has not been properly allocated" &&
914 (this->NumberOfGrids == this->BlockTopology.size()));
915 assert("pre: blockDirection is out-of-bounds" && (blockDirection >= 0) && (blockDirection < 6));
916 bool status = false;
917 if (this->BlockTopology[gridID] & (1 << blockDirection))
918 {
919 status = true;
920 }
921 return (status);
922}
923
924//------------------------------------------------------------------------------
926 const int gridID, const int blockDirection)
927{
928 // Sanity check
929 assert("pre: gridID is out-of-bounds" && (gridID >= 0) &&
930 (gridID < static_cast<int>(this->NumberOfGrids)));
931 assert("pre: BlockTopology has not been properly allocated" &&
932 (this->NumberOfGrids == this->BlockTopology.size()));
933 assert("pre: blockDirection is out-of-bounds" && (blockDirection >= 0) && (blockDirection < 6));
934
935 this->BlockTopology[gridID] &= ~(1 << blockDirection);
936}
937
938//------------------------------------------------------------------------------
940 const int gridID, const int blockDirection)
941{
942 // Sanity check
943 assert("pre: gridID is out-of-bounds" && (gridID >= 0) &&
944 (gridID < static_cast<int>(this->NumberOfGrids)));
945 assert("pre: BlockTopology has not been properly allocated" &&
946 (this->NumberOfGrids == this->BlockTopology.size()));
947 assert("pre: blockDirection is out-of-bounds" && (blockDirection >= 0) && (blockDirection < 6));
948 this->BlockTopology[gridID] |= (1 << blockDirection);
949}
950
951//------------------------------------------------------------------------------
953{
954 // Sanity check
955 assert("pre: gridID is out-of-bounds" && (gridID >= 0) &&
956 (gridID < static_cast<int>(this->NumberOfGrids)));
957 assert("pre: BlockTopology has not been properly allocated" &&
958 (this->NumberOfGrids == this->BlockTopology.size()));
959 for (int i = 0; i < 6; ++i)
960 {
961 this->RemoveBlockConnection(gridID, i);
962 } // END for all block directions
963}
964
965//------------------------------------------------------------------------------
967{
968 // Sanity check
969 assert("pre: gridID is out-of-bounds" && (gridID >= 0) &&
970 (gridID < static_cast<int>(this->NumberOfGrids)));
971 assert("pre: BlockTopology has not been properly allocated" &&
972 (this->NumberOfGrids == this->BlockTopology.size()));
973
974 int count = 0;
975 for (int i = 0; i < 6; ++i)
976 {
977 if (this->HasBlockConnection(gridID, i))
978 {
979 ++count;
980 }
981 }
982 assert("post: count must be in [0,5]" && (count >= 0 && count <= 6));
983 return (count);
984}
985
986//------------------------------------------------------------------------------
987inline void vtkStructuredGridConnectivity::SetNumberOfGrids(const unsigned int N)
988{
989 if (N == 0)
990 {
991 vtkErrorMacro("Number of grids cannot be 0.");
992 return;
993 }
994
995 this->NumberOfGrids = N;
997
998 this->GridExtents.resize(6 * N, -1);
999 this->Neighbors.resize(N);
1000 this->BlockTopology.resize(N);
1001}
1002#endif /* vtkStructuredGridConnectivity_h */
A superclass that defines the interface to be implemented by all concrete grid connectivity classes.
void AllocateUserRegisterDataStructures()
Allocate/De-allocate the data-structures where the user-supplied grids will be registered.
virtual void SetNumberOfGrids(const unsigned int N)=0
Sets the total number of grids in the domain.
represent and manipulate cell attribute data
Definition: vtkCellData.h:142
represent and manipulate fields of data
Definition: vtkFieldData.h:164
list of point or cell ids
Definition: vtkIdList.h:140
a simple class to control print indentation
Definition: vtkIndent.h:113
represent and manipulate point attribute data
Definition: vtkPointData.h:142
represent and manipulate 3D points
Definition: vtkPoints.h:143
vtkStructuredGridConnectivity is a concrete instance of vtkObject that implements functionality for c...
void ComputeNeighborSendAndRcvExtent(const int gridID, const int N)
This method computes, the send and rcv extents for each neighbor of each grid.
bool IsSubset(int A[2], int B[2])
Returns true iff A is a subset of B, otherwise false.
vtkStructuredNeighbor GetGridNeighbor(const int gridID, const int nei)
Returns the neighbor corresponding to the index nei for the grid with the given (global) grid ID.
~vtkStructuredGridConnectivity() override
void SetBlockTopology(const int gridID)
Sets the block topology connections for the grid corresponding to gridID.
void AllocateCellData(vtkCellData *RCD, const int N, vtkCellData *CD)
Adds/creates all the arrays in the reference grid cell data, RCD, to the user-supplied cell data inst...
void GetIJKBlockOrientation(const int i, const int j, const int k, int ext[6], int orientation[3])
Given i-j-k coordinates and the grid defined by tis extent, ext, this method determines IJK orientati...
void CopyFieldData(vtkFieldData *source, vtkIdType sourceIdx, vtkFieldData *target, vtkIdType targetIdx)
Loops through all arrays in the source and for each array, it copies the tuples from sourceIdx to the...
void CreateGhostedMaskArrays(const int gridID)
This method creates the ghosted mask arrays, i.e., the NodeGhostArrays and the CellGhostArrays for th...
bool IsNodeInterior(const int i, const int j, const int k, int GridExtent[6])
Checks if the node, corresponding to the given global i,j,k coordinates is within the interior of the...
void FillNodesGhostArray(const int gridID, const int dataDescription, int GridExtent[6], int RealExtent[6], vtkUnsignedCharArray *nodesArray)
Fills the ghost array for the nodes.
void CreateGhostedExtent(const int gridID, const int N)
Creates the ghosted extent of the grid corresponding to the given gridID.
void CreateGhostLayers(const int N=1) override
Creates ghost layers.
void SetGhostedGridExtent(const int gridID, int ext[6])
Sets the ghosted grid extent for the grid corresponding to the given grid ID to the given extent.
void EstablishNeighbors(const int i, const int j)
Establishes the neighboring information between the two grids corresponding to grid ids "i" and "j" w...
void PrintExtent(int extent[6])
Prints the extent, used for debugging.
void SetNeighbors(const int i, const int j, int i2jOrientation[3], int j2iOrientation[3], int overlapExtent[6])
Creates a neighbor from i-to-j and from j-to-i.
void TransferRegisteredDataToGhostedData(const int gridID)
This method transfers the registered grid data to the corresponding ghosted grid data.
void TransferLocalNeighborData(const int gridID, const vtkStructuredNeighbor &Neighbor)
This method transfers the fields.
void GetRealExtent(const int gridID, int GridExtent[6], int RealExtent[6])
Given a grid extent, this method computes the RealExtent.
void GetGhostedExtent(int *ghostedExtent, int GridExtent[6], const int minIdx, const int maxIdx, const int N)
Gets the ghosted extent from the given grid extent along the dimension given by minIdx and maxIdx.
virtual void RegisterGrid(const int gridID, int extents[6], vtkUnsignedCharArray *nodesGhostArray, vtkUnsignedCharArray *cellGhostArray, vtkPointData *pointData, vtkCellData *cellData, vtkPoints *gridNodes)
Registers the current grid corresponding to the grid ID by its global extent w.r.t.
bool HasBlockConnection(const int gridID, const int blockDirection)
Checks if the block corresponding to the given grid ID has a block adjacent to it in the given block ...
int Cardinality(int S[2])
Returns the cardinality of a range S.
void ComputeNeighbors() override
Computes neighboring information.
void SearchNeighbors(const int gridID, const int i, const int j, const int k, vtkIdList *neiList)
Given a point (i,j,k) belonging to the grid corresponding to the given gridID, this method searches f...
bool IsGhostNode(int GridExtent[6], int RealExtent[6], const int i, const int j, const int k)
Checks if the node corresponding to the given global i,j,k coordinates is a ghost node or not.
void MarkNodeProperty(const int gridID, const int i, const int j, const int k, int ext[6], int RealExtent[6], unsigned char &pfield)
Marks the node properties with the node with the given global i,j,k grid coordinates w....
void ClearBlockConnections(const int gridID)
Clears all block connections for the block corresponding to the given grid ID.
void MarkCellProperty(unsigned char &pfield, unsigned char *nodeGhostFields, const int numNodes)
Marks the cell property for the cell composed by the nodes with the given ghost fields.
bool IsNodeOnBoundary(const int i, const int j, const int k)
Checks if the node corresponding to the given global i,j,k coordinates touches the real boundaries of...
void AllocatePointData(vtkPointData *RPD, const int N, vtkPointData *PD)
Adds/creates all the arrays in the reference grid point data, RPD, to the user-supplied point data in...
bool IsNodeOnSharedBoundary(const int gridID, int RealExtent[6], const int i, const int j, const int k)
Checks if the node corresponding to the given global i,j,k coordinates is on the shared boundary,...
virtual void TransferGhostDataFromNeighbors(const int gridID)
This method transfers the fields (point data and cell data) to the ghost extents from the neighboring...
std::vector< unsigned char > BlockTopology
void FillGhostArrays(const int gridID, vtkUnsignedCharArray *nodesArray, vtkUnsignedCharArray *cellsArray) override
Fills the mesh property arrays, nodes and cells, for the grid corresponding to the given grid ID.
void AddBlockConnection(const int gridID, const int blockDirection)
Adds a block connection along the given direction for the block corresponding to the given gridID.
int GetNeighborIndex(const int gridIdx, const int NeighborGridIdx)
Given a global grid ID and the neighbor grid ID, this method returns the neighbor index w....
void DetectNeighbors(const int i, const int j, int ex1[6], int ex2[6], int orientation[3], int ndim)
Detects if the two extents, ex1 and ex2, corresponding to the grids with grid IDs i,...
void CopyCoordinates(vtkPoints *source, vtkIdType sourceIdx, vtkPoints *target, vtkIdType targetIdx)
Copies the coordinates from the source points to the target points.
void RemoveBlockConnection(const int gridID, const int blockDirection)
Removes a block connection along the given direction for the block corresponding to the given gridID.
bool IsNodeOnBoundaryOfExtent(const int i, const int j, const int k, int ext[6])
Checks if the node corresponding to the given global i,j,k coordinates is on the boundary of the give...
void GetGridExtent(const int gridID, int extent[6])
Returns the grid extent of the grid corresponding to the given grid ID.
bool InBounds(const int idx, const int Lo, const int Hi)
Returns true iff Lo <= idx <= Hi, otherwise false.
std::map< std::pair< int, int >, int > NeighborPair2NeighborListIndex
void GetGhostedGridExtent(const int gridID, int ext[6])
Returns the ghosted grid extent for the block corresponding the.
void InitializeGhostData(const int gridID)
This method initializes the ghost data according to the computed ghosted grid extent for the grid wit...
int PartialOverlap(int A[2], const int CardinalityOfA, int B[2], const int CardinalityOfB, int overlap[2])
Checks if the intervals A,B partially overlap.
bool StrictlyInsideBounds(const int idx, const int Lo, const int Hi)
Returns true iff Lo < idx < Hi, otherwise false.
vtkIdList * GetNeighbors(const int gridID, int *extents)
Returns the list of neighboring blocks for the given grid and the corresponding overlapping extents a...
void DetermineNeighborOrientation(const int idx, int A[2], int B[2], int overlap[2], int orient[3])
Given two overlapping extents A,B and the corresponding overlap extent this method computes A's relat...
void FillCellsGhostArray(const int dataDescription, const int numNodesPerCell, int dims[3], int CellExtent[6], vtkUnsignedCharArray *nodesArray, vtkUnsignedCharArray *cellsArray)
Fills the ghost array for the grid cells.
int DoPartialOverlap(int s[2], int S[2], int overlap[2])
Checks if the internals s,S partially overlap where |s| < |S|.
bool IsNodeWithinExtent(const int i, const int j, const int k, int GridExtent[6])
Checks if the node corresponding to the given global i,j,k coordinates is within the given extent,...
int GetNumberOfNodesPerCell(const int dim)
Returns the number of nodes per cell according to the given dimension.
std::vector< std::vector< vtkStructuredNeighbor > > Neighbors
static vtkStructuredGridConnectivity * New()
int IntervalOverlap(int A[2], int B[2], int overlap[2])
Checks if the intervals A,B overlap.
int GetNumberOfNeighbors(const int gridID)
Returns the number of neighbors for the grid corresponding to the given grid ID.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int GetNumberOfConnectingBlockFaces(const int gridID)
Returns the number of faces of the block corresponding to the given grid ID that are adjacent to at l...
int Get1DOrientation(const int idx, const int ExtentLo, const int ExtentHi, const int OnLo, const int OnHi, const int NotOnBoundary)
A helper method that computes the 1-D i-j-k orientation to facilitate the implementation of GetNodeBl...
void AcquireDataDescription()
Based on the user-supplied WholeExtent, this method determines the topology of the structured domain,...
void SetNumberOfGrids(const unsigned int N) override
Set/Get the total number of domains distributed among processors.
An internal, light-weight class used to store neighbor information.
dynamic, self-adjusting array of unsigned char
@ orientation
Definition: vtkX3D.h:268
@ extent
Definition: vtkX3D.h:351
@ size
Definition: vtkX3D.h:259
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
#define VTK_Y_LINE
#define VTK_XY_PLANE
#define VTK_YZ_PLANE
#define VTK_X_LINE
#define VTK_Z_LINE
#define VTK_XZ_PLANE
#define VTK_XYZ_GRID
int vtkIdType
Definition: vtkType.h:332