22 #ifndef vtkStructuredAMRGridConnectivity_h
23 #define vtkStructuredAMRGridConnectivity_h
26 #include "vtkFiltersGeometryModule.h"
36 VTK_ABI_NAMESPACE_BEGIN
52 void Initialize(
unsigned int NumberOfLevels,
unsigned int N,
int RefinementRatio = -1);
69 virtual void RegisterGrid(
int gridIdx,
int level,
int refinementRatio,
int extents[6],
78 virtual void RegisterGrid(
int gridIdx,
int level,
int extents[6],
88 vtkSetMacro(BalancedRefinement,
bool);
89 vtkGetMacro(BalancedRefinement,
bool);
98 vtkSetMacro(NodeCentered,
bool);
99 vtkGetMacro(NodeCentered,
bool);
107 vtkSetMacro(CellCentered,
bool);
108 vtkGetMacro(CellCentered,
bool);
115 int GetNumberOfNeighbors(
int gridID);
120 void GetGhostedExtent(
int gridID,
int ext[6]);
139 void CreateGhostedMaskArrays(
int gridID);
144 void CreateGhostedExtent(
int gridID,
int N);
149 void SetGhostedExtent(
int gridID,
int ext[6]);
154 void GetCoarsenedExtent(
int gridIdx,
int fromLevel,
int toLevel,
int ext[6]);
159 void GetRefinedExtent(
int gridIdx,
int fromLevel,
int toLevel,
int ext[6]);
164 void RefineExtent(
int orient[3],
int ndim,
int fromLevel,
int toLevel,
int ext[6]);
170 void GetCellRefinedExtent(
171 int orient[3],
int ndim,
int i,
int j,
int k,
int fromLevel,
int toLevel,
int ext[6]);
176 void CoarsenExtent(
int orient[3],
int ndim,
int fromLevel,
int toLevel,
int ext[6]);
181 void GetGridExtent(
int gridIdx,
int ext[6]);
186 int GetGridLevel(
int gridIdx);
191 bool LevelExists(
int level);
196 bool IsNodeInterior(
int i,
int j,
int k,
int GridExtent[6]);
201 bool IsNodeWithinExtent(
int i,
int j,
int k,
int GridExtent[6]);
206 bool IsNodeOnSharedBoundary(
int i,
int j,
int k,
int gridId,
int gridExt[6]);
211 bool IsNodeOnBoundaryOfExtent(
int i,
int j,
int k,
int ext[6]);
216 void InsertGridAtLevel(
int level,
int gridID);
222 void ComputeNeighborSendAndRcvExtent(
int gridID,
int N);
228 void ComputeWholeExtent();
234 void GetWholeExtentAtLevel(
int level,
int ext[6]);
240 void EstablishNeighbors(
int i,
int j);
245 void GetNodeOrientation(
int i,
int j,
int k,
int gridExt[6],
int nodeOrientation[3]);
254 void GetOrientationVector(
int dataDescription,
int orient[3],
int& ndim);
259 bool HasConstantRefinementRatio();
264 void SetRefinementRatioAtLevel(
int level,
int r);
269 int GetRefinementRatioAtLevel(
int level);
274 bool AreExtentsEqual(
int ext1[6],
int ext2[6]);
279 void SetBlockTopology(
int gridID);
288 int GetNumberOfConnectingBlockFaces(
int gridID);
308 assert(
"pre: gridID is out-of-bounds" && (gridID >= 0) &&
309 (gridID < static_cast<int>(this->NumberOfGrids)));
310 assert(
"pre: BlockTopology has not been properly allocated" &&
311 (this->NumberOfGrids == this->BlockTopology.size()));
312 assert(
"pre: blockDirection is out-of-bounds" && (blockDirection >= 0) && (blockDirection < 6));
314 if (this->BlockTopology[gridID] & (1 << blockDirection))
336 void RemoveBlockConnection(
int gridID,
int blockDirection);
352 void AddBlockConnection(
int gridID,
int blockDirection);
358 void ClearBlockConnections(
int gridID);
363 virtual void MarkNodeProperty(
364 int gridId,
int i,
int j,
int k,
int gridExt[6],
int wholeExt[6],
unsigned char& p);
401 void ComputeAMRNeighborOverlapExtents(
int iLevel,
int jLevel,
int normalizedLevel,
403 int neiOverlapExtent[6]);
408 int Get1DOrientation(
int idx,
int ExtentLo,
int ExtentHi,
int OnLo,
int OnHi,
int NotOnBoundary);
413 void PrintExtent(std::ostream& os,
int ext[6]);
418 void InitializeGhostData(
int gridID);
423 void TransferRegisteredDataToGhostedData(
int gridID);
460 virtual void TransferGhostDataFromNeighbors(
int gridID);
466 void AverageFieldData(
503 std::vector<std::vector<vtkStructuredAMRNeighbor>>
Neighbors;
526 assert(
"pre: grid ID is out-of-bounds" && (gridID >= 0) &&
528 assert(
"pre: neighbors vector has not been properly allocated" &&
536 assert(
"pre: grid ID is out-of-bounds" && (gridID >= 0) &&
538 assert(
"pre: neighbors vector has not been properly allocated" &&
540 assert(
"pre: nei index is out-of-bounds" && (nei >= 0) &&
547 int idx,
int ExtentLo,
int ExtentHi,
int OnLo,
int OnHi,
int NotOnBoundary)
553 else if (idx == ExtentHi)
557 return NotOnBoundary;
564 assert(
"pre: gridID is out-of-bounds" && (gridID >= 0) &&
566 assert(
"pre: BlockTopology has not been properly allocated" &&
570 for (
int i = 0; i < 6; ++i)
577 assert(
"post: count must be in [0,5]" && (count >= 0 && count <= 6));
585 assert(
"pre: gridID is out-of-bounds" && (gridID >= 0) &&
587 assert(
"pre: BlockTopology has not been properly allocated" &&
589 assert(
"pre: blockDirection is out-of-bounds" && (blockDirection >= 0) && (blockDirection < 6));
598 assert(
"pre: gridID is out-of-bounds" && (gridID >= 0) &&
600 assert(
"pre: BlockTopology has not been properly allocated" &&
602 assert(
"pre: blockDirection is out-of-bounds" && (blockDirection >= 0) && (blockDirection < 6));
610 assert(
"pre: gridID is out-of-bounds" && (gridID >= 0) &&
612 assert(
"pre: BlockTopology has not been properly allocated" &&
614 for (
int i = 0; i < 6; ++i)
623 for (
int i = 0; i < 6; ++i)
625 if (ext1[i] != ext2[i])
636 for (
int i = 0; i < 6; i += 2)
640 os << ext[i + 1] <<
"] ";
647 assert(
"pre: grid Index is out-of-bounds!" && (gridIdx < static_cast<int>(this->
NumberOfGrids)));
648 assert(
"pre: grid levels vector has not been allocated" &&
656 assert(
"pre: RefinementRatios vector is not properly allocated" &&
658 assert(
"pre: leve is out-of-bounds!" && (level >= 0) &&
660 assert(
"pre: invalid refinement ratio" && (r >= 2));
668 assert(
"pre: RefinementRatios vector is not properly allocated" &&
670 assert(
"pre: leve is out-of-bounds!" && (level >= 0) &&
673 "pre: refinement ratio for level has not been set" && (this->
RefinementRatios[level] >= 2));
691 assert(
"pre: grid index is out-of-bounds" &&
692 ((gridIdx >= 0) && (gridIdx < static_cast<int>(this->
GridExtents.size()))));
694 for (
int i = 0; i < 6; ++i)
720 grids.insert(gridID);
725 VTK_ABI_NAMESPACE_END
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int GetGridLevel(int gridIdx)
Returns the level of the grid with the corresponding grid ID.
vtkStructuredAMRNeighbor GetNeighbor(int gridID, int nei)
Returns the AMR neighbor for the patch with the corresponding grid ID.
std::vector< unsigned char > BlockTopology
void RemoveBlockConnection(int gridID, int blockDirection)
Removes a block connection along the given direction for the block corresponding to the given gridID...
std::vector< int > GridExtents
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 ...
std::vector< int > RefinementRatios
represent and manipulate point attribute data
void GetGridExtent(int gridIdx, int ext[6])
Gets the grid extent for the grid with the given grid ID.
bool LevelExists(int level)
Checks if the given level has been registered.
std::map< int, std::set< int > > AMRHierarchy
unsigned int NumberOfLevels
virtual void ComputeNeighbors()=0
Computes the grid neighboring topology for the domain.
represent and manipulate cell attribute data
std::vector< int > GridLevels
std::vector< std::vector< int > > CellCenteredDonorLevel
int Get1DOrientation(int idx, int ExtentLo, int ExtentHi, int OnLo, int OnHi, int NotOnBoundary)
Get 1-D orientation.
void SetRefinementRatioAtLevel(int level, int r)
Sets the refinement ratio at the given level.
int GetNumberOfNeighbors(int gridID)
Returns the number of neighbors for the grid corresponding to the given grid ID.
a simple class to control print indentation
int GetNumberOfConnectingBlockFaces(int gridID)
Returns the number of faces of the block corresponding to the given grid ID that are adjacent to at l...
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
std::vector< int > GhostedExtents
A superclass that defines the interface to be implemented by all concrete grid connectivity classes...
virtual void CreateGhostLayers(int N=1)=0
Creates N layers of ghost layers where N is the number of cells that will be added to each grid...
void ClearBlockConnections(int gridID)
Clears all block connections for the block corresponding to the given grid ID.
virtual void SetNumberOfGrids(unsigned int N)=0
Sets the total number of grids in the domain.
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
dynamic, self-adjusting array of unsigned char
unsigned int NumberOfGrids
An internal, light-weight class used to store neighbor information.
void PrintExtent(std::ostream &os, int ext[6])
Prints the extent.
void InsertGridAtLevel(int level, int gridID)
Inserts the grid corresponding to the given ID at the prescribed level.
std::vector< std::vector< vtkStructuredAMRNeighbor > > Neighbors
An internal, light-weight object used to store neighbor information for AMR grids.
virtual void FillGhostArrays(int gridId, vtkUnsignedCharArray *nodesArray, vtkUnsignedCharArray *cellsArray)=0
Fills the ghost arrays for the given grid.
void AddBlockConnection(int gridID, int blockDirection)
Adds a block connection along the given direction for the block corresponding to the given gridID...
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
int GetRefinementRatioAtLevel(int level)
Returns the refinement ratio at the given level.
bool AreExtentsEqual(int ext1[6], int ext2[6])
Checks if the extent ext1 and ext2 are equal.
bool HasConstantRefinementRatio()
Checks if a constant refinement ratio has been specified.
represent and manipulate 3D points
represent and manipulate fields of data