23 #include "vtkCommonDataModelModule.h"
27 VTK_ABI_NAMESPACE_BEGIN
44 vtkAMRBox(
int ilo,
int jlo,
int klo,
int ihi,
int jhi,
int khi);
50 vtkAMRBox(
const double* origin,
const int* dimensions,
const double*
spacing,
51 const double* globalOrigin,
int gridDescription =
VTK_XYZ_GRID);
56 vtkAMRBox(
const int lo[3],
const int hi[3]);
73 this->LoCorner[0] = this->LoCorner[1] = this->LoCorner[2] = 0;
74 this->HiCorner[0] = this->HiCorner[1] = this->HiCorner[2] = -2;
86 void SetDimensions(
int ilo,
int jlo,
int klo,
int ihi,
int jhi,
int khi,
int desc =
VTK_XYZ_GRID);
91 void SetDimensions(
const int lo[3],
const int hi[3],
int desc =
VTK_XYZ_GRID);
96 void SetDimensions(
const int dims[6],
int desc =
VTK_XYZ_GRID);
101 void GetDimensions(
int lo[3],
int hi[3])
const;
106 void GetDimensions(
int dims[6])
const;
113 void GetNumberOfCells(
int num[3])
const;
121 void GetNumberOfNodes(
int ext[3])
const;
130 int ComputeDimension()
const;
143 void GetValidHiCorner(
int hi[3])
const;
145 bool Empty()
const {
return this->IsInvalid(); }
152 return ((this->HiCorner[0] < this->LoCorner[0] - 1) ||
153 (this->HiCorner[1] < this->LoCorner[1] - 1) || (this->HiCorner[2] < this->LoCorner[2] - 1));
173 ostream&
Print(ostream& os)
const;
187 void Serialize(
unsigned char*& buffer,
vtkIdType& bytesize);
188 void Serialize(
int* buffer)
const;
197 void Deserialize(
unsigned char* buffer,
const vtkIdType& bytesize);
205 bool DoesBoxIntersectAlongDimension(
const vtkAMRBox& other,
int q)
const;
207 bool DoesIntersect(
const vtkAMRBox& other)
const;
224 void Shrink(
int byN);
231 void Shift(
int i,
int j,
int k);
232 void Shift(
const int I[3]);
246 bool Contains(
int i,
int j,
int k)
const;
247 bool Contains(
const int I[3])
const;
260 void GetGhostVector(
int r,
int nghost[6])
const;
266 void RemoveGhosts(
int r);
278 static int GetCellLinearIndex(
const vtkAMRBox& box,
int i,
int j,
int k,
int imageDimension[3]);
284 const vtkAMRBox& box,
const double origin[3],
const double spacing[3],
double bounds[6]);
290 static void GetBoxOrigin(
291 const vtkAMRBox& box,
const double X0[3],
const double spacing[3],
double x0[3]);
297 static bool HasPoint(
const vtkAMRBox& box,
const double origin[3],
const double spacing[3],
298 double x,
double y,
double z);
303 static int ComputeStructuredCoordinates(
const vtkAMRBox& box,
const double dataOrigin[3],
304 const double h[3],
const double x[3],
int ijk[3],
double pcoords[3]);
318 bool IntersectBoxAlongDimension(
const vtkAMRBox& other,
int q);
330 void BuildAMRBox(
int ilo,
int jlo,
int klo,
int ihi,
int jhi,
int khi);
340 template <
typename T>
350 arrayDims.
Shift(ofs);
354 if (!arrayRegion.
Contains(destRegion))
356 vtkGenericWarningMacro(<<
"ERROR: Array must enclose the destination region. "
357 <<
"Aborting the fill.");
367 for (
int k = destLo[2]; k <= destHi[2]; ++k)
369 vtkIdType kOfs = k * arrayHi[0] * arrayHi[1];
370 for (
int j = destLo[1]; j <= destHi[1]; ++j)
372 vtkIdType idx = kOfs + j * arrayHi[0] + destLo[0];
373 for (
int i = destLo[0]; i <= destHi[0]; ++i)
375 pArray[idx] = fillValue;
383 VTK_ABI_NAMESPACE_END
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.
bool VTKCOMMONCORE_EXPORT operator==(const std::string &a, const vtkStringToken &b)
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.
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.