VTK
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
41#include "vtkFiltersGeometryModule.h" // For export macro
43#include "vtkStructuredNeighbor.h" // For Structured Neighbor object definition
44#include "vtkStructuredData.h" // For data description definitions
45
46// C++ include directives
47#include <iostream> // For cout
48#include <vector> // For STL vector
49#include <map> // For STL map
50#include <utility> // For STL pair and overloaded relational operators
51#include <cassert> // For assert()
52
53// Forward Declarations
54class vtkIdList;
56class vtkPointData;
57class vtkCellData;
58class vtkPoints;
59
60class VTKFILTERSGEOMETRY_EXPORT vtkStructuredGridConnectivity :
62{
63public:
66 void PrintSelf(ostream& os, vtkIndent indent ) VTK_OVERRIDE;
67
69
72 vtkSetVector6Macro(WholeExtent,int);
73 vtkGetVector6Macro(WholeExtent,int);
75
77
80 vtkGetMacro(DataDimension,int);
82
86 void SetNumberOfGrids( const unsigned int N ) VTK_OVERRIDE;
87
92 virtual void RegisterGrid( const int gridID, int extents[6],
93 vtkUnsignedCharArray* nodesGhostArray,
94 vtkUnsignedCharArray* cellGhostArray,
95 vtkPointData* pointData,
96 vtkCellData* cellData,
97 vtkPoints* gridNodes );
98
102 void GetGridExtent( const int gridID, int extent[6] );
103
108 void SetGhostedGridExtent( const int gridID, int ext[6] );
109
113 void GetGhostedGridExtent( const int gridID, int ext[6] );
114
118 void ComputeNeighbors() VTK_OVERRIDE;
119
124 int GetNumberOfNeighbors( const int gridID )
125 { return( static_cast<int>(this->Neighbors[ gridID ].size() )); };
126
131 vtkStructuredNeighbor GetGridNeighbor(const int gridID, const int nei);
132
140 vtkIdList* GetNeighbors( const int gridID, int *extents );
141
148 const int gridID,
149 vtkUnsignedCharArray *nodesArray,
150 vtkUnsignedCharArray *cellsArray ) VTK_OVERRIDE;
151
155 void CreateGhostLayers( const int N=1 ) VTK_OVERRIDE;
156
157protected:
160
164 bool InBounds( const int idx, const int Lo, const int Hi )
165 { return( (idx>=Lo) && (idx<=Hi) ); };
166
170 bool StrictlyInsideBounds( const int idx, const int Lo, const int Hi )
171 { return( (idx > Lo) && (idx < Hi) ); };
172
176 bool IsSubset( int A[2], int B[2] )
177 { return( this->InBounds(A[0], B[0], B[1]) &&
178 this->InBounds(A[1], B[0], B[1]) ); };
179
183 int Cardinality( int S[2] ) { return( S[1]-S[0]+1 ); };
184
186
189 int GetNumberOfNodesPerCell( const int dim )
190 {
191 int numNodes = 0;
192 switch( dim )
193 {
194 case 1:
195 numNodes = 2; // line cell
196 break;
197 case 2:
198 numNodes = 4; // quad cell
199 break;
200 case 3:
201 numNodes = 8; // hex cell
202 break;
203 default:
204 assert( "ERROR: code should not reach here!" && false );
205 } // END switch
206 return( numNodes );
207 }
209
214 const int gridID, const int dataDescription,
215 int GridExtent[6], int RealExtent[6], vtkUnsignedCharArray *nodeArray );
216
221 const int dataDescription, const int numNodesPerCell,
222 int dims[3], int CellExtent[6], vtkUnsignedCharArray *nodesArray,
223 vtkUnsignedCharArray *cellsArray );
224
231 const int gridID,
232 const int i, const int j, const int k,
233 vtkIdList *neiList );
234
240 const int gridID,
241 const int i, const int j, const int k,
242 int ext[6], int RealExtent[6], unsigned char &pfield );
243
249 unsigned char &pfield,
250 unsigned char *nodeGhostFields, const int numNodes );
251
255 void GetRealExtent( const int gridID, int GridExtent[6],int RealExtent[6] );
256
262 int GridExtent[6], int RealExtent[6],
263 const int i, const int j, const int k );
264
269 bool IsNodeOnBoundaryOfExtent(
270 const int i, const int j, const int k, int ext[6] );
271
278 const int gridID, int RealExtent[6],
279 const int i, const int j, const int k );
280
285 bool IsNodeOnBoundary( const int i, const int j, const int k );
286
291 bool IsNodeInterior(
292 const int i, const int j, const int k,
293 int GridExtent[6] );
294
300 const int i, const int j, const int k,
301 int GridExtent[6] )
302 {
303 bool status = false;
304
305 switch( this->DataDescription )
306 {
307 case VTK_X_LINE:
308 if( (GridExtent[0] <= i) && (i <= GridExtent[1]) )
309 {
310 status = true;
311 }
312 break;
313 case VTK_Y_LINE:
314 if( (GridExtent[2] <= j) && (j <= GridExtent[3] ) )
315 {
316 status = true;
317 }
318 break;
319 case VTK_Z_LINE:
320 if( (GridExtent[4] <= k) && (k <= GridExtent[5] ) )
321 {
322 status = true;
323 }
324 break;
325 case VTK_XY_PLANE:
326 if( (GridExtent[0] <= i) && (i <= GridExtent[1]) &&
327 (GridExtent[2] <= j) && (j <= GridExtent[3]) )
328 {
329 status = true;
330 }
331 break;
332 case VTK_YZ_PLANE:
333 if( (GridExtent[2] <= j) && (j <= GridExtent[3] ) &&
334 (GridExtent[4] <= k) && (k <= GridExtent[5] ) )
335 {
336 status = true;
337 }
338 break;
339 case VTK_XZ_PLANE:
340 if( (GridExtent[0] <= i) && (i <= GridExtent[1] ) &&
341 (GridExtent[4] <= k) && (k <= GridExtent[5] ) )
342 {
343 status = true;
344 }
345 break;
346 case VTK_XYZ_GRID:
347 if( (GridExtent[0] <= i) && (i <= GridExtent[1]) &&
348 (GridExtent[2] <= j) && (j <= GridExtent[3]) &&
349 (GridExtent[4] <= k) && (k <= GridExtent[5]) )
350 {
351 status = true;
352 }
353 break;
354 default:
355 std::cout << "Data description is: " << this->DataDescription << "\n";
356 std::cout.flush();
357 assert( "pre: Undefined data-description!" && false );
358 } // END switch
359
360 return( status );
361 }
362
367 const int i, const int j,
368 int i2jOrientation[3], int j2iOrientation[3],
369 int overlapExtent[6] );
370
379 void DetermineNeighborOrientation(
380 const int idx, int A[2], int B[2], int overlap[2], int orient[3] );
381
388 const int i, const int j, int ex1[6], int ex2[6],
389 int orientation[3], int ndim);
390
400 int IntervalOverlap( int A[2], int B[2], int overlap[2] );
401
411 int DoPartialOverlap( int s[2], int S[2], int overlap[2] );
412
423 int A[2], const int CofA,
424 int B[2], const int CofB,
425 int overlap[2] );
426
431 void EstablishNeighbors( const int i, const int j );
432
438
453 bool HasBlockConnection( const int gridID, const int blockDirection );
454
469 void RemoveBlockConnection( const int gridID, const int blockDirection );
470
485 void AddBlockConnection( const int gridID, const int blockDirection );
486
491 void ClearBlockConnections( const int gridID );
492
500 int GetNumberOfConnectingBlockFaces( const int gridID );
501
505 void SetBlockTopology( const int gridID );
506
514 const int i, const int j, const int k, int ext[6], int orientation[3] );
515
520 int Get1DOrientation(
521 const int idx, const int ExtentLo, const int ExtentHi,
522 const int OnLo, const int OnHi, const int NotOnBoundary );
523
528 void CreateGhostedExtent( const int gridID, const int N );
529
535 void GetGhostedExtent(
536 int *ghostedExtent, int GridExtent[6],
537 const int minIdx, const int maxIdx, const int N);
538
543 void CreateGhostedMaskArrays(const int gridID);
544
551 void InitializeGhostData( const int gridID );
552
558 void AllocatePointData( vtkPointData *RPD, const int N, vtkPointData *PD );
559
565 void AllocateCellData( vtkCellData *RCD, const int N, vtkCellData *CD );
566
571 void TransferRegisteredDataToGhostedData( const int gridID );
572
577 void ComputeNeighborSendAndRcvExtent( const int gridID, const int N );
578
584 virtual void TransferGhostDataFromNeighbors( const int gridID );
585
590 const int gridID, const vtkStructuredNeighbor& Neighor);
591
596 vtkPoints *source, vtkIdType sourceIdx,
597 vtkPoints *target, vtkIdType targetIdx );
598
606 vtkFieldData *source, vtkIdType sourceIdx,
607 vtkFieldData *target, vtkIdType targetIdx );
608
614 int GetNeighborIndex( const int gridIdx, const int NeighborGridIdx );
615
619 void PrintExtent( int extent[6] );
620
623 int WholeExtent[6];
624
625 std::vector< int > GridExtents;
626 std::vector< int > GhostedExtents;
627 std::vector< unsigned char > BlockTopology;
628 std::vector< std::vector<vtkStructuredNeighbor> > Neighbors;
629 std::map< std::pair< int,int >, int > NeighborPair2NeighborListIndex;
630
631private:
633 void operator=(const vtkStructuredGridConnectivity& ) VTK_DELETE_FUNCTION;
634};
635
636//=============================================================================
637// INLINE METHODS
638//=============================================================================
639
640//------------------------------------------------------------------------------
642 const int gridIdx, const int NeighborGridIdx )
643{
644 assert("pre: Grid index is out-of-bounds!" &&
645 (gridIdx >= 0) &&
646 (gridIdx < static_cast<int>(this->NumberOfGrids)));
647 assert("pre: Neighbor grid index is out-of-bounds!" &&
648 (NeighborGridIdx >= 0) &&
649 (NeighborGridIdx < static_cast<int>(this->NumberOfGrids) ) );
650
651 std::pair<int,int> gridPair = std::make_pair(gridIdx,NeighborGridIdx);
652 assert("pre: Neighboring grid pair does not exist in hash!" &&
653 (this->NeighborPair2NeighborListIndex.find(gridPair) !=
654 this->NeighborPair2NeighborListIndex.end() ) );
655
656 return(this->NeighborPair2NeighborListIndex[gridPair]);
657}
658
659//------------------------------------------------------------------------------
661 int *ghostedExtent, int GridExtent[6],
662 const int minIdx, const int maxIdx, const int N )
663{
664 assert( "pre: Number of ghost layers must be N >= 1" && (N >= 1) );
665 assert( "pre: ghosted extent pointer is NULL" && ghostedExtent != NULL);
666
667 ghostedExtent[minIdx] = GridExtent[minIdx]-N;
668 ghostedExtent[maxIdx] = GridExtent[maxIdx]+N;
669
670 // Clamp the ghosted extent to be within the WholeExtent
671 ghostedExtent[minIdx] =
672 (ghostedExtent[minIdx] < this->WholeExtent[minIdx] )?
673 this->WholeExtent[minIdx] : ghostedExtent[minIdx];
674 ghostedExtent[maxIdx] =
675 (ghostedExtent[maxIdx] > this->WholeExtent[maxIdx])?
676 this->WholeExtent[maxIdx] : ghostedExtent[maxIdx];
677}
678
679//------------------------------------------------------------------------------
681 const int gridID, int ext[6] )
682{
683 assert( "pre: gridID is out-of-bounds" &&
684 (gridID >= 0) && (gridID < static_cast<int>(this->NumberOfGrids)));
685 assert( "pre: ghosted-extents vector has not been allocated" &&
686 (this->NumberOfGrids == this->GhostedExtents.size()/6 ) );
687
688 for( int i=0; i < 6; ++i )
689 {
690 this->GhostedExtents[ gridID*6+i ] = ext[i];
691 }
692}
693
694//------------------------------------------------------------------------------
696 const int gridID, int ext[6])
697{
698 assert( "pre: gridID out-of-bounds!" &&
699 (gridID >= 0 && gridID < static_cast<int>(this->NumberOfGrids)));
700 for( int i=0; i < 6; ++i )
701 {
702 ext[i] = this->GridExtents[ gridID*6+i ];
703 }
704}
705
706//------------------------------------------------------------------------------
708 const int gridID, int ext[6])
709{
710 assert( "pre: gridID out-of-bounds!" &&
711 (gridID >= 0 && gridID < static_cast<int>(this->NumberOfGrids)));
712
713 if( this->GhostedExtents.size() == 0 )
714 {
715 ext[0] = ext[2] = ext[4] = -1;
716 ext[1] = ext[3] = ext[5] = 0;
717 vtkErrorMacro( "No ghosted extents found for registered grid extends!!!" );
718 return;
719 }
720
721 assert( "GhostedExtents are not aligned with registered grid extents" &&
722 ( this->GhostedExtents.size() == this->GridExtents.size() ) );
723 for( int i=0; i < 6; ++i )
724 {
725 ext[i] = this->GhostedExtents[ gridID*6+i ];
726 }
727}
728
729//------------------------------------------------------------------------------
731 const int i, const int j, const int k, int ext[6] )
732{
733 if( !this->IsNodeWithinExtent( i,j,k, ext) )
734 {
735 return false;
736 }
737
738 bool status = false;
739 switch( this->DataDescription )
740 {
741 case VTK_X_LINE:
742 if( i==ext[0] || i==ext[1] )
743 {
744 status = true;
745 }
746 break;
747 case VTK_Y_LINE:
748 if( j==ext[2] || j==ext[3] )
749 {
750 status = true;
751 }
752 break;
753 case VTK_Z_LINE:
754 if( k==ext[4] || k==ext[5] )
755 {
756 status = true;
757 }
758 break;
759 case VTK_XY_PLANE:
760 if( (i==ext[0] || i==ext[1]) ||
761 (j==ext[2] || j==ext[3]) )
762 {
763 status = true;
764 }
765 break;
766 case VTK_YZ_PLANE:
767 if( (j==ext[2] || j==ext[3]) ||
768 (k==ext[4] || k==ext[5]) )
769 {
770 status = true;
771 }
772 break;
773 case VTK_XZ_PLANE:
774 if( (i==ext[0] || i==ext[1]) ||
775 (k==ext[4] || k==ext[5]) )
776 {
777 status = true;
778 }
779 break;
780 case VTK_XYZ_GRID:
781 if( (i==ext[0] || i==ext[1]) ||
782 (j==ext[2] || j==ext[3]) ||
783 (k==ext[4] || k==ext[5]) )
784 {
785 status = true;
786 }
787 break;
788 default:
789 std::cout << "Data description is: " << this->DataDescription << "\n";
790 std::cout.flush();
791 assert( "pre: Undefined data-description!" && false );
792 } // END switch
793
794 return( status );
795}
796
797//------------------------------------------------------------------------------
799 const int i, const int j, const int k,
800 int GridExtent[6] )
801{
802 bool status = false;
803
804 switch( this->DataDescription )
805 {
806 case VTK_X_LINE:
807 if( (GridExtent[0] < i) && (i < GridExtent[1]) )
808 {
809 status = true;
810 }
811 break;
812 case VTK_Y_LINE:
813 if( (GridExtent[2] < j) && (j < GridExtent[3] ) )
814 {
815 status = true;
816 }
817 break;
818 case VTK_Z_LINE:
819 if( (GridExtent[4] < k) && (k < GridExtent[5] ) )
820 {
821 status = true;
822 }
823 break;
824 case VTK_XY_PLANE:
825 if( (GridExtent[0] < i) && (i < GridExtent[1]) &&
826 (GridExtent[2] < j) && (j < GridExtent[3]) )
827 {
828 status = true;
829 }
830 break;
831 case VTK_YZ_PLANE:
832 if( (GridExtent[2] < j) && (j < GridExtent[3] ) &&
833 (GridExtent[4] < k) && (k < GridExtent[5] ) )
834 {
835 status = true;
836 }
837 break;
838 case VTK_XZ_PLANE:
839 if( (GridExtent[0] < i) && (i < GridExtent[1] ) &&
840 (GridExtent[4] < k) && (k < GridExtent[5] ) )
841 {
842 status = true;
843 }
844 break;
845 case VTK_XYZ_GRID:
846 if( (GridExtent[0] < i) && (i < GridExtent[1]) &&
847 (GridExtent[2] < j) && (j < GridExtent[3]) &&
848 (GridExtent[4] < k) && (k < GridExtent[5]) )
849 {
850 status = true;
851 }
852 break;
853 default:
854 std::cout << "Data description is: " << this->DataDescription << "\n";
855 std::cout.flush();
856 assert( "pre: Undefined data-description!" && false );
857 } // END switch
858
859 return( status );
860}
861
862//------------------------------------------------------------------------------
864 const int idx, int A[2], int B[2], int overlap[2], int orient[3] )
865{
866 assert( "pre: idx is out-of-bounds" && (idx >= 0) && (idx < 3) );
867
868 // A. Non-overlapping cases
869 if( overlap[0] == overlap[1] )
870 {
871 if( A[1] == B[0] )
872 {
873 orient[ idx ] = vtkStructuredNeighbor::HI;
874 }
875 else if( A[0] == B[1] )
876 {
877 orient[ idx ] = vtkStructuredNeighbor::LO;
878 }
879 else
880 {
881 orient[ idx ] = vtkStructuredNeighbor::UNDEFINED;
882 assert( "ERROR: Code should not reach here!" && false );
883 }
884 } // END non-overlapping cases
885 // B. Sub-set cases
886 else if( this->IsSubset( A, B) )
887 {
888 if( (A[0] == B[0]) && (A[1] == B[1]) )
889 {
890 orient[ idx ] = vtkStructuredNeighbor::ONE_TO_ONE;
891 }
892 else if( this->StrictlyInsideBounds( A[0], B[0], B[1] ) &&
893 this->StrictlyInsideBounds( A[1], B[0], B[1] ) )
894 {
896 }
897 else if( A[0] == B[0] )
898 {
899 orient[ idx ] = vtkStructuredNeighbor::SUBSET_HI;
900 }
901 else if( A[1] == B[1] )
902 {
903 orient[ idx ] = vtkStructuredNeighbor::SUBSET_LO;
904 }
905 else
906 {
907 orient[ idx ] = vtkStructuredNeighbor::UNDEFINED;
908 assert( "ERROR: Code should not reach here!" && false );
909 }
910 }
911 // C. Super-set cases
912 else if( this->IsSubset( B, A ) )
913 {
914 orient[ idx ] = vtkStructuredNeighbor::SUPERSET;
915 }
916 // D. Partially-overlapping (non-subset) cases
917 else if( !(this->IsSubset(A,B) || this->IsSubset(A,B)) )
918 {
919 if( this->InBounds( A[0], B[0], B[1] ) )
920 {
921 orient[ idx ] = vtkStructuredNeighbor::LO;
922 }
923 else if( this->InBounds( A[1], B[0], B[1] ) )
924 {
925 orient[ idx ] = vtkStructuredNeighbor::HI;
926 }
927 else
928 {
929 orient[ idx ] = vtkStructuredNeighbor::UNDEFINED;
930 assert( "ERROR: Code should not reach here!" && false );
931 }
932 }
933 else
934 {
935 orient[ idx ] = vtkStructuredNeighbor::UNDEFINED;
936 assert( "ERROR: Code should not reach here!" && false );
937 }
938}
939
940//------------------------------------------------------------------------------
942 const int idx, const int ExtentLo, const int ExtentHi,
943 const int OnLo, const int OnHi, const int NotOnBoundary )
944{
945 if( idx == ExtentLo )
946 {
947 return OnLo;
948 }
949 else if( idx == ExtentHi )
950 {
951 return OnHi;
952 }
953 return NotOnBoundary;
954}
955
956//------------------------------------------------------------------------------
958 const int gridID, const int blockDirection )
959{
960 // Sanity check
961 assert("pre: gridID is out-of-bounds" &&
962 (gridID >=0) && (gridID < static_cast<int>(this->NumberOfGrids)));
963 assert("pre: BlockTopology has not been properly allocated" &&
964 (this->NumberOfGrids == this->BlockTopology.size()));
965 assert("pre: blockDirection is out-of-bounds" &&
966 (blockDirection >= 0) && (blockDirection < 6) );
967 bool status = false;
968 if( this->BlockTopology[ gridID ] & (1 << blockDirection) )
969 {
970 status = true;
971 }
972 return( status );
973}
974
975//------------------------------------------------------------------------------
977 const int gridID, const int blockDirection )
978{
979 // Sanity check
980 assert("pre: gridID is out-of-bounds" &&
981 (gridID >=0) && (gridID < static_cast<int>(this->NumberOfGrids)));
982 assert("pre: BlockTopology has not been properly allocated" &&
983 (this->NumberOfGrids == this->BlockTopology.size()));
984 assert("pre: blockDirection is out-of-bounds" &&
985 (blockDirection >= 0) && (blockDirection < 6) );
986
987 this->BlockTopology[ gridID ] &= ~(1 << blockDirection);
988}
989
990//------------------------------------------------------------------------------
992 const int gridID, const int blockDirection )
993{
994 // Sanity check
995 assert("pre: gridID is out-of-bounds" &&
996 (gridID >=0) && (gridID < static_cast<int>(this->NumberOfGrids)));
997 assert("pre: BlockTopology has not been properly allocated" &&
998 (this->NumberOfGrids == this->BlockTopology.size()));
999 assert("pre: blockDirection is out-of-bounds" &&
1000 (blockDirection >= 0) && (blockDirection < 6) );
1001 this->BlockTopology[ gridID ] |= (1 << blockDirection);
1002}
1003
1004//------------------------------------------------------------------------------
1006 const int gridID )
1007{
1008 // Sanity check
1009 assert("pre: gridID is out-of-bounds" &&
1010 (gridID >=0) && (gridID < static_cast<int>(this->NumberOfGrids)));
1011 assert("pre: BlockTopology has not been properly allocated" &&
1012 (this->NumberOfGrids == this->BlockTopology.size()));
1013 for( int i=0; i < 6; ++i )
1014 {
1015 this->RemoveBlockConnection( gridID, i );
1016 } // END for all block directions
1017}
1018
1019//------------------------------------------------------------------------------
1021 const int gridID )
1022{
1023 // Sanity check
1024 assert("pre: gridID is out-of-bounds" &&
1025 (gridID >=0) && (gridID < static_cast<int>(this->NumberOfGrids)));
1026 assert("pre: BlockTopology has not been properly allocated" &&
1027 (this->NumberOfGrids == this->BlockTopology.size()));
1028
1029 int count = 0;
1030 for( int i=0; i < 6; ++i )
1031 {
1032 if( this->HasBlockConnection( gridID, i ) )
1033 {
1034 ++count;
1035 }
1036 }
1037 assert( "post: count must be in [0,5]" && (count >=0 && count <= 6) );
1038 return( count );
1039}
1040
1041//------------------------------------------------------------------------------
1043 const unsigned int N )
1044{
1045 if (N == 0)
1046 {
1047 vtkErrorMacro("Number of grids cannot be 0.");
1048 return;
1049 }
1050
1051 this->NumberOfGrids = N;
1053
1054 this->GridExtents.resize( 6*N,-1);
1055 this->Neighbors.resize( N );
1056 this->BlockTopology.resize( N );
1057}
1058#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:39
represent and manipulate fields of data
Definition: vtkFieldData.h:57
list of point or cell ids
Definition: vtkIdList.h:37
a simple class to control print indentation
Definition: vtkIndent.h:40
represent and manipulate point attribute data
Definition: vtkPointData.h:38
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.
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 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 &Neighor)
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.
std::vector< unsigned char > BlockTopology
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...
std::vector< std::vector< vtkStructuredNeighbor > > Neighbors
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...
int PartialOverlap(int A[2], const int CofA, int B[2], const int CofB, int overlap[2])
Checks if the intervals A,B partially overlap.
std::map< std::pair< int, int >, int > NeighborPair2NeighborListIndex
void FillGhostArrays(const int gridID, vtkUnsignedCharArray *nodesArray, vtkUnsignedCharArray *cellsArray) override
Filles 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.
void FillNodesGhostArray(const int gridID, const int dataDescription, int GridExtent[6], int RealExtent[6], vtkUnsignedCharArray *nodeArray)
Fills the the ghost array for the nodes.
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.
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...
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.
static vtkStructuredGridConnectivity * New()
int IntervalOverlap(int A[2], int B[2], int overlap[2])
Checks if the intervals A,B overlap.
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:262
@ extent
Definition: vtkX3D.h:345
@ size
Definition: vtkX3D.h:253
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:287