29 #include "vtkCommonDataModelModule.h" 49 vtkAMRBox(
int ilo,
int jlo,
int klo,
int ihi,
int jhi,
int khi);
55 vtkAMRBox(
const double* origin,
const int* dimensions,
const double*
spacing,
56 const double* globalOrigin,
int gridDescription =
VTK_XYZ_GRID);
61 vtkAMRBox(
const int lo[3],
const int hi[3]);
78 this->LoCorner[0] = this->LoCorner[1] = this->LoCorner[2] = 0;
79 this->HiCorner[0] = this->HiCorner[1] = this->HiCorner[2] = -2;
91 void SetDimensions(
int ilo,
int jlo,
int klo,
int ihi,
int jhi,
int khi,
int desc =
VTK_XYZ_GRID);
96 void SetDimensions(
const int lo[3],
const int hi[3],
int desc =
VTK_XYZ_GRID);
101 void SetDimensions(
const int dims[6],
int desc =
VTK_XYZ_GRID);
106 void GetDimensions(
int lo[3],
int hi[3])
const;
111 void GetDimensions(
int dims[6])
const;
118 void GetNumberOfCells(
int num[3])
const;
126 void GetNumberOfNodes(
int ext[3])
const;
135 int ComputeDimension()
const;
148 void GetValidHiCorner(
int hi[3])
const;
150 bool Empty()
const {
return this->IsInvalid(); }
157 return ((this->HiCorner[0] < this->LoCorner[0] - 1) ||
158 (this->HiCorner[1] < this->LoCorner[1] - 1) || (this->HiCorner[2] < this->LoCorner[2] - 1));
178 ostream&
Print(ostream& os)
const;
192 void Serialize(
unsigned char*& buffer,
vtkIdType& bytesize);
193 void Serialize(
int* buffer)
const;
202 void Deserialize(
unsigned char* buffer,
const vtkIdType& bytesize);
210 bool DoesBoxIntersectAlongDimension(
const vtkAMRBox& other,
const int q)
const;
212 bool DoesIntersect(
const vtkAMRBox& other)
const;
229 void Shrink(
int byN);
236 void Shift(
int i,
int j,
int k);
237 void Shift(
const int I[3]);
251 bool Contains(
int i,
int j,
int k)
const;
252 bool Contains(
const int I[3])
const;
265 void GetGhostVector(
int r,
int nghost[6])
const;
271 void RemoveGhosts(
int r);
284 static int GetCellLinearIndex(
285 const vtkAMRBox& box,
const int i,
const int j,
const int k,
int imageDimension[3]);
290 static void GetBounds(
291 const vtkAMRBox& box,
const double origin[3],
const double spacing[3],
double bounds[6]);
297 static void GetBoxOrigin(
298 const vtkAMRBox& box,
const double X0[3],
const double spacing[3],
double x0[3]);
304 static bool HasPoint(
const vtkAMRBox& box,
const double origin[3],
const double spacing[3],
305 double x,
double y,
double z);
310 static int ComputeStructuredCoordinates(
const vtkAMRBox& box,
const double dataOrigin[3],
311 const double h[3],
const double x[3],
int ijk[3],
double pcoords[3]);
325 bool IntersectBoxAlongDimension(
const vtkAMRBox& other,
const int q);
338 const int ilo,
const int jlo,
const int klo,
const int ihi,
const int jhi,
const int khi);
348 template <
typename T>
358 arrayDims.
Shift(ofs);
362 if (!arrayRegion.
Contains(destRegion))
364 vtkGenericWarningMacro(<<
"ERROR: Array must enclose the destination region. " 365 <<
"Aborting the fill.");
375 for (
int k = destLo[2]; k <= destHi[2]; ++k)
377 vtkIdType kOfs = k * arrayHi[0] * arrayHi[1];
378 for (
int j = destLo[1]; j <= destHi[1]; ++j)
380 vtkIdType idx = kOfs + j * arrayHi[0] + destLo[0];
381 for (
int i = destLo[0]; i <= destHi[0]; ++i)
383 pArray[idx] = fillValue;
bool EmptyDimension(int i) const
Whether dimension i is empty, e.g.
const int * GetLoCorner() const
Get the low corner index.
bool Contains(int i, int j, int k) const
Test to see if a given cell index is inside this box.
Encloses a rectangular region of voxel like cells.
bool IsInvalid() const
Check to see if the AMR box instance is invalid.
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 Shift(int i, int j, int k)
Shifts the box in index space.
vtkIdType GetNumberOfCells() const
Gets the number of cells enclosed by the box.
void GetValidHiCorner(int hi[3]) const
Return a high corner.
const int * GetHiCorner() const
bool operator!=(const vtkAMRBox &other) const
Test if this box is NOT equal with the box instance on the rhs.
static vtkIdType GetBytesize()
Returns the number of bytes allocated by this instance.
VTKCOMMONCORE_EXPORT bool operator==(const vtkUnicodeString &lhs, const vtkUnicodeString &rhs)
void Invalidate()
Set the box to be invalid;.