Go to the documentation of this file.
31 #ifndef vtkStructuredGridConnectivity_H_
32 #define vtkStructuredGridConnectivity_H_
34 #define VTK_NO_OVERLAP 0
35 #define VTK_NODE_OVERLAP 1
36 #define VTK_EDGE_OVERLAP 2
37 #define VTK_PARTIAL_OVERLAP 3
94 void GetGridExtent(
const int gridID,
int extent[6] );
98 void SetGhostedGridExtent(
const int gridID,
int ext[6] );
101 void GetGhostedGridExtent(
const int gridID,
int ext[6] );
110 {
return(
static_cast<int>(this->Neighbors[ gridID ].
size() )); };
141 bool InBounds(
const int idx,
const int Lo,
const int Hi )
142 {
return( (idx>=Lo) && (idx<=Hi) ); };
148 {
return( (idx > Lo) && (idx < Hi) ); };
154 {
return( this->InBounds(A[0], B[0], B[1]) &&
155 this->InBounds(A[1], B[0], B[1]) ); };
179 assert(
"ERROR: code should not reach here!" &&
false );
188 const int gridID,
const int dataDescription,
195 const int dataDescription,
const int numNodesPerCell,
206 const int i,
const int j,
const int k,
215 const int i,
const int j,
const int k,
216 int ext[6],
int RealExtent[6],
unsigned char &pfield );
223 unsigned char &pfield,
224 unsigned char *nodeGhostFields,
const int numNodes );
228 void GetRealExtent(
const int gridID,
int GridExtent[6],
int RealExtent[6] );
234 int GridExtent[6],
int RealExtent[6],
235 const int i,
const int j,
const int k );
241 bool IsNodeOnBoundaryOfExtent(
242 const int i,
const int j,
const int k,
int ext[6] );
250 const int gridID,
int RealExtent[6],
251 const int i,
const int j,
const int k );
263 const int i,
const int j,
const int k,
272 const int i,
const int j,
const int k,
278 switch( this->DataDescription )
281 if( (GridExtent[0] <= i) && (i <= GridExtent[1]) )
287 if( (GridExtent[2] <= j) && (j <= GridExtent[3] ) )
293 if( (GridExtent[4] <= k) && (k <= GridExtent[5] ) )
299 if( (GridExtent[0] <= i) && (i <= GridExtent[1]) &&
300 (GridExtent[2] <= j) && (j <= GridExtent[3]) )
306 if( (GridExtent[2] <= j) && (j <= GridExtent[3] ) &&
307 (GridExtent[4] <= k) && (k <= GridExtent[5] ) )
313 if( (GridExtent[0] <= i) && (i <= GridExtent[1] ) &&
314 (GridExtent[4] <= k) && (k <= GridExtent[5] ) )
320 if( (GridExtent[0] <= i) && (i <= GridExtent[1]) &&
321 (GridExtent[2] <= j) && (j <= GridExtent[3]) &&
322 (GridExtent[4] <= k) && (k <= GridExtent[5]) )
328 std::cout <<
"Data description is: " << this->DataDescription <<
"\n";
330 assert(
"pre: Undefined data-description!" &&
false );
339 const int i,
const int j,
340 int i2jOrientation[3],
int j2iOrientation[3],
341 int overlapExtent[6] );
351 void DetermineNeighborOrientation(
352 const int idx,
int A[2],
int B[2],
int overlap[2],
int orient[3] );
360 const int i,
const int j,
int ex1[6],
int ex2[6],
385 int A[2],
const int CofA,
386 int B[2],
const int CofB,
406 bool HasBlockConnection(
const int gridID,
const int blockDirection );
415 void RemoveBlockConnection(
const int gridID,
const int blockDirection );
424 void AddBlockConnection(
const int gridID,
const int blockDirection );
428 void ClearBlockConnections(
const int gridID );
435 int GetNumberOfConnectingBlockFaces(
const int gridID );
448 const int i,
const int j,
const int k,
int ext[6],
int orientation[3] );
454 int Get1DOrientation(
455 const int idx,
const int ExtentLo,
const int ExtentHi,
456 const int OnLo,
const int OnHi,
const int NotOnBoundary );
467 void GetGhostedExtent(
468 int *ghostedExtent,
int GridExtent[6],
469 const int minIdx,
const int maxIdx,
const int N);
533 int GetNeighborIndex(
const int gridIdx,
const int NeighborGridIdx );
546 std::vector< std::vector<vtkStructuredNeighbor> >
Neighbors;
561 const int gridIdx,
const int NeighborGridIdx )
563 assert(
"pre: Grid index is out-of-bounds!" &&
566 assert(
"pre: Neighbor grid index is out-of-bounds!" &&
567 (NeighborGridIdx >= 0) &&
568 (NeighborGridIdx <
static_cast<int>(this->
NumberOfGrids) ) );
570 std::pair<int,int> gridPair = std::make_pair(gridIdx,NeighborGridIdx);
571 assert(
"pre: Neighboring grid pair does not exist in hash!" &&
573 this->NeighborPair2NeighborListIndex.end() ) );
580 int *ghostedExtent,
int GridExtent[6],
581 const int minIdx,
const int maxIdx,
const int N )
583 assert(
"pre: Number of ghost layers must be N >= 1" && (N >= 1) );
584 assert(
"pre: ghosted extent pointer is NULL" && ghostedExtent != NULL);
586 ghostedExtent[minIdx] = GridExtent[minIdx]-N;
587 ghostedExtent[maxIdx] = GridExtent[maxIdx]+N;
590 ghostedExtent[minIdx] =
591 (ghostedExtent[minIdx] < this->
WholeExtent[minIdx] )?
593 ghostedExtent[maxIdx] =
594 (ghostedExtent[maxIdx] > this->
WholeExtent[maxIdx])?
600 const int gridID,
int ext[6] )
602 assert(
"pre: gridID is out-of-bounds" &&
603 (gridID >= 0) && (gridID <
static_cast<int>(this->
NumberOfGrids)));
604 assert(
"pre: ghosted-extents vector has not been allocated" &&
607 for(
int i=0; i < 6; ++i )
615 const int gridID,
int ext[6])
617 assert(
"pre: gridID out-of-bounds!" &&
618 (gridID >= 0 && gridID <
static_cast<int>(this->
NumberOfGrids)));
619 for(
int i=0; i < 6; ++i )
627 const int gridID,
int ext[6])
629 assert(
"pre: gridID out-of-bounds!" &&
630 (gridID >= 0 && gridID <
static_cast<int>(this->
NumberOfGrids)));
634 ext[0] = ext[2] = ext[4] = -1;
635 ext[1] = ext[3] = ext[5] = 0;
636 vtkErrorMacro(
"No ghosted extents found for registered grid extends!!!" );
640 assert(
"GhostedExtents are not aligned with registered grid extents" &&
642 for(
int i=0; i < 6; ++i )
650 const int i,
const int j,
const int k,
int ext[6] )
661 if( i==ext[0] || i==ext[1] )
667 if( j==ext[2] || j==ext[3] )
673 if( k==ext[4] || k==ext[5] )
679 if( (i==ext[0] || i==ext[1]) ||
680 (j==ext[2] || j==ext[3]) )
686 if( (j==ext[2] || j==ext[3]) ||
687 (k==ext[4] || k==ext[5]) )
693 if( (i==ext[0] || i==ext[1]) ||
694 (k==ext[4] || k==ext[5]) )
700 if( (i==ext[0] || i==ext[1]) ||
701 (j==ext[2] || j==ext[3]) ||
702 (k==ext[4] || k==ext[5]) )
710 assert(
"pre: Undefined data-description!" &&
false );
718 const int i,
const int j,
const int k,
726 if( (GridExtent[0] < i) && (i < GridExtent[1]) )
732 if( (GridExtent[2] < j) && (j < GridExtent[3] ) )
738 if( (GridExtent[4] < k) && (k < GridExtent[5] ) )
744 if( (GridExtent[0] < i) && (i < GridExtent[1]) &&
745 (GridExtent[2] < j) && (j < GridExtent[3]) )
751 if( (GridExtent[2] < j) && (j < GridExtent[3] ) &&
752 (GridExtent[4] < k) && (k < GridExtent[5] ) )
758 if( (GridExtent[0] < i) && (i < GridExtent[1] ) &&
759 (GridExtent[4] < k) && (k < GridExtent[5] ) )
765 if( (GridExtent[0] < i) && (i < GridExtent[1]) &&
766 (GridExtent[2] < j) && (j < GridExtent[3]) &&
767 (GridExtent[4] < k) && (k < GridExtent[5]) )
775 assert(
"pre: Undefined data-description!" &&
false );
783 const int idx,
int A[2],
int B[2],
int overlap[2],
int orient[3] )
785 assert(
"pre: idx is out-of-bounds" && (idx >= 0) && (idx < 3) );
788 if( overlap[0] == overlap[1] )
794 else if( A[0] == B[1] )
801 assert(
"ERROR: Code should not reach here!" &&
false );
807 if( (A[0] == B[0]) && (A[1] == B[1]) )
816 else if( A[0] == B[0] )
820 else if( A[1] == B[1] )
827 assert(
"ERROR: Code should not reach here!" &&
false );
838 if( this->
InBounds( A[0], B[0], B[1] ) )
842 else if( this->
InBounds( A[1], B[0], B[1] ) )
849 assert(
"ERROR: Code should not reach here!" &&
false );
855 assert(
"ERROR: Code should not reach here!" &&
false );
861 const int idx,
const int ExtentLo,
const int ExtentHi,
862 const int OnLo,
const int OnHi,
const int NotOnBoundary )
864 if( idx == ExtentLo )
868 else if( idx == ExtentHi )
872 return NotOnBoundary;
877 const int gridID,
const int blockDirection )
880 assert(
"pre: gridID is out-of-bounds" &&
881 (gridID >=0) && (gridID <
static_cast<int>(this->
NumberOfGrids)));
882 assert(
"pre: BlockTopology has not been properly allocated" &&
884 assert(
"pre: blockDirection is out-of-bounds" &&
885 (blockDirection >= 0) && (blockDirection < 6) );
896 const int gridID,
const int blockDirection )
899 assert(
"pre: gridID is out-of-bounds" &&
900 (gridID >=0) && (gridID <
static_cast<int>(this->
NumberOfGrids)));
901 assert(
"pre: BlockTopology has not been properly allocated" &&
903 assert(
"pre: blockDirection is out-of-bounds" &&
904 (blockDirection >= 0) && (blockDirection < 6) );
911 const int gridID,
const int blockDirection )
914 assert(
"pre: gridID is out-of-bounds" &&
915 (gridID >=0) && (gridID <
static_cast<int>(this->
NumberOfGrids)));
916 assert(
"pre: BlockTopology has not been properly allocated" &&
918 assert(
"pre: blockDirection is out-of-bounds" &&
919 (blockDirection >= 0) && (blockDirection < 6) );
928 assert(
"pre: gridID is out-of-bounds" &&
929 (gridID >=0) && (gridID <
static_cast<int>(this->
NumberOfGrids)));
930 assert(
"pre: BlockTopology has not been properly allocated" &&
932 for(
int i=0; i < 6; ++i )
943 assert(
"pre: gridID is out-of-bounds" &&
944 (gridID >=0) && (gridID <
static_cast<int>(this->
NumberOfGrids)));
945 assert(
"pre: BlockTopology has not been properly allocated" &&
949 for(
int i=0; i < 6; ++i )
956 assert(
"post: count must be in [0,5]" && (
count >=0 &&
count <= 6) );
962 const unsigned int N )
represent and manipulate 3D points
#define vtkGetVector6Macro(name, type)
void CopyFieldData(vtkFieldData *source, vtkIdType sourceIdx, vtkFieldData *target, vtkIdType targetIdx)
int GetNeighborIndex(const int gridIdx, const int NeighborGridIdx)
void GetGhostedExtent(int *ghostedExtent, int GridExtent[6], const int minIdx, const int maxIdx, const int N)
GLuint GLuint GLsizei count
represent and manipulate point attribute data
void ClearBlockConnections(const int gridID)
#define VTKFILTERSGEOMETRY_EXPORT
void AcquireDataDescription()
void AllocateCellData(vtkCellData *RCD, const int N, vtkCellData *CD)
vtkStructuredNeighbor GetGridNeighbor(const int gridID, const int nei)
void SetBlockTopology(const int gridID)
std::map< std::pair< int, int >, int > NeighborPair2NeighborListIndex
bool HasBlockConnection(const int gridID, const int blockDirection)
dynamic, self-adjusting array of unsigned char
#define vtkTypeMacro(thisClass, superclass)
void SetNeighbors(const int i, const int j, int i2jOrientation[3], int j2iOrientation[3], int overlapExtent[6])
vtkStructuredGridConnectivity()
int GetNumberOfNodesPerCell(const int dim)
void SetGhostedGridExtent(const int gridID, int ext[6])
void AllocatePointData(vtkPointData *RPD, const int N, vtkPointData *PD)
int IntervalOverlap(int A[2], int B[2], int overlap[2])
void AddBlockConnection(const int gridID, const int blockDirection)
represent and manipulate fields of data
void DetectNeighbors(const int i, const int j, int ex1[6], int ex2[6], int orientation[3], int ndim)
virtual void SetNumberOfGrids(const unsigned int N)=0
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
std::vector< std::vector< vtkStructuredNeighbor > > Neighbors
void AllocateUserRegisterDataStructures()
bool IsNodeOnSharedBoundary(const int gridID, int RealExtent[6], const int i, const int j, const int k)
void ComputeNeighborSendAndRcvExtent(const int gridID, const int N)
bool IsNodeOnBoundary(const int i, const int j, const int k)
bool IsNodeInterior(const int i, const int j, const int k, int GridExtent[6])
vtkIdList * GetNeighbors(const int gridID, int *extents)
bool IsNodeWithinExtent(const int i, const int j, const int k, int GridExtent[6])
int GetNumberOfNeighbors(const int gridID)
int Get1DOrientation(const int idx, const int ExtentLo, const int ExtentHi, const int OnLo, const int OnHi, const int NotOnBoundary)
unsigned int NumberOfGrids
void CreateGhostedExtent(const int gridID, const int N)
bool IsNodeOnBoundaryOfExtent(const int i, const int j, const int k, int ext[6])
represent and manipulate cell attribute data
virtual void RegisterGrid(const int gridID, int extents[6], vtkUnsignedCharArray *nodesGhostArray, vtkUnsignedCharArray *cellGhostArray, vtkPointData *pointData, vtkCellData *cellData, vtkPoints *gridNodes)
bool InBounds(const int idx, const int Lo, const int Hi)
a simple class to control print indentation
void CopyCoordinates(vtkPoints *source, vtkIdType sourceIdx, vtkPoints *target, vtkIdType targetIdx)
void RemoveBlockConnection(const int gridID, const int blockDirection)
void GetGridExtent(const int gridID, int extent[6])
virtual void CreateGhostLayers(const int N=1)
list of point or cell ids
virtual void ComputeNeighbors()
void MarkCellProperty(unsigned char &pfield, unsigned char *nodeGhostFields, const int numNodes)
int DoPartialOverlap(int s[2], int S[2], int overlap[2])
void EstablishNeighbors(const int i, const int j)
virtual ~vtkStructuredGridConnectivity()
void PrintSelf(ostream &os, vtkIndent indent)
void TransferLocalNeighborData(const int gridID, const vtkStructuredNeighbor &Neighor)
#define vtkGetMacro(name, type)
virtual void TransferGhostDataFromNeighbors(const int gridID)
void DetermineNeighborOrientation(const int idx, int A[2], int B[2], int overlap[2], int orient[3])
bool IsGhostNode(int GridExtent[6], int RealExtent[6], const int i, const int j, const int k)
void InitializeGhostData(const int gridID)
void SearchNeighbors(const int gridID, const int i, const int j, const int k, vtkIdList *neiList)
void MarkNodeProperty(const int gridID, const int i, const int j, const int k, int ext[6], int RealExtent[6], unsigned char &pfield)
void FillGhostArrays(const int gridID, vtkUnsignedCharArray *nodesArray, vtkUnsignedCharArray *cellsArray)
std::vector< int > GhostedExtents
void FillCellsGhostArray(const int dataDescription, const int numNodesPerCell, int dims[3], int CellExtent[6], vtkUnsignedCharArray *nodesArray, vtkUnsignedCharArray *cellsArray)
std::vector< int > GridExtents
static vtkStructuredGridConnectivity * New()
void CreateGhostedMaskArrays(const int gridID)
#define vtkSetVector6Macro(name, type)
virtual void SetNumberOfGrids(const unsigned int N)
bool StrictlyInsideBounds(const int idx, const int Lo, const int Hi)
int Cardinality(int S[2])
void GetIJKBlockOrientation(const int i, const int j, const int k, int ext[6], int orientation[3])
int PartialOverlap(int A[2], const int CofA, int B[2], const int CofB, int overlap[2])
bool IsSubset(int A[2], int B[2])
int GetNumberOfConnectingBlockFaces(const int gridID)
void GetRealExtent(const int gridID, int GridExtent[6], int RealExtent[6])
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
void GetGhostedGridExtent(const int gridID, int ext[6])
void FillNodesGhostArray(const int gridID, const int dataDescription, int GridExtent[6], int RealExtent[6], vtkUnsignedCharArray *nodeArray)
void PrintExtent(int extent[6])
void TransferRegisteredDataToGhostedData(const int gridID)
std::vector< unsigned char > BlockTopology