29 #include "vtkCommonDataModelModule.h" 50 int ilo,
int jlo,
int klo,
51 int ihi,
int jhi,
int khi);
57 vtkAMRBox(
const double* origin,
const int* dimensions,
const double*
spacing,
58 const double* globalOrigin,
int gridDescription=
VTK_XYZ_GRID);
63 vtkAMRBox(
const int lo[3],
const int hi[3]);
81 this->LoCorner[0]=this->LoCorner[1]=this->LoCorner[2]=0;
82 this->HiCorner[0]=this->HiCorner[1]=this->HiCorner[2]=-2;
95 int ilo,
int jlo,
int klo,
101 void SetDimensions(
const int lo[3],
const int hi[3],
int desc=
VTK_XYZ_GRID);
106 void SetDimensions(
const int dims[6],
int desc =
VTK_XYZ_GRID);
111 void GetDimensions(
int lo[3],
int hi[3])
const;
116 void GetDimensions(
int dims[6])
const;
123 void GetNumberOfCells(
int num[3])
const;
131 void GetNumberOfNodes(
int ext[3])
const;
140 int ComputeDimension()
const;
153 void GetValidHiCorner(
int hi[3])
const;
156 {
return this->IsInvalid();}
163 return ((this->HiCorner[0] < this->LoCorner[0]-1) ||
164 (this->HiCorner[1] < this->LoCorner[1]-1) ||
165 (this->HiCorner[2] < this->LoCorner[2]-1));
181 {
return( !(*
this == other) ); }
186 ostream &Print(ostream &os)
const;
200 void Serialize(
unsigned char*& buffer,
vtkIdType &bytesize );
201 void Serialize(
int* buffer)
const;
210 void Deserialize(
unsigned char* buffer,
const vtkIdType &bytesize );
218 bool DoesBoxIntersectAlongDimension(
const vtkAMRBox &other,
const int q)
const;
220 bool DoesIntersect(
const vtkAMRBox &other)
const;
237 void Shrink(
int byN);
244 void Shift(
int i,
int j,
int k);
245 void Shift(
const int I[3]);
259 bool Contains(
int i,
int j,
int k)
const;
260 bool Contains(
const int I[3])
const;
273 void GetGhostVector(
int r,
int nghost[6])
const;
279 void RemoveGhosts(
int r);
292 static int GetCellLinearIndex(
const vtkAMRBox& box,
const int i,
const int j,
const int k,
int imageDimension[3] );
297 static void GetBounds(
const vtkAMRBox& box,
const double origin[3],
const double spacing[3],
double bounds[6]) ;
303 static void GetBoxOrigin(
const vtkAMRBox& box,
const double X0[3],
const double spacing[3],
double x0[3]);
309 static bool HasPoint(
const vtkAMRBox& box,
const double origin[3],
const double spacing[3],
double x,
double y,
double z );
314 static int ComputeStructuredCoordinates(
const vtkAMRBox& box,
const double dataOrigin[3],
315 const double h[3],
const double x[3],
int ijk[3],
double pcoords[3]);
329 bool IntersectBoxAlongDimension(
const vtkAMRBox &other,
const int q);
342 const int ilo,
const int jlo,
const int klo,
343 const int ihi,
const int jhi,
const int khi );
354 template <
typename T>
368 arrayDims.
Shift(ofs);
372 if (!arrayRegion.
Contains(destRegion))
374 vtkGenericWarningMacro(
375 <<
"ERROR: Array must enclose the destination region. " 376 <<
"Aborting the fill.");
386 for (
int k=destLo[2]; k<=destHi[2]; ++k)
389 for (
int j=destLo[1]; j<=destHi[1]; ++j)
391 vtkIdType idx=kOfs+j*arrayHi[0]+destLo[0];
392 for (
int i=destLo[0]; i<=destHi[0]; ++i)
394 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 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;.