35 #include "vtkCommonDataModelModule.h"
55 vtkAMRBox(
int ilo,
int jlo,
int klo,
int ihi,
int jhi,
int khi);
61 vtkAMRBox(
const double* origin,
const int* dimensions,
const double*
spacing,
62 const double* globalOrigin,
int gridDescription =
VTK_XYZ_GRID);
67 vtkAMRBox(
const int lo[3],
const int hi[3]);
84 this->LoCorner[0] = this->LoCorner[1] = this->LoCorner[2] = 0;
85 this->HiCorner[0] = this->HiCorner[1] = this->HiCorner[2] = -2;
97 void SetDimensions(
int ilo,
int jlo,
int klo,
int ihi,
int jhi,
int khi,
int desc =
VTK_XYZ_GRID);
102 void SetDimensions(
const int lo[3],
const int hi[3],
int desc =
VTK_XYZ_GRID);
107 void SetDimensions(
const int dims[6],
int desc =
VTK_XYZ_GRID);
112 void GetDimensions(
int lo[3],
int hi[3])
const;
117 void GetDimensions(
int dims[6])
const;
124 void GetNumberOfCells(
int num[3])
const;
132 void GetNumberOfNodes(
int ext[3])
const;
141 int ComputeDimension()
const;
154 void GetValidHiCorner(
int hi[3])
const;
156 bool Empty()
const {
return this->IsInvalid(); }
163 return ((this->HiCorner[0] < this->LoCorner[0] - 1) ||
164 (this->HiCorner[1] < this->LoCorner[1] - 1) || (this->HiCorner[2] < this->LoCorner[2] - 1));
184 ostream&
Print(ostream& os)
const;
198 void Serialize(
unsigned char*& buffer,
vtkIdType& bytesize);
199 void Serialize(
int* buffer)
const;
208 void Deserialize(
unsigned char* buffer,
const vtkIdType& bytesize);
216 bool DoesBoxIntersectAlongDimension(
const vtkAMRBox& other,
const int q)
const;
218 bool DoesIntersect(
const vtkAMRBox& other)
const;
235 void Shrink(
int byN);
242 void Shift(
int i,
int j,
int k);
243 void Shift(
const int I[3]);
257 bool Contains(
int i,
int j,
int k)
const;
258 bool Contains(
const int I[3])
const;
271 void GetGhostVector(
int r,
int nghost[6])
const;
277 void RemoveGhosts(
int r);
290 static int GetCellLinearIndex(
291 const vtkAMRBox& box,
const int i,
const int j,
const int k,
int imageDimension[3]);
297 const vtkAMRBox& box,
const double origin[3],
const double spacing[3],
double bounds[6]);
303 static void GetBoxOrigin(
304 const vtkAMRBox& box,
const double X0[3],
const double spacing[3],
double x0[3]);
310 static bool HasPoint(
const vtkAMRBox& box,
const double origin[3],
const double spacing[3],
311 double x,
double y,
double z);
316 static int ComputeStructuredCoordinates(
const vtkAMRBox& box,
const double dataOrigin[3],
317 const double h[3],
const double x[3],
int ijk[3],
double pcoords[3]);
331 bool IntersectBoxAlongDimension(
const vtkAMRBox& other,
const int q);
344 const int ilo,
const int jlo,
const int klo,
const int ihi,
const int jhi,
const int khi);
354 template <
typename T>
364 arrayDims.
Shift(ofs);
368 if (!arrayRegion.
Contains(destRegion))
370 vtkGenericWarningMacro(<<
"ERROR: Array must enclose the destination region. "
371 <<
"Aborting the fill.");
381 for (
int k = destLo[2]; k <= destHi[2]; ++k)
383 vtkIdType kOfs = k * arrayHi[0] * arrayHi[1];
384 for (
int j = destLo[1]; j <= destHi[1]; ++j)
386 vtkIdType idx = kOfs + j * arrayHi[0] + destLo[0];
387 for (
int i = destLo[0]; i <= destHi[0]; ++i)
389 pArray[idx] = fillValue;
void GetBounds(T a, double bds[6])
Encloses a rectangular region of voxel like cells.
void FillRegion(T *pArray, const vtkAMRBox &arrayRegion, const vtkAMRBox &destRegion, T fillValue)
Fill the region of "pArray" enclosed by "destRegion" with "fillValue" "pArray" is defined on "arrayRe...
void Print(const std::vector< T > &input, const std::string &name)
Print a vector with an associated name.
void GetValidHiCorner(int hi[3]) const
Return a high corner.
void Shift(int i, int j, int k)
Shifts the box in index space.
bool IsInvalid() const
Check to see if the AMR box instance is invalid.
vtkIdType GetNumberOfCells() const
Gets the number of cells enclosed by the box.
bool VTKCOMMONDATAMODEL_EXPORT operator==(vtkEdgeBase e1, vtkEdgeBase e2)
const int * GetLoCorner() const
Get the low corner index.
static vtkIdType GetBytesize()
Returns the number of bytes allocated by this instance.
bool EmptyDimension(int i) const
Whether dimension i is empty, e.g.
const int * GetHiCorner() const
bool operator!=(const vtkAMRBox &other) const
Test if this box is NOT equal with the box instance on the rhs.
void Invalidate()
Set the box to be invalid;.
bool Contains(int i, int j, int k) const
Test to see if a given cell index is inside this box.