VTK  9.3.20240425
vtkStructuredGridConnectivity.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
20#ifndef vtkStructuredGridConnectivity_h
21#define vtkStructuredGridConnectivity_h
22
23#define VTK_NO_OVERLAP 0
24#define VTK_NODE_OVERLAP 1
25#define VTK_EDGE_OVERLAP 2
26#define VTK_PARTIAL_OVERLAP 3
27
28// VTK include directives
30#include "vtkFiltersGeometryModule.h" // For export macro
31#include "vtkStructuredData.h" // For data description definitions
32#include "vtkStructuredNeighbor.h" // For Structured Neighbor object definition
33
34// C++ include directives
35#include <cassert> // For assert()
36#include <iostream> // For cout
37#include <map> // For STL map
38#include <utility> // For STL pair and overloaded relational operators
39#include <vector> // For STL vector
40
41// Forward Declarations
42VTK_ABI_NAMESPACE_BEGIN
43class vtkIdList;
45class vtkPointData;
46class vtkCellData;
47class vtkPoints;
48
49class VTKFILTERSGEOMETRY_EXPORT vtkStructuredGridConnectivity : public vtkAbstractGridConnectivity
50{
51public:
54 void PrintSelf(ostream& os, vtkIndent indent) override;
55
57
60 vtkSetVector6Macro(WholeExtent, int);
61 vtkGetVector6Macro(WholeExtent, int);
63
65
68 vtkGetMacro(DataDimension, int);
70
74 void SetNumberOfGrids(unsigned int N) override;
75
80 virtual void RegisterGrid(int gridID, int extents[6], vtkUnsignedCharArray* nodesGhostArray,
81 vtkUnsignedCharArray* cellGhostArray, vtkPointData* pointData, vtkCellData* cellData,
82 vtkPoints* gridNodes);
83
87 void GetGridExtent(int gridID, int extent[6]);
88
93 void SetGhostedGridExtent(int gridID, int ext[6]);
94
98 void GetGhostedGridExtent(int gridID, int ext[6]);
99
103 void ComputeNeighbors() override;
104
109 int GetNumberOfNeighbors(int gridID)
110 {
111 return (static_cast<int>(this->Neighbors[gridID].size()));
112 }
113
119
127 vtkIdList* GetNeighbors(int gridID, int* extents);
128
135 int gridID, vtkUnsignedCharArray* nodesArray, vtkUnsignedCharArray* cellsArray) override;
136
140 void CreateGhostLayers(int N = 1) override;
141
142protected:
145
149 bool InBounds(int idx, int Lo, int Hi) { return ((idx >= Lo) && (idx <= Hi)); }
150
154 bool StrictlyInsideBounds(int idx, int Lo, int Hi) { return ((idx > Lo) && (idx < Hi)); }
155
159 bool IsSubset(int A[2], int B[2])
160 {
161 return (this->InBounds(A[0], B[0], B[1]) && this->InBounds(A[1], B[0], B[1]));
162 }
163
167 int Cardinality(int S[2]) { return (S[1] - S[0] + 1); }
168
170
174 {
175 int numNodes = 0;
176 switch (dim)
177 {
178 case 1:
179 numNodes = 2; // line cell
180 break;
181 case 2:
182 numNodes = 4; // quad cell
183 break;
184 case 3:
185 numNodes = 8; // hex cell
186 break;
187 default:
188 assert("ERROR: code should not reach here!" && false);
189 } // END switch
190 return (numNodes);
191 }
193
197 void FillNodesGhostArray(int gridID, int dataDescription, int GridExtent[6], int RealExtent[6],
198 vtkUnsignedCharArray* nodesArray);
199
203 void FillCellsGhostArray(int dataDescription, int numNodesPerCell, int dims[3], int CellExtent[6],
204 vtkUnsignedCharArray* nodesArray, vtkUnsignedCharArray* cellsArray);
205
211 void SearchNeighbors(int gridID, int i, int j, int k, vtkIdList* neiList);
212
218 int gridID, int i, int j, int k, int ext[6], int RealExtent[6], unsigned char& pfield);
219
224 void MarkCellProperty(unsigned char& pfield, unsigned char* nodeGhostFields, int numNodes);
225
229 void GetRealExtent(int gridID, int GridExtent[6], int RealExtent[6]);
230
235 bool IsGhostNode(int GridExtent[6], int RealExtent[6], int i, int j, int k);
236
241 bool IsNodeOnBoundaryOfExtent(int i, int j, int k, int ext[6]);
242
248 bool IsNodeOnSharedBoundary(int gridID, int RealExtent[6], int i, int j, int k);
249
254 bool IsNodeOnBoundary(int i, int j, int k);
255
260 bool IsNodeInterior(int i, int j, int k, int GridExtent[6]);
261
266 bool IsNodeWithinExtent(int i, int j, int k, int GridExtent[6])
267 {
268 bool status = false;
269
270 switch (this->DataDescription)
271 {
272 case VTK_X_LINE:
273 if ((GridExtent[0] <= i) && (i <= GridExtent[1]))
274 {
275 status = true;
276 }
277 break;
278 case VTK_Y_LINE:
279 if ((GridExtent[2] <= j) && (j <= GridExtent[3]))
280 {
281 status = true;
282 }
283 break;
284 case VTK_Z_LINE:
285 if ((GridExtent[4] <= k) && (k <= GridExtent[5]))
286 {
287 status = true;
288 }
289 break;
290 case VTK_XY_PLANE:
291 if ((GridExtent[0] <= i) && (i <= GridExtent[1]) && (GridExtent[2] <= j) &&
292 (j <= GridExtent[3]))
293 {
294 status = true;
295 }
296 break;
297 case VTK_YZ_PLANE:
298 if ((GridExtent[2] <= j) && (j <= GridExtent[3]) && (GridExtent[4] <= k) &&
299 (k <= GridExtent[5]))
300 {
301 status = true;
302 }
303 break;
304 case VTK_XZ_PLANE:
305 if ((GridExtent[0] <= i) && (i <= GridExtent[1]) && (GridExtent[4] <= k) &&
306 (k <= GridExtent[5]))
307 {
308 status = true;
309 }
310 break;
311 case VTK_XYZ_GRID:
312 if ((GridExtent[0] <= i) && (i <= GridExtent[1]) && (GridExtent[2] <= j) &&
313 (j <= GridExtent[3]) && (GridExtent[4] <= k) && (k <= GridExtent[5]))
314 {
315 status = true;
316 }
317 break;
318 default:
319 std::cout << "Data description is: " << this->DataDescription << "\n";
320 std::cout.flush();
321 assert("pre: Undefined data-description!" && false);
322 } // END switch
323
324 return (status);
325 }
326
331 int i, int j, int i2jOrientation[3], int j2iOrientation[3], int overlapExtent[6]);
332
341 void DetermineNeighborOrientation(int idx, int A[2], int B[2], int overlap[2], int orient[3]);
342
348 void DetectNeighbors(int i, int j, int ex1[6], int ex2[6], int orientation[3], int ndim);
349
359 int IntervalOverlap(int A[2], int B[2], int overlap[2]);
360
370 int DoPartialOverlap(int s[2], int S[2], int overlap[2]);
371
381 int PartialOverlap(int A[2], int CardinalityOfA, int B[2], int CardinalityOfB, int overlap[2]);
382
387 void EstablishNeighbors(int i, int j);
388
394
409 bool HasBlockConnection(int gridID, int blockDirection);
410
425 void RemoveBlockConnection(int gridID, int blockDirection);
426
441 void AddBlockConnection(int gridID, int blockDirection);
442
447 void ClearBlockConnections(int gridID);
448
456 int GetNumberOfConnectingBlockFaces(int gridID);
457
461 void SetBlockTopology(int gridID);
462
469 void GetIJKBlockOrientation(int i, int j, int k, int ext[6], int orientation[3]);
470
475 int Get1DOrientation(int idx, int ExtentLo, int ExtentHi, int OnLo, int OnHi, int NotOnBoundary);
476
481 void CreateGhostedExtent(int gridID, int N);
482
488 void GetGhostedExtent(int* ghostedExtent, int GridExtent[6], int minIdx, int maxIdx, int N);
489
494 void CreateGhostedMaskArrays(int gridID);
495
502 void InitializeGhostData(int gridID);
503
510
517
523
528 void ComputeNeighborSendAndRcvExtent(int gridID, int N);
529
535 virtual void TransferGhostDataFromNeighbors(int gridID);
536
540 void TransferLocalNeighborData(int gridID, const vtkStructuredNeighbor& Neighbor);
541
546 vtkPoints* source, vtkIdType sourceIdx, vtkPoints* target, vtkIdType targetIdx);
547
555 vtkFieldData* source, vtkIdType sourceIdx, vtkFieldData* target, vtkIdType targetIdx);
556
562 int GetNeighborIndex(int gridIdx, int NeighborGridIdx);
563
567 void PrintExtent(int extent[6]);
568
571 int WholeExtent[6];
572
573 std::vector<int> GridExtents;
574 std::vector<int> GhostedExtents;
575 std::vector<unsigned char> BlockTopology;
576 std::vector<std::vector<vtkStructuredNeighbor>> Neighbors;
577 std::map<std::pair<int, int>, int> NeighborPair2NeighborListIndex;
578
579private:
581 void operator=(const vtkStructuredGridConnectivity&) = delete;
582};
583
584//=============================================================================
585// INLINE METHODS
586//=============================================================================
587
588//------------------------------------------------------------------------------
589inline int vtkStructuredGridConnectivity::GetNeighborIndex(int gridIdx, int NeighborGridIdx)
590{
591 assert("pre: Grid index is out-of-bounds!" && (gridIdx >= 0) &&
592 (gridIdx < static_cast<int>(this->NumberOfGrids)));
593 assert("pre: Neighbor grid index is out-of-bounds!" && (NeighborGridIdx >= 0) &&
594 (NeighborGridIdx < static_cast<int>(this->NumberOfGrids)));
595
596 std::pair<int, int> gridPair = std::make_pair(gridIdx, NeighborGridIdx);
597 assert("pre: Neighboring grid pair does not exist in hash!" &&
598 (this->NeighborPair2NeighborListIndex.find(gridPair) !=
599 this->NeighborPair2NeighborListIndex.end()));
600
601 return (this->NeighborPair2NeighborListIndex[gridPair]);
602}
603
604//------------------------------------------------------------------------------
606 int* ghostedExtent, int GridExtent[6], int minIdx, int maxIdx, int N)
607{
608 assert("pre: Number of ghost layers must be N >= 1" && (N >= 1));
609 assert("pre: ghosted extent pointer is nullptr" && ghostedExtent != nullptr);
610
611 ghostedExtent[minIdx] = GridExtent[minIdx] - N;
612 ghostedExtent[maxIdx] = GridExtent[maxIdx] + N;
613
614 // Clamp the ghosted extent to be within the WholeExtent
615 ghostedExtent[minIdx] = (ghostedExtent[minIdx] < this->WholeExtent[minIdx])
616 ? this->WholeExtent[minIdx]
617 : ghostedExtent[minIdx];
618 ghostedExtent[maxIdx] = (ghostedExtent[maxIdx] > this->WholeExtent[maxIdx])
619 ? this->WholeExtent[maxIdx]
620 : ghostedExtent[maxIdx];
621}
622
623//------------------------------------------------------------------------------
625{
626 assert("pre: gridID is out-of-bounds" && (gridID >= 0) &&
627 (gridID < static_cast<int>(this->NumberOfGrids)));
628 assert("pre: ghosted-extents vector has not been allocated" &&
629 (this->NumberOfGrids == this->GhostedExtents.size() / 6));
630
631 for (int i = 0; i < 6; ++i)
632 {
633 this->GhostedExtents[gridID * 6 + i] = ext[i];
634 }
635}
636
637//------------------------------------------------------------------------------
638inline void vtkStructuredGridConnectivity::GetGridExtent(int gridID, int ext[6])
639{
640 assert("pre: gridID out-of-bounds!" &&
641 (gridID >= 0 && gridID < static_cast<int>(this->NumberOfGrids)));
642 for (int i = 0; i < 6; ++i)
643 {
644 ext[i] = this->GridExtents[gridID * 6 + i];
645 }
646}
647
648//------------------------------------------------------------------------------
650{
651 assert("pre: gridID out-of-bounds!" &&
652 (gridID >= 0 && gridID < static_cast<int>(this->NumberOfGrids)));
653
654 if (this->GhostedExtents.empty())
655 {
656 ext[0] = ext[2] = ext[4] = -1;
657 ext[1] = ext[3] = ext[5] = 0;
658 vtkErrorMacro("No ghosted extents found for registered grid extends!!!");
659 return;
660 }
661
662 assert("GhostedExtents are not aligned with registered grid extents" &&
663 (this->GhostedExtents.size() == this->GridExtents.size()));
664 for (int i = 0; i < 6; ++i)
665 {
666 ext[i] = this->GhostedExtents[gridID * 6 + i];
667 }
668}
669
670//------------------------------------------------------------------------------
671inline bool vtkStructuredGridConnectivity::IsNodeOnBoundaryOfExtent(int i, int j, int k, int ext[6])
672{
673 if (!this->IsNodeWithinExtent(i, j, k, ext))
674 {
675 return false;
676 }
677
678 bool status = false;
679 switch (this->DataDescription)
680 {
681 case VTK_X_LINE:
682 if (i == ext[0] || i == ext[1])
683 {
684 status = true;
685 }
686 break;
687 case VTK_Y_LINE:
688 if (j == ext[2] || j == ext[3])
689 {
690 status = true;
691 }
692 break;
693 case VTK_Z_LINE:
694 if (k == ext[4] || k == ext[5])
695 {
696 status = true;
697 }
698 break;
699 case VTK_XY_PLANE:
700 if ((i == ext[0] || i == ext[1]) || (j == ext[2] || j == ext[3]))
701 {
702 status = true;
703 }
704 break;
705 case VTK_YZ_PLANE:
706 if ((j == ext[2] || j == ext[3]) || (k == ext[4] || k == ext[5]))
707 {
708 status = true;
709 }
710 break;
711 case VTK_XZ_PLANE:
712 if ((i == ext[0] || i == ext[1]) || (k == ext[4] || k == ext[5]))
713 {
714 status = true;
715 }
716 break;
717 case VTK_XYZ_GRID:
718 if ((i == ext[0] || i == ext[1]) || (j == ext[2] || j == ext[3]) ||
719 (k == ext[4] || k == ext[5]))
720 {
721 status = true;
722 }
723 break;
724 default:
725 std::cout << "Data description is: " << this->DataDescription << "\n";
726 std::cout.flush();
727 assert("pre: Undefined data-description!" && false);
728 } // END switch
729
730 return (status);
731}
732
733//------------------------------------------------------------------------------
734inline bool vtkStructuredGridConnectivity::IsNodeInterior(int i, int j, int k, int GridExtent[6])
735{
736 bool status = false;
737
738 switch (this->DataDescription)
739 {
740 case VTK_X_LINE:
741 if ((GridExtent[0] < i) && (i < GridExtent[1]))
742 {
743 status = true;
744 }
745 break;
746 case VTK_Y_LINE:
747 if ((GridExtent[2] < j) && (j < GridExtent[3]))
748 {
749 status = true;
750 }
751 break;
752 case VTK_Z_LINE:
753 if ((GridExtent[4] < k) && (k < GridExtent[5]))
754 {
755 status = true;
756 }
757 break;
758 case VTK_XY_PLANE:
759 if ((GridExtent[0] < i) && (i < GridExtent[1]) && (GridExtent[2] < j) && (j < GridExtent[3]))
760 {
761 status = true;
762 }
763 break;
764 case VTK_YZ_PLANE:
765 if ((GridExtent[2] < j) && (j < GridExtent[3]) && (GridExtent[4] < k) && (k < GridExtent[5]))
766 {
767 status = true;
768 }
769 break;
770 case VTK_XZ_PLANE:
771 if ((GridExtent[0] < i) && (i < GridExtent[1]) && (GridExtent[4] < k) && (k < GridExtent[5]))
772 {
773 status = true;
774 }
775 break;
776 case VTK_XYZ_GRID:
777 if ((GridExtent[0] < i) && (i < GridExtent[1]) && (GridExtent[2] < j) &&
778 (j < GridExtent[3]) && (GridExtent[4] < k) && (k < GridExtent[5]))
779 {
780 status = true;
781 }
782 break;
783 default:
784 std::cout << "Data description is: " << this->DataDescription << "\n";
785 std::cout.flush();
786 assert("pre: Undefined data-description!" && false);
787 } // END switch
788
789 return (status);
790}
791
792//------------------------------------------------------------------------------
794 int idx, int A[2], int B[2], int overlap[2], int orient[3])
795{
796 assert("pre: idx is out-of-bounds" && (idx >= 0) && (idx < 3));
797
798 // A. Non-overlapping cases
799 if (overlap[0] == overlap[1])
800 {
801 if (A[1] == B[0])
802 {
803 orient[idx] = vtkStructuredNeighbor::HI;
804 }
805 else if (A[0] == B[1])
806 {
807 orient[idx] = vtkStructuredNeighbor::LO;
808 }
809 else
810 {
812 assert("ERROR: Code should not reach here!" && false);
813 }
814 } // END non-overlapping cases
815 // B. Sub-set cases
816 else if (this->IsSubset(A, B))
817 {
818 if ((A[0] == B[0]) && (A[1] == B[1]))
819 {
821 }
822 else if (this->StrictlyInsideBounds(A[0], B[0], B[1]) &&
823 this->StrictlyInsideBounds(A[1], B[0], B[1]))
824 {
826 }
827 else if (A[0] == B[0])
828 {
830 }
831 else if (A[1] == B[1])
832 {
834 }
835 else
836 {
838 assert("ERROR: Code should not reach here!" && false);
839 }
840 }
841 // C. Super-set cases
842 else if (this->IsSubset(B, A))
843 {
845 }
846 // D. Partially-overlapping (non-subset) cases
847 else if (!(this->IsSubset(A, B) || this->IsSubset(A, B)))
848 {
849 if (this->InBounds(A[0], B[0], B[1]))
850 {
851 orient[idx] = vtkStructuredNeighbor::LO;
852 }
853 else if (this->InBounds(A[1], B[0], B[1]))
854 {
855 orient[idx] = vtkStructuredNeighbor::HI;
856 }
857 else
858 {
860 assert("ERROR: Code should not reach here!" && false);
861 }
862 }
863 else
864 {
866 assert("ERROR: Code should not reach here!" && false);
867 }
868}
869
870//------------------------------------------------------------------------------
872 int idx, int ExtentLo, int ExtentHi, int OnLo, int OnHi, int NotOnBoundary)
873{
874 if (idx == ExtentLo)
875 {
876 return OnLo;
877 }
878 else if (idx == ExtentHi)
879 {
880 return OnHi;
881 }
882 return NotOnBoundary;
883}
884
885//------------------------------------------------------------------------------
886inline bool vtkStructuredGridConnectivity::HasBlockConnection(int gridID, int blockDirection)
887{
888 // Sanity check
889 assert("pre: gridID is out-of-bounds" && (gridID >= 0) &&
890 (gridID < static_cast<int>(this->NumberOfGrids)));
891 assert("pre: BlockTopology has not been properly allocated" &&
892 (this->NumberOfGrids == this->BlockTopology.size()));
893 assert("pre: blockDirection is out-of-bounds" && (blockDirection >= 0) && (blockDirection < 6));
894 bool status = false;
895 if (this->BlockTopology[gridID] & (1 << blockDirection))
896 {
897 status = true;
898 }
899 return (status);
900}
901
902//------------------------------------------------------------------------------
903inline void vtkStructuredGridConnectivity::RemoveBlockConnection(int gridID, int blockDirection)
904{
905 // Sanity check
906 assert("pre: gridID is out-of-bounds" && (gridID >= 0) &&
907 (gridID < static_cast<int>(this->NumberOfGrids)));
908 assert("pre: BlockTopology has not been properly allocated" &&
909 (this->NumberOfGrids == this->BlockTopology.size()));
910 assert("pre: blockDirection is out-of-bounds" && (blockDirection >= 0) && (blockDirection < 6));
911
912 this->BlockTopology[gridID] &= ~(1 << blockDirection);
913}
914
915//------------------------------------------------------------------------------
916inline void vtkStructuredGridConnectivity::AddBlockConnection(int gridID, int blockDirection)
917{
918 // Sanity check
919 assert("pre: gridID is out-of-bounds" && (gridID >= 0) &&
920 (gridID < static_cast<int>(this->NumberOfGrids)));
921 assert("pre: BlockTopology has not been properly allocated" &&
922 (this->NumberOfGrids == this->BlockTopology.size()));
923 assert("pre: blockDirection is out-of-bounds" && (blockDirection >= 0) && (blockDirection < 6));
924 this->BlockTopology[gridID] |= (1 << blockDirection);
925}
926
927//------------------------------------------------------------------------------
929{
930 // Sanity check
931 assert("pre: gridID is out-of-bounds" && (gridID >= 0) &&
932 (gridID < static_cast<int>(this->NumberOfGrids)));
933 assert("pre: BlockTopology has not been properly allocated" &&
934 (this->NumberOfGrids == this->BlockTopology.size()));
935 for (int i = 0; i < 6; ++i)
936 {
937 this->RemoveBlockConnection(gridID, i);
938 } // END for all block directions
939}
940
941//------------------------------------------------------------------------------
943{
944 // Sanity check
945 assert("pre: gridID is out-of-bounds" && (gridID >= 0) &&
946 (gridID < static_cast<int>(this->NumberOfGrids)));
947 assert("pre: BlockTopology has not been properly allocated" &&
948 (this->NumberOfGrids == this->BlockTopology.size()));
949
950 int count = 0;
951 for (int i = 0; i < 6; ++i)
952 {
953 if (this->HasBlockConnection(gridID, i))
954 {
955 ++count;
956 }
957 }
958 assert("post: count must be in [0,5]" && (count >= 0 && count <= 6));
959 return (count);
960}
961
962//------------------------------------------------------------------------------
964{
965 if (N == 0)
966 {
967 vtkErrorMacro("Number of grids cannot be 0.");
968 return;
969 }
970
971 this->NumberOfGrids = N;
973
974 this->GridExtents.resize(6 * N, -1);
975 this->Neighbors.resize(N);
976 this->BlockTopology.resize(N);
977}
978VTK_ABI_NAMESPACE_END
979#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(unsigned int N)=0
Sets the total number of grids in the domain.
represent and manipulate cell attribute data
represent and manipulate fields of data
list of point or cell ids
Definition vtkIdList.h:133
a simple class to control print indentation
Definition vtkIndent.h:108
represent and manipulate point attribute data
represent and manipulate 3D points
Definition vtkPoints.h:139
vtkStructuredGridConnectivity is a concrete instance of vtkObject that implements functionality for c...
void SetBlockTopology(int gridID)
Sets the block topology connections for the grid corresponding to gridID.
void SetNeighbors(int i, int j, int i2jOrientation[3], int j2iOrientation[3], int overlapExtent[6])
Creates a neighbor from i-to-j and from j-to-i.
void SearchNeighbors(int gridID, int i, int j, int k, vtkIdList *neiList)
Given a point (i,j,k) belonging to the grid corresponding to the given gridID, this method searches f...
int GetNumberOfConnectingBlockFaces(int gridID)
Returns the number of faces of the block corresponding to the given grid ID that are adjacent to at l...
int GetNeighborIndex(int gridIdx, int NeighborGridIdx)
Given a global grid ID and the neighbor grid ID, this method returns the neighbor index w....
bool IsSubset(int A[2], int B[2])
Returns true iff A is a subset of B, otherwise false.
void FillNodesGhostArray(int gridID, int dataDescription, int GridExtent[6], int RealExtent[6], vtkUnsignedCharArray *nodesArray)
Fills the ghost array for the nodes.
~vtkStructuredGridConnectivity() override
void ComputeNeighborSendAndRcvExtent(int gridID, int N)
This method computes, the send and rcv extents for each neighbor of each grid.
void CreateGhostedMaskArrays(int gridID)
This method creates the ghosted mask arrays, i.e., the NodeGhostArrays and the CellGhostArrays for th...
bool IsGhostNode(int GridExtent[6], int RealExtent[6], int i, int j, int k)
Checks if the node corresponding to the given global i,j,k coordinates is a ghost node or not.
void TransferLocalNeighborData(int gridID, const vtkStructuredNeighbor &Neighbor)
This method transfers the fields.
void CreateGhostLayers(int N=1) override
Creates ghost layers.
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 DetermineNeighborOrientation(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 EstablishNeighbors(int i, int j)
Establishes the neighboring information between the two grids corresponding to grid ids "i" and "j" w...
void ClearBlockConnections(int gridID)
Clears all block connections for the block corresponding to the given grid ID.
bool IsNodeOnSharedBoundary(int gridID, int RealExtent[6], int i, int j, int k)
Checks if the node corresponding to the given global i,j,k coordinates is on the shared boundary,...
void PrintExtent(int extent[6])
Prints the extent, used for debugging.
bool IsNodeOnBoundary(int i, int j, int k)
Checks if the node corresponding to the given global i,j,k coordinates touches the real boundaries of...
void AddBlockConnection(int gridID, int blockDirection)
Adds a block connection along the given direction for the block corresponding to the given gridID.
void FillGhostArrays(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 InitializeGhostData(int gridID)
This method initializes the ghost data according to the computed ghosted grid extent for the grid wit...
vtkIdList * GetNeighbors(int gridID, int *extents)
Returns the list of neighboring blocks for the given grid and the corresponding overlapping extents a...
int Cardinality(int S[2])
Returns the cardinality of a range S.
void DetectNeighbors(int i, 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,...
bool IsNodeWithinExtent(int i, int j, int k, int GridExtent[6])
Checks if the node corresponding to the given global i,j,k coordinates is within the given extent,...
bool IsNodeOnBoundaryOfExtent(int i, int j, 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 ComputeNeighbors() override
Computes neighboring information.
bool InBounds(int idx, int Lo, int Hi)
Returns true iff Lo <= idx <= Hi, otherwise false.
void MarkCellProperty(unsigned char &pfield, unsigned char *nodeGhostFields, int numNodes)
Marks the cell property for the cell composed by the nodes with the given ghost fields.
std::vector< unsigned char > BlockTopology
void GetGhostedGridExtent(int gridID, int ext[6])
Returns the ghosted grid extent for the block corresponding the.
void GetRealExtent(int gridID, int GridExtent[6], int RealExtent[6])
Given a grid extent, this method computes the RealExtent.
vtkStructuredNeighbor GetGridNeighbor(int gridID, int nei)
Returns the neighbor corresponding to the index nei for the grid with the given (global) grid ID.
void SetNumberOfGrids(unsigned int N) override
Set/Get the total number of domains distributed among processors.
void RemoveBlockConnection(int gridID, int blockDirection)
Removes a block connection along the given direction for the block corresponding to the given gridID.
int GetNumberOfNodesPerCell(int dim)
Returns the number of nodes per cell according to the given dimension.
void GetIJKBlockOrientation(int i, int j, 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 CopyCoordinates(vtkPoints *source, vtkIdType sourceIdx, vtkPoints *target, vtkIdType targetIdx)
Copies the coordinates from the source points to the target points.
void MarkNodeProperty(int gridID, int i, int j, 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....
bool HasBlockConnection(int gridID, int blockDirection)
Checks if the block corresponding to the given grid ID has a block adjacent to it in the given block ...
void CreateGhostedExtent(int gridID, int N)
Creates the ghosted extent of the grid corresponding to the given gridID.
void GetGridExtent(int gridID, int extent[6])
Returns the grid extent of the grid corresponding to the given grid ID.
virtual void RegisterGrid(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.
int Get1DOrientation(int idx, int ExtentLo, int ExtentHi, int OnLo, int OnHi, int NotOnBoundary)
A helper method that computes the 1-D i-j-k orientation to facilitate the implementation of GetNodeBl...
void FillCellsGhostArray(int dataDescription, int numNodesPerCell, int dims[3], int CellExtent[6], vtkUnsignedCharArray *nodesArray, vtkUnsignedCharArray *cellsArray)
Fills the ghost array for the grid cells.
bool IsNodeInterior(int i, int j, int k, int GridExtent[6])
Checks if the node, corresponding to the given global i,j,k coordinates is within the interior of the...
std::map< std::pair< int, int >, int > NeighborPair2NeighborListIndex
int GetNumberOfNeighbors(int gridID)
Returns the number of neighbors for the grid corresponding to the given grid ID.
bool StrictlyInsideBounds(int idx, int Lo, int Hi)
Returns true iff Lo < idx < Hi, otherwise false.
void AllocatePointData(vtkPointData *RPD, int N, vtkPointData *PD)
Adds/creates all the arrays in the reference grid point data, RPD, to the user-supplied point data in...
void TransferRegisteredDataToGhostedData(int gridID)
This method transfers the registered grid data to the corresponding ghosted grid data.
int DoPartialOverlap(int s[2], int S[2], int overlap[2])
Checks if the internals s,S partially overlap where |s| < |S|.
void SetGhostedGridExtent(int gridID, int ext[6])
Sets the ghosted grid extent for the grid corresponding to the given grid ID to the given extent.
void AllocateCellData(vtkCellData *RCD, int N, vtkCellData *CD)
Adds/creates all the arrays in the reference grid cell data, RCD, to the user-supplied cell data inst...
void GetGhostedExtent(int *ghostedExtent, int GridExtent[6], int minIdx, int maxIdx, int N)
Gets the ghosted extent from the given grid extent along the dimension given by minIdx and maxIdx.
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 PartialOverlap(int A[2], int CardinalityOfA, int B[2], int CardinalityOfB, int overlap[2])
Checks if the intervals A,B partially overlap.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void TransferGhostDataFromNeighbors(int gridID)
This method transfers the fields (point data and cell data) to the ghost extents from the neighboring...
void AcquireDataDescription()
Based on the user-supplied WholeExtent, this method determines the topology of the structured domain,...
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:315