35 #include "vtkCommonDataModelModule.h"
56 int ilo,
int jlo,
int klo,
57 int ihi,
int jhi,
int khi);
63 vtkAMRBox(
const double* origin,
const int* dimensions,
const double*
spacing,
64 const double* globalOrigin,
int gridDescription=
VTK_XYZ_GRID);
69 vtkAMRBox(
const int lo[3],
const int hi[3]);
87 this->LoCorner[0]=this->LoCorner[1]=this->LoCorner[2]=0;
88 this->HiCorner[0]=this->HiCorner[1]=this->HiCorner[2]=-2;
101 int ilo,
int jlo,
int klo,
107 void SetDimensions(
const int lo[3],
const int hi[3],
int desc=
VTK_XYZ_GRID);
112 void SetDimensions(
const int dims[6],
int desc =
VTK_XYZ_GRID);
117 void GetDimensions(
int lo[3],
int hi[3])
const;
122 void GetDimensions(
int dims[6])
const;
129 void GetNumberOfCells(
int num[3])
const;
137 void GetNumberOfNodes(
int ext[3])
const;
146 int ComputeDimension()
const;
159 void GetValidHiCorner(
int hi[3])
const;
162 {
return this->IsInvalid();}
169 return ((this->HiCorner[0] < this->LoCorner[0]-1) ||
170 (this->HiCorner[1] < this->LoCorner[1]-1) ||
171 (this->HiCorner[2] < this->LoCorner[2]-1));
187 {
return( !(*
this == other) ); }
192 ostream &Print(ostream &os)
const;
206 void Serialize(
unsigned char*& buffer,
vtkIdType &bytesize );
207 void Serialize(
int* buffer)
const;
216 void Deserialize(
unsigned char* buffer,
const vtkIdType &bytesize );
224 bool DoesBoxIntersectAlongDimension(
const vtkAMRBox &other,
const int q)
const;
226 bool DoesIntersect(
const vtkAMRBox &other)
const;
243 void Shrink(
int byN);
250 void Shift(
int i,
int j,
int k);
251 void Shift(
const int I[3]);
265 bool Contains(
int i,
int j,
int k)
const;
266 bool Contains(
const int I[3])
const;
279 void GetGhostVector(
int r,
int nghost[6])
const;
285 void RemoveGhosts(
int r);
298 static int GetCellLinearIndex(
const vtkAMRBox& box,
const int i,
const int j,
const int k,
int imageDimension[3] );
303 static void GetBounds(
const vtkAMRBox& box,
const double origin[3],
const double spacing[3],
double bounds[6]) ;
309 static void GetBoxOrigin(
const vtkAMRBox& box,
const double X0[3],
const double spacing[3],
double x0[3]);
315 static bool HasPoint(
const vtkAMRBox& box,
const double origin[3],
const double spacing[3],
double x,
double y,
double z );
320 static int ComputeStructuredCoordinates(
const vtkAMRBox& box,
const double dataOrigin[3],
321 const double h[3],
const double x[3],
int ijk[3],
double pcoords[3]);
335 bool IntersectBoxAlongDimension(
const vtkAMRBox &other,
const int q);
348 const int ilo,
const int jlo,
const int klo,
349 const int ihi,
const int jhi,
const int khi );
360 template <
typename T>
374 arrayDims.
Shift(ofs);
378 if (!arrayRegion.
Contains(destRegion))
380 vtkGenericWarningMacro(
381 <<
"ERROR: Array must enclose the destination region. "
382 <<
"Aborting the fill.");
392 for (
int k=destLo[2]; k<=destHi[2]; ++k)
395 for (
int j=destLo[1]; j<=destHi[1]; ++j)
397 vtkIdType idx=kOfs+j*arrayHi[0]+destLo[0];
398 for (
int i=destLo[0]; i<=destHi[0]; ++i)
400 pArray[idx]=fillValue;
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 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.
VTKCOMMONCORE_EXPORT bool operator==(const vtkUnicodeString &lhs, const vtkUnicodeString &rhs)
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.