23 #include "vtkCommonDataModelModule.h"
27 VTK_ABI_NAMESPACE_BEGIN
45 vtkAMRBox(
int ilo,
int jlo,
int klo,
int ihi,
int jhi,
int khi);
51 vtkAMRBox(
const double* origin,
const int* dimensions,
const double*
spacing,
57 vtkAMRBox(
const int lo[3],
const int hi[3]);
74 this->LoCorner[0] = this->LoCorner[1] = this->LoCorner[2] = 0;
75 this->HiCorner[0] = this->HiCorner[1] = this->HiCorner[2] = -2;
87 void SetDimensions(
int ilo,
int jlo,
int klo,
int ihi,
int jhi,
int khi,
116 void GetNumberOfCells(
int num[3])
const;
124 void GetNumberOfNodes(
int ext[3])
const;
133 int ComputeDimension()
const;
146 void GetValidHiCorner(
int hi[3])
const;
148 bool Empty()
const {
return this->IsInvalid(); }
155 return ((this->HiCorner[0] < this->LoCorner[0] - 1) ||
156 (this->HiCorner[1] < this->LoCorner[1] - 1) || (this->HiCorner[2] < this->LoCorner[2] - 1));
176 ostream&
Print(ostream& os)
const;
190 void Serialize(
unsigned char*& buffer,
vtkIdType& bytesize);
191 void Serialize(
int* buffer)
const;
200 void Deserialize(
unsigned char* buffer,
const vtkIdType& bytesize);
208 bool DoesBoxIntersectAlongDimension(
const vtkAMRBox& other,
int q)
const;
210 bool DoesIntersect(
const vtkAMRBox& other)
const;
227 void Shrink(
int byN);
234 void Shift(
int i,
int j,
int k);
235 void Shift(
const int I[3]);
242 void Add(
int i,
int j,
int k);
243 void Add(
const int ijk[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);
289 static int GetCellLinearIndex(
const vtkAMRBox& box,
int i,
int j,
int k,
int imageDimension[3]);
295 const vtkAMRBox& box,
const double origin[3],
const double spacing[3],
double bounds[6]);
301 static void GetBoxOrigin(
302 const vtkAMRBox& box,
const double X0[3],
const double spacing[3],
double x0[3]);
308 static bool HasPoint(
const vtkAMRBox& box,
const double origin[3],
const double spacing[3],
309 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]);
323 int InitializeGrid(
vtkUniformGrid* grid,
double* origin,
double* spacing)
const;
332 int InitializeGrid(
vtkUniformGrid* grid,
double* origin,
double* spacing,
int nGhosts)
const;
342 vtkUniformGrid* grid,
double* origin,
double* spacing,
const int nGhosts[3])
const;
352 int InitializeGrid(
vtkUniformGrid* grid,
double* origin,
double* spacing,
int nGhostsI,
353 int nGhostsJ,
int nGhostsK)
const;
367 bool IntersectBoxAlongDimension(
const vtkAMRBox& other,
int q);
379 void BuildAMRBox(
int ilo,
int jlo,
int klo,
int ihi,
int jhi,
int khi);
389 template <
typename T>
399 arrayDims.
Shift(ofs);
403 if (!arrayRegion.
Contains(destRegion))
405 vtkGenericWarningMacro(<<
"ERROR: Array must enclose the destination region. "
406 <<
"Aborting the fill.");
416 for (
int k = destLo[2]; k <= destHi[2]; ++k)
418 vtkIdType kOfs = k * arrayHi[0] * arrayHi[1];
419 for (
int j = destLo[1]; j <= destHi[1]; ++j)
421 vtkIdType idx = kOfs + j * arrayHi[0] + destLo[0];
422 for (
int i = destLo[0]; i <= destHi[0]; ++i)
424 pArray[idx] = fillValue;
432 VTK_ABI_NAMESPACE_END
void GetBounds(T a, double bds[6])
VTKIOHDF_EXPORT std::vector< hsize_t > GetDimensions(hid_t fileID, const char *datasetName)
Returns the dimensions of a HDF dataset of a file.
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.