VTK  9.2.6
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 =========================================================================*/
32#ifndef vtkStructuredGridConnectivity_h
33#define vtkStructuredGridConnectivity_h
34
35#define VTK_NO_OVERLAP 0
36#define VTK_NODE_OVERLAP 1
37#define VTK_EDGE_OVERLAP 2
38#define VTK_PARTIAL_OVERLAP 3
39
40// VTK include directives
42#include "vtkFiltersGeometryModule.h" // For export macro
43#include "vtkStructuredData.h" // For data description definitions
44#include "vtkStructuredNeighbor.h" // For Structured Neighbor object definition
45
46// C++ include directives
47#include <cassert> // For assert()
48#include <iostream> // For cout
49#include <map> // For STL map
50#include <utility> // For STL pair and overloaded relational operators
51#include <vector> // For STL vector
52
53// Forward Declarations
54class vtkIdList;
56class vtkPointData;
57class vtkCellData;
58class vtkPoints;
59
60class VTKFILTERSGEOMETRY_EXPORT vtkStructuredGridConnectivity : public vtkAbstractGridConnectivity
61{
62public:
65 void PrintSelf(ostream& os, vtkIndent indent) override;
66
68
71 vtkSetVector6Macro(WholeExtent, int);
72 vtkGetVector6Macro(WholeExtent, int);
74
76
79 vtkGetMacro(DataDimension, int);
81
85 void SetNumberOfGrids(const unsigned int N) override;
86
91 virtual void RegisterGrid(const int gridID, int extents[6], vtkUnsignedCharArray* nodesGhostArray,
92 vtkUnsignedCharArray* cellGhostArray, vtkPointData* pointData, vtkCellData* cellData,
93 vtkPoints* gridNodes);
94
98 void GetGridExtent(const int gridID, int extent[6]);
99
104 void SetGhostedGridExtent(const int gridID, int ext[6]);
105
109 void GetGhostedGridExtent(const int gridID, int ext[6]);
110
114 void ComputeNeighbors() override;
115
120 int GetNumberOfNeighbors(const int gridID)
121 {
122 return (static_cast<int>(this->Neighbors[gridID].size()));
123 }
124
129 vtkStructuredNeighbor GetGridNeighbor(const int gridID, const int nei);
130
138 vtkIdList* GetNeighbors(const int gridID, int* extents);
139
146 const int gridID, vtkUnsignedCharArray* nodesArray, vtkUnsignedCharArray* cellsArray) override;
147
151 void CreateGhostLayers(const int N = 1) override;
152
153protected:
156
160 bool InBounds(const int idx, const int Lo, const int Hi) { return ((idx >= Lo) && (idx <= Hi)); }
161
165 bool StrictlyInsideBounds(const int idx, const int Lo, const int Hi)
166 {
167 return ((idx > Lo) && (idx < Hi));
168 }
169
173 bool IsSubset(int A[2], int B[2])
174 {
175 return (this->InBounds(A[0], B[0], B[1]) && this->InBounds(A[1], B[0], B[1]));
176 }
177
181 int Cardinality(int S[2]) { return (S[1] - S[0] + 1); }
182
184
187 int GetNumberOfNodesPerCell(const int dim)
188 {
189 int numNodes = 0;
190 switch (dim)
191 {
192 case 1:
193 numNodes = 2; // line cell
194 break;
195 case 2:
196 numNodes = 4; // quad cell
197 break;
198 case 3:
199 numNodes = 8; // hex cell
200 break;
201 default:
202 assert("ERROR: code should not reach here!" && false);
203 } // END switch
204 return (numNodes);
205 }
207
211 void FillNodesGhostArray(const int gridID, const int dataDescription, int GridExtent[6],
212 int RealExtent[6], vtkUnsignedCharArray* nodesArray);
213
217 void FillCellsGhostArray(const int dataDescription, const int numNodesPerCell, int dims[3],
218 int CellExtent[6], vtkUnsignedCharArray* nodesArray, vtkUnsignedCharArray* cellsArray);
219
225 void SearchNeighbors(const int gridID, const int i, const int j, const int k, vtkIdList* neiList);
226
231 void MarkNodeProperty(const int gridID, const int i, const int j, const int k, int ext[6],
232 int RealExtent[6], unsigned char& pfield);
233
238 void MarkCellProperty(unsigned char& pfield, unsigned char* nodeGhostFields, const int numNodes);
239
243 void GetRealExtent(const int gridID, int GridExtent[6], int RealExtent[6]);
244
249 bool IsGhostNode(int GridExtent[6], int RealExtent[6], const int i, const int j, const int k);
250
255 bool IsNodeOnBoundaryOfExtent(const int i, const int j, const int k, int ext[6]);
256
263 const int gridID, int RealExtent[6], const int i, const int j, const int k);
264
269 bool IsNodeOnBoundary(const int i, const int j, const int k);
270
275 bool IsNodeInterior(const int i, const int j, const int k, int GridExtent[6]);
276
281 bool IsNodeWithinExtent(const int i, const int j, const int k, int GridExtent[6])
282 {
283 bool status = false;
284
285 switch (this->DataDescription)
286 {
287 case VTK_X_LINE:
288 if ((GridExtent[0] <= i) && (i <= GridExtent[1]))
289 {
290 status = true;
291 }
292 break;
293 case VTK_Y_LINE:
294 if ((GridExtent[2] <= j) && (j <= GridExtent[3]))
295 {
296 status = true;
297 }
298 break;
299 case VTK_Z_LINE:
300 if ((GridExtent[4] <= k) && (k <= GridExtent[5]))
301 {
302 status = true;
303 }
304 break;
305 case VTK_XY_PLANE:
306 if ((GridExtent[0] <= i) && (i <= GridExtent[1]) && (GridExtent[2] <= j) &&
307 (j <= GridExtent[3]))
308 {
309 status = true;
310 }
311 break;
312 case VTK_YZ_PLANE:
313 if ((GridExtent[2] <= j) && (j <= GridExtent[3]) && (GridExtent[4] <= k) &&
314 (k <= GridExtent[5]))
315 {
316 status = true;
317 }
318 break;
319 case VTK_XZ_PLANE:
320 if ((GridExtent[0] <= i) && (i <= GridExtent[1]) && (GridExtent[4] <= k) &&
321 (k <= GridExtent[5]))
322 {
323 status = true;
324 }
325 break;
326 case VTK_XYZ_GRID:
327 if ((GridExtent[0] <= i) && (i <= GridExtent[1]) && (GridExtent[2] <= j) &&
328 (j <= GridExtent[3]) && (GridExtent[4] <= k) && (k <= GridExtent[5]))
329 {
330 status = true;
331 }
332 break;
333 default:
334 std::cout << "Data description is: " << this->DataDescription << "\n";
335 std::cout.flush();
336 assert("pre: Undefined data-description!" && false);
337 } // END switch
338
339 return (status);
340 }
341
346 const int i, const int j, int i2jOrientation[3], int j2iOrientation[3], int overlapExtent[6]);
347
356 void DetermineNeighborOrientation(
357 const int idx, int A[2], int B[2], int overlap[2], int orient[3]);
358
365 const int i, const int j, int ex1[6], int ex2[6], int orientation[3], int ndim);
366
376 int IntervalOverlap(int A[2], int B[2], int overlap[2]);
377
387 int DoPartialOverlap(int s[2], int S[2], int overlap[2]);
388
399 int A[2], const int CardinalityOfA, int B[2], const int CardinalityOfB, int overlap[2]);
400
405 void EstablishNeighbors(const int i, const int j);
406
412
427 bool HasBlockConnection(const int gridID, const int blockDirection);
428
443 void RemoveBlockConnection(const int gridID, const int blockDirection);
444
459 void AddBlockConnection(const int gridID, const int blockDirection);
460
465 void ClearBlockConnections(const int gridID);
466
474 int GetNumberOfConnectingBlockFaces(const int gridID);
475
479 void SetBlockTopology(const int gridID);
480
488 const int i, const int j, const int k, int ext[6], int orientation[3]);
489
494 int Get1DOrientation(const int idx, const int ExtentLo, const int ExtentHi, const int OnLo,
495 const int OnHi, const int NotOnBoundary);
496
501 void CreateGhostedExtent(const int gridID, const int N);
502
508 void GetGhostedExtent(
509 int* ghostedExtent, int GridExtent[6], const int minIdx, const int maxIdx, const int N);
510
515 void CreateGhostedMaskArrays(const int gridID);
516
523 void InitializeGhostData(const int gridID);
524
530 void AllocatePointData(vtkPointData* RPD, const int N, vtkPointData* PD);
531
537 void AllocateCellData(vtkCellData* RCD, const int N, vtkCellData* CD);
538
544
549 void ComputeNeighborSendAndRcvExtent(const int gridID, const int N);
550
556 virtual void TransferGhostDataFromNeighbors(const int gridID);
557
561 void TransferLocalNeighborData(const int gridID, const vtkStructuredNeighbor& Neighbor);
562
567 vtkPoints* source, vtkIdType sourceIdx, vtkPoints* target, vtkIdType targetIdx);
568
576 vtkFieldData* source, vtkIdType sourceIdx, vtkFieldData* target, vtkIdType targetIdx);
577
583 int GetNeighborIndex(const int gridIdx, const int NeighborGridIdx);
584
588 void PrintExtent(int extent[6]);
589
592 int WholeExtent[6];
593
594 std::vector<int> GridExtents;
595 std::vector<int> GhostedExtents;
596 std::vector<unsigned char> BlockTopology;
597 std::vector<std::vector<vtkStructuredNeighbor>> Neighbors;
598 std::map<std::pair<int, int>, int> NeighborPair2NeighborListIndex;
599
600private:
602 void operator=(const vtkStructuredGridConnectivity&) = delete;
603};
604
605//=============================================================================
606// INLINE METHODS
607//=============================================================================
608
609//------------------------------------------------------------------------------
611 const int gridIdx, const int NeighborGridIdx)
612{
613 assert("pre: Grid index is out-of-bounds!" && (gridIdx >= 0) &&
614 (gridIdx < static_cast<int>(this->NumberOfGrids)));
615 assert("pre: Neighbor grid index is out-of-bounds!" && (NeighborGridIdx >= 0) &&
616 (NeighborGridIdx < static_cast<int>(this->NumberOfGrids)));
617
618 std::pair<int, int> gridPair = std::make_pair(gridIdx, NeighborGridIdx);
619 assert("pre: Neighboring grid pair does not exist in hash!" &&
620 (this->NeighborPair2NeighborListIndex.find(gridPair) !=
621 this->NeighborPair2NeighborListIndex.end()));
622
623 return (this->NeighborPair2NeighborListIndex[gridPair]);
624}
625
626//------------------------------------------------------------------------------
628 int* ghostedExtent, int GridExtent[6], const int minIdx, const int maxIdx, const int N)
629{
630 assert("pre: Number of ghost layers must be N >= 1" && (N >= 1));
631 assert("pre: ghosted extent pointer is nullptr" && ghostedExtent != nullptr);
632
633 ghostedExtent[minIdx] = GridExtent[minIdx] - N;
634 ghostedExtent[maxIdx] = GridExtent[maxIdx] + N;
635
636 // Clamp the ghosted extent to be within the WholeExtent
637 ghostedExtent[minIdx] = (ghostedExtent[minIdx] < this->WholeExtent[minIdx])
638 ? this->WholeExtent[minIdx]
639 : ghostedExtent[minIdx];
640 ghostedExtent[maxIdx] = (ghostedExtent[maxIdx] > this->WholeExtent[maxIdx])
641 ? this->WholeExtent[maxIdx]
642 : ghostedExtent[maxIdx];
643}
644
645//------------------------------------------------------------------------------
646inline void vtkStructuredGridConnectivity::SetGhostedGridExtent(const int gridID, int ext[6])
647{
648 assert("pre: gridID is out-of-bounds" && (gridID >= 0) &&
649 (gridID < static_cast<int>(this->NumberOfGrids)));
650 assert("pre: ghosted-extents vector has not been allocated" &&
651 (this->NumberOfGrids == this->GhostedExtents.size() / 6));
652
653 for (int i = 0; i < 6; ++i)
654 {
655 this->GhostedExtents[gridID * 6 + i] = ext[i];
656 }
657}
658
659//------------------------------------------------------------------------------
660inline void vtkStructuredGridConnectivity::GetGridExtent(const int gridID, int ext[6])
661{
662 assert("pre: gridID out-of-bounds!" &&
663 (gridID >= 0 && gridID < static_cast<int>(this->NumberOfGrids)));
664 for (int i = 0; i < 6; ++i)
665 {
666 ext[i] = this->GridExtents[gridID * 6 + i];
667 }
668}
669
670//------------------------------------------------------------------------------
671inline void vtkStructuredGridConnectivity::GetGhostedGridExtent(const int gridID, int ext[6])
672{
673 assert("pre: gridID out-of-bounds!" &&
674 (gridID >= 0 && gridID < static_cast<int>(this->NumberOfGrids)));
675
676 if (this->GhostedExtents.empty())
677 {
678 ext[0] = ext[2] = ext[4] = -1;
679 ext[1] = ext[3] = ext[5] = 0;
680 vtkErrorMacro("No ghosted extents found for registered grid extends!!!");
681 return;
682 }
683
684 assert("GhostedExtents are not aligned with registered grid extents" &&
685 (this->GhostedExtents.size() == this->GridExtents.size()));
686 for (int i = 0; i < 6; ++i)
687 {
688 ext[i] = this->GhostedExtents[gridID * 6 + i];
689 }
690}
691
692//------------------------------------------------------------------------------
694 const int i, const int j, const int k, int ext[6])
695{
696 if (!this->IsNodeWithinExtent(i, j, k, ext))
697 {
698 return false;
699 }
700
701 bool status = false;
702 switch (this->DataDescription)
703 {
704 case VTK_X_LINE:
705 if (i == ext[0] || i == ext[1])
706 {
707 status = true;
708 }
709 break;
710 case VTK_Y_LINE:
711 if (j == ext[2] || j == ext[3])
712 {
713 status = true;
714 }
715 break;
716 case VTK_Z_LINE:
717 if (k == ext[4] || k == ext[5])
718 {
719 status = true;
720 }
721 break;
722 case VTK_XY_PLANE:
723 if ((i == ext[0] || i == ext[1]) || (j == ext[2] || j == ext[3]))
724 {
725 status = true;
726 }
727 break;
728 case VTK_YZ_PLANE:
729 if ((j == ext[2] || j == ext[3]) || (k == ext[4] || k == ext[5]))
730 {
731 status = true;
732 }
733 break;
734 case VTK_XZ_PLANE:
735 if ((i == ext[0] || i == ext[1]) || (k == ext[4] || k == ext[5]))
736 {
737 status = true;
738 }
739 break;
740 case VTK_XYZ_GRID:
741 if ((i == ext[0] || i == ext[1]) || (j == ext[2] || j == ext[3]) ||
742 (k == ext[4] || k == ext[5]))
743 {
744 status = true;
745 }
746 break;
747 default:
748 std::cout << "Data description is: " << this->DataDescription << "\n";
749 std::cout.flush();
750 assert("pre: Undefined data-description!" && false);
751 } // END switch
752
753 return (status);
754}
755
756//------------------------------------------------------------------------------
758 const int i, const int j, const int k, int GridExtent[6])
759{
760 bool status = false;
761
762 switch (this->DataDescription)
763 {
764 case VTK_X_LINE:
765 if ((GridExtent[0] < i) && (i < GridExtent[1]))
766 {
767 status = true;
768 }
769 break;
770 case VTK_Y_LINE:
771 if ((GridExtent[2] < j) && (j < GridExtent[3]))
772 {
773 status = true;
774 }
775 break;
776 case VTK_Z_LINE:
777 if ((GridExtent[4] < k) && (k < GridExtent[5]))
778 {
779 status = true;
780 }
781 break;
782 case VTK_XY_PLANE:
783 if ((GridExtent[0] < i) && (i < GridExtent[1]) && (GridExtent[2] < j) && (j < GridExtent[3]))
784 {
785 status = true;
786 }
787 break;
788 case VTK_YZ_PLANE:
789 if ((GridExtent[2] < j) && (j < GridExtent[3]) && (GridExtent[4] < k) && (k < GridExtent[5]))
790 {
791 status = true;
792 }
793 break;
794 case VTK_XZ_PLANE:
795 if ((GridExtent[0] < i) && (i < GridExtent[1]) && (GridExtent[4] < k) && (k < GridExtent[5]))
796 {
797 status = true;
798 }
799 break;
800 case VTK_XYZ_GRID:
801 if ((GridExtent[0] < i) && (i < GridExtent[1]) && (GridExtent[2] < j) &&
802 (j < GridExtent[3]) && (GridExtent[4] < k) && (k < GridExtent[5]))
803 {
804 status = true;
805 }
806 break;
807 default:
808 std::cout << "Data description is: " << this->DataDescription << "\n";
809 std::cout.flush();
810 assert("pre: Undefined data-description!" && false);
811 } // END switch
812
813 return (status);
814}
815
816//------------------------------------------------------------------------------
818 const int idx, int A[2], int B[2], int overlap[2], int orient[3])
819{
820 assert("pre: idx is out-of-bounds" && (idx >= 0) && (idx < 3));
821
822 // A. Non-overlapping cases
823 if (overlap[0] == overlap[1])
824 {
825 if (A[1] == B[0])
826 {
827 orient[idx] = vtkStructuredNeighbor::HI;
828 }
829 else if (A[0] == B[1])
830 {
831 orient[idx] = vtkStructuredNeighbor::LO;
832 }
833 else
834 {
836 assert("ERROR: Code should not reach here!" && false);
837 }
838 } // END non-overlapping cases
839 // B. Sub-set cases
840 else if (this->IsSubset(A, B))
841 {
842 if ((A[0] == B[0]) && (A[1] == B[1]))
843 {
845 }
846 else if (this->StrictlyInsideBounds(A[0], B[0], B[1]) &&
847 this->StrictlyInsideBounds(A[1], B[0], B[1]))
848 {
850 }
851 else if (A[0] == B[0])
852 {
854 }
855 else if (A[1] == B[1])
856 {
858 }
859 else
860 {
862 assert("ERROR: Code should not reach here!" && false);
863 }
864 }
865 // C. Super-set cases
866 else if (this->IsSubset(B, A))
867 {
869 }
870 // D. Partially-overlapping (non-subset) cases
871 else if (!(this->IsSubset(A, B) || this->IsSubset(A, B)))
872 {
873 if (this->InBounds(A[0], B[0], B[1]))
874 {
875 orient[idx] = vtkStructuredNeighbor::LO;
876 }
877 else if (this->InBounds(A[1], B[0], B[1]))
878 {
879 orient[idx] = vtkStructuredNeighbor::HI;
880 }
881 else
882 {
884 assert("ERROR: Code should not reach here!" && false);
885 }
886 }
887 else
888 {
890 assert("ERROR: Code should not reach here!" && false);
891 }
892}
893
894//------------------------------------------------------------------------------
895inline int vtkStructuredGridConnectivity::Get1DOrientation(const int idx, const int ExtentLo,
896 const int ExtentHi, const int OnLo, const int OnHi, const int NotOnBoundary)
897{
898 if (idx == ExtentLo)
899 {
900 return OnLo;
901 }
902 else if (idx == ExtentHi)
903 {
904 return OnHi;
905 }
906 return NotOnBoundary;
907}
908
909//------------------------------------------------------------------------------
911 const int gridID, const int blockDirection)
912{
913 // Sanity check
914 assert("pre: gridID is out-of-bounds" && (gridID >= 0) &&
915 (gridID < static_cast<int>(this->NumberOfGrids)));
916 assert("pre: BlockTopology has not been properly allocated" &&
917 (this->NumberOfGrids == this->BlockTopology.size()));
918 assert("pre: blockDirection is out-of-bounds" && (blockDirection >= 0) && (blockDirection < 6));
919 bool status = false;
920 if (this->BlockTopology[gridID] & (1 << blockDirection))
921 {
922 status = true;
923 }
924 return (status);
925}
926
927//------------------------------------------------------------------------------
929 const int gridID, const int blockDirection)
930{
931 // Sanity check
932 assert("pre: gridID is out-of-bounds" && (gridID >= 0) &&
933 (gridID < static_cast<int>(this->NumberOfGrids)));
934 assert("pre: BlockTopology has not been properly allocated" &&
935 (this->NumberOfGrids == this->BlockTopology.size()));
936 assert("pre: blockDirection is out-of-bounds" && (blockDirection >= 0) && (blockDirection < 6));
937
938 this->BlockTopology[gridID] &= ~(1 << blockDirection);
939}
940
941//------------------------------------------------------------------------------
943 const int gridID, const int blockDirection)
944{
945 // Sanity check
946 assert("pre: gridID is out-of-bounds" && (gridID >= 0) &&
947 (gridID < static_cast<int>(this->NumberOfGrids)));
948 assert("pre: BlockTopology has not been properly allocated" &&
949 (this->NumberOfGrids == this->BlockTopology.size()));
950 assert("pre: blockDirection is out-of-bounds" && (blockDirection >= 0) && (blockDirection < 6));
951 this->BlockTopology[gridID] |= (1 << blockDirection);
952}
953
954//------------------------------------------------------------------------------
956{
957 // Sanity check
958 assert("pre: gridID is out-of-bounds" && (gridID >= 0) &&
959 (gridID < static_cast<int>(this->NumberOfGrids)));
960 assert("pre: BlockTopology has not been properly allocated" &&
961 (this->NumberOfGrids == this->BlockTopology.size()));
962 for (int i = 0; i < 6; ++i)
963 {
964 this->RemoveBlockConnection(gridID, i);
965 } // END for all block directions
966}
967
968//------------------------------------------------------------------------------
970{
971 // Sanity check
972 assert("pre: gridID is out-of-bounds" && (gridID >= 0) &&
973 (gridID < static_cast<int>(this->NumberOfGrids)));
974 assert("pre: BlockTopology has not been properly allocated" &&
975 (this->NumberOfGrids == this->BlockTopology.size()));
976
977 int count = 0;
978 for (int i = 0; i < 6; ++i)
979 {
980 if (this->HasBlockConnection(gridID, i))
981 {
982 ++count;
983 }
984 }
985 assert("post: count must be in [0,5]" && (count >= 0 && count <= 6));
986 return (count);
987}
988
989//------------------------------------------------------------------------------
990inline void vtkStructuredGridConnectivity::SetNumberOfGrids(const unsigned int N)
991{
992 if (N == 0)
993 {
994 vtkErrorMacro("Number of grids cannot be 0.");
995 return;
996 }
997
998 this->NumberOfGrids = N;
1000
1001 this->GridExtents.resize(6 * N, -1);
1002 this->Neighbors.resize(N);
1003 this->BlockTopology.resize(N);
1004}
1005#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:42
represent and manipulate fields of data
list of point or cell ids
Definition vtkIdList.h:34
a simple class to control print indentation
Definition vtkIndent.h:40
represent and manipulate point attribute data
represent and manipulate 3D points
Definition vtkPoints.h:40
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
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