VTK
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
vtkAMRBox Class Reference

Encloses a rectangular region of voxel like cells. More...

#include <vtkAMRBox.h>

Public Member Functions

 vtkAMRBox ()
 Construct the empty box. More...
 
 vtkAMRBox (const vtkAMRBox &other)
 Copy construct this box from another. More...
 
 vtkAMRBox (int ilo, int jlo, int klo, int ihi, int jhi, int khi)
 Construct a specific 3D box. More...
 
 vtkAMRBox (const double *origin, const int *dimensions, const double *spacing, const double *globalOrigin, int gridDescription=VTK_XYZ_GRID)
 Construct an AMR box from the description a vtkUniformGrid Note that the dimensions specify the node dimensions, rather than the cell dimensions. More...
 
 vtkAMRBox (const int lo[3], const int hi[3])
 Construct a specific box. More...
 
 vtkAMRBox (const int dims[6])
 
vtkAMRBoxoperator= (const vtkAMRBox &other)
 Copy the other box to this box. More...
 
virtual ~vtkAMRBox ()
 
void Invalidate ()
 Set the box to be invalid;. More...
 
bool EmptyDimension (int i) const
 Whether dimension i is empty, e.g. More...
 
void SetDimensions (int ilo, int jlo, int klo, int ihi, int jhi, int khi, int desc=VTK_XYZ_GRID)
 Set the dimensions of the box. More...
 
void SetDimensions (const int lo[3], const int hi[3], int desc=VTK_XYZ_GRID)
 Set the dimensions of the box. More...
 
void SetDimensions (const int dims[6], int desc=VTK_XYZ_GRID)
 Set the dimensions of the box. More...
 
void GetDimensions (int lo[3], int hi[3]) const
 Get the dimensions of this box. More...
 
void GetDimensions (int dims[6]) const
 Get the dimensions of this box. More...
 
vtkIdType GetNumberOfCells () const
 Gets the number of cells enclosed by the box. More...
 
void GetNumberOfCells (int num[3]) const
 
void GetNumberOfNodes (int ext[3]) const
 Gets the number of nodes required to construct a physical representation of the box. More...
 
vtkIdType GetNumberOfNodes () const
 
int ComputeDimension () const
 Determines the dimension of the AMR box given the box indices. More...
 
const int * GetLoCorner () const
 Get the low corner index. More...
 
const int * GetHiCorner () const
 
void GetValidHiCorner (int hi[3]) const
 Return a high corner. More...
 
bool Empty () const
 
bool IsInvalid () const
 Check to see if the AMR box instance is invalid. More...
 
bool operator== (const vtkAMRBox &other) const
 Test if this box is equal with the box instance on the rhs. More...
 
bool operator!= (const vtkAMRBox &other) const
 Test if this box is NOT equal with the box instance on the rhs. More...
 
ostream & Print (ostream &os) const
 Send the box to a stream. More...
 
void Serialize (unsigned char *&buffer, vtkIdType &bytesize)
 Serializes this object instance into a byte-stream. More...
 
void Serialize (int *buffer) const
 
void Deserialize (unsigned char *buffer, const vtkIdType &bytesize)
 Deserializes this object instance from the given byte-stream. More...
 
bool DoesBoxIntersectAlongDimension (const vtkAMRBox &other, const int q) const
 Checks if this instance of vtkAMRBox intersects with the box passed through the argument list along the given dimension q. More...
 
bool DoesIntersect (const vtkAMRBox &other) const
 
void Coarsen (int r)
 Coarsen the box. More...
 
void Refine (int r)
 Refine the box. More...
 
void Grow (int byN)
 Grows the box in all directions. More...
 
void Shrink (int byN)
 
void Shift (int i, int j, int k)
 Shifts the box in index space. More...
 
void Shift (const int I[3])
 
bool Intersect (const vtkAMRBox &other)
 Intersect this box with another box in place. More...
 
bool Contains (int i, int j, int k) const
 Test to see if a given cell index is inside this box. More...
 
bool Contains (const int I[3]) const
 
bool Contains (const vtkAMRBox &) const
 Test to see if a given box is inside this box. More...
 
void GetGhostVector (int r, int nghost[6]) const
 Given an AMR box and the refinement ratio, r, this method computes the number of ghost layers in each of the 6 directions, i.e., [imin,imax,jmin,jmax,kmin,kmax]. More...
 
void RemoveGhosts (int r)
 Given an AMR box and the refinement ratio, r, this shrinks the AMRBox. More...
 

Static Public Member Functions

static vtkIdType GetBytesize ()
 Returns the number of bytes allocated by this instance. More...
 
static int GetCellLinearIndex (const vtkAMRBox &box, const int i, const int j, const int k, int imageDimension[3])
 Returns the linear index of the given cell structured coordinates. More...
 
static void GetBounds (const vtkAMRBox &box, const double origin[3], const double spacing[3], double bounds[6])
 Get the bounds of this box. More...
 
static void GetBoxOrigin (const vtkAMRBox &box, const double X0[3], const double spacing[3], double x0[3])
 Get the world space origin of this box. More...
 
static bool HasPoint (const vtkAMRBox &box, const double origin[3], const double spacing[3], double x, double y, double z)
 Checks if the point is inside this AMRBox instance. More...
 
static int ComputeStructuredCoordinates (const vtkAMRBox &box, const double dataOrigin[3], const double h[3], const double x[3], int ijk[3], double pcoords[3])
 Compute structured coordinates. More...
 

Protected Member Functions

void Initialize ()
 Initializes this box instance. More...
 
bool IntersectBoxAlongDimension (const vtkAMRBox &other, const int q)
 Intersects this instance of vtkAMRbox with box passed through the argument list along the given dimension q. More...
 

Detailed Description

Encloses a rectangular region of voxel like cells.

vtkAMRBox stores information for an AMR block

See also
vtkAMRInformation

Definition at line 33 of file vtkAMRBox.h.

Constructor & Destructor Documentation

◆ vtkAMRBox() [1/6]

vtkAMRBox::vtkAMRBox ( )

Construct the empty box.

◆ vtkAMRBox() [2/6]

vtkAMRBox::vtkAMRBox ( const vtkAMRBox other)

Copy construct this box from another.

◆ vtkAMRBox() [3/6]

vtkAMRBox::vtkAMRBox ( int  ilo,
int  jlo,
int  klo,
int  ihi,
int  jhi,
int  khi 
)

Construct a specific 3D box.

◆ vtkAMRBox() [4/6]

vtkAMRBox::vtkAMRBox ( const double *  origin,
const int *  dimensions,
const double *  spacing,
const double *  globalOrigin,
int  gridDescription = VTK_XYZ_GRID 
)

Construct an AMR box from the description a vtkUniformGrid Note that the dimensions specify the node dimensions, rather than the cell dimensions.

◆ vtkAMRBox() [5/6]

vtkAMRBox::vtkAMRBox ( const int  lo[3],
const int  hi[3] 
)

Construct a specific box.

(ilo,jlo,klo,)(ihi,jhi,khi)

◆ vtkAMRBox() [6/6]

vtkAMRBox::vtkAMRBox ( const int  dims[6])

◆ ~vtkAMRBox()

virtual vtkAMRBox::~vtkAMRBox ( )
inlinevirtual

Definition at line 70 of file vtkAMRBox.h.

Member Function Documentation

◆ operator=()

vtkAMRBox& vtkAMRBox::operator= ( const vtkAMRBox other)

Copy the other box to this box.

◆ Invalidate()

void vtkAMRBox::Invalidate ( )
inline

Set the box to be invalid;.

Definition at line 76 of file vtkAMRBox.h.

◆ EmptyDimension()

bool vtkAMRBox::EmptyDimension ( int  i) const
inline

Whether dimension i is empty, e.g.

if the data set is type VTK_XY_PLANE

Definition at line 86 of file vtkAMRBox.h.

◆ SetDimensions() [1/3]

void vtkAMRBox::SetDimensions ( int  ilo,
int  jlo,
int  klo,
int  ihi,
int  jhi,
int  khi,
int  desc = VTK_XYZ_GRID 
)

Set the dimensions of the box.

ilo,jlo,klo,ihi,jhi,khi

◆ SetDimensions() [2/3]

void vtkAMRBox::SetDimensions ( const int  lo[3],
const int  hi[3],
int  desc = VTK_XYZ_GRID 
)

Set the dimensions of the box.

(ilo,jlo,klo),(ihi,jhi,khi)

◆ SetDimensions() [3/3]

void vtkAMRBox::SetDimensions ( const int  dims[6],
int  desc = VTK_XYZ_GRID 
)

Set the dimensions of the box.

(ilo,ihi,jlo,jhi,klo,khi)

◆ GetDimensions() [1/2]

void vtkAMRBox::GetDimensions ( int  lo[3],
int  hi[3] 
) const

Get the dimensions of this box.

(ilo,jlo,jhi),(ihi,jhi,khi)

◆ GetDimensions() [2/2]

void vtkAMRBox::GetDimensions ( int  dims[6]) const

Get the dimensions of this box.

(ilo,ihi, jlo,jhi, klo,khi)

◆ GetNumberOfCells() [1/2]

vtkIdType vtkAMRBox::GetNumberOfCells ( ) const

Gets the number of cells enclosed by the box.

◆ GetNumberOfCells() [2/2]

void vtkAMRBox::GetNumberOfCells ( int  num[3]) const

◆ GetNumberOfNodes() [1/2]

void vtkAMRBox::GetNumberOfNodes ( int  ext[3]) const

Gets the number of nodes required to construct a physical representation of the box.

◆ GetNumberOfNodes() [2/2]

vtkIdType vtkAMRBox::GetNumberOfNodes ( ) const

◆ ComputeDimension()

int vtkAMRBox::ComputeDimension ( ) const

Determines the dimension of the AMR box given the box indices.

Note, the AMR box can be on an arbitrary axis-aligned plane, i.e., XZ or YZ.

◆ GetLoCorner()

const int* vtkAMRBox::GetLoCorner ( ) const
inline

Get the low corner index.

Definition at line 140 of file vtkAMRBox.h.

◆ GetHiCorner()

const int* vtkAMRBox::GetHiCorner ( ) const
inline

Definition at line 141 of file vtkAMRBox.h.

◆ GetValidHiCorner()

void vtkAMRBox::GetValidHiCorner ( int  hi[3]) const

Return a high corner.

If dimension j is empty, then hi[j] is set from lo[j]. This is convenient For algorithm that must iterate over all cells

◆ Empty()

bool vtkAMRBox::Empty ( ) const
inline

Definition at line 150 of file vtkAMRBox.h.

◆ IsInvalid()

bool vtkAMRBox::IsInvalid ( ) const
inline

Check to see if the AMR box instance is invalid.

Definition at line 155 of file vtkAMRBox.h.

◆ operator==()

bool vtkAMRBox::operator== ( const vtkAMRBox other) const

Test if this box is equal with the box instance on the rhs.

Note: Two AMR boxes are equal if: (a) they have the same dimensionality (b) they are at the same level and (c) they occupy the same index space.

◆ operator!=()

bool vtkAMRBox::operator!= ( const vtkAMRBox other) const
inline

Test if this box is NOT equal with the box instance on the rhs.

Note: Two AMR boxes are equal if: (a) they have the same dimensionality (b) they are at the same level and (c) they occupy the same index space.

Definition at line 173 of file vtkAMRBox.h.

◆ Print()

ostream& vtkAMRBox::Print ( ostream &  os) const

Send the box to a stream.

"(ilo,jlo,jhi),(ihi,jhi,khi)"

◆ Serialize() [1/2]

void vtkAMRBox::Serialize ( unsigned char *&  buffer,
vtkIdType bytesize 
)

Serializes this object instance into a byte-stream.

buffer – user-supplied pointer where the serialized object is stored. bytesize – number of bytes, i.e., the size of the buffer. NOTE: buffer is allocated internally by this method. Pre-conditions: buffer == nullptr Post-conditions: buffer != nullptr bytesize != 0

◆ Serialize() [2/2]

void vtkAMRBox::Serialize ( int *  buffer) const

◆ Deserialize()

void vtkAMRBox::Deserialize ( unsigned char *  buffer,
const vtkIdType bytesize 
)

Deserializes this object instance from the given byte-stream.

Pre-conditions: buffer != nullptr bytesize != 0

◆ DoesBoxIntersectAlongDimension()

bool vtkAMRBox::DoesBoxIntersectAlongDimension ( const vtkAMRBox other,
const int  q 
) const

Checks if this instance of vtkAMRBox intersects with the box passed through the argument list along the given dimension q.

True is returned iff the box intersects successfully. Otherwise, there is no intersection along the given dimension and false is returned.

◆ DoesIntersect()

bool vtkAMRBox::DoesIntersect ( const vtkAMRBox other) const

◆ Coarsen()

void vtkAMRBox::Coarsen ( int  r)

Coarsen the box.

◆ Refine()

void vtkAMRBox::Refine ( int  r)

Refine the box.

◆ Grow()

void vtkAMRBox::Grow ( int  byN)

Grows the box in all directions.

◆ Shrink()

void vtkAMRBox::Shrink ( int  byN)

◆ Shift() [1/2]

void vtkAMRBox::Shift ( int  i,
int  j,
int  k 
)

Shifts the box in index space.

◆ Shift() [2/2]

void vtkAMRBox::Shift ( const int  I[3])

◆ Intersect()

bool vtkAMRBox::Intersect ( const vtkAMRBox other)

Intersect this box with another box in place.

Returns true if the boxes do intersect. Note that the box is modified to be the intersection or is made invalid.

◆ Contains() [1/3]

bool vtkAMRBox::Contains ( int  i,
int  j,
int  k 
) const

Test to see if a given cell index is inside this box.

◆ Contains() [2/3]

bool vtkAMRBox::Contains ( const int  I[3]) const

◆ Contains() [3/3]

bool vtkAMRBox::Contains ( const vtkAMRBox ) const

Test to see if a given box is inside this box.

◆ GetGhostVector()

void vtkAMRBox::GetGhostVector ( int  r,
int  nghost[6] 
) const

Given an AMR box and the refinement ratio, r, this method computes the number of ghost layers in each of the 6 directions, i.e., [imin,imax,jmin,jmax,kmin,kmax].

◆ RemoveGhosts()

void vtkAMRBox::RemoveGhosts ( int  r)

Given an AMR box and the refinement ratio, r, this shrinks the AMRBox.

◆ GetBytesize()

static vtkIdType vtkAMRBox::GetBytesize ( )
inlinestatic

Returns the number of bytes allocated by this instance.

In addition, this number of bytes corresponds to the buffer size required to serialize any vtkAMRBox instance.

Definition at line 279 of file vtkAMRBox.h.

◆ GetCellLinearIndex()

static int vtkAMRBox::GetCellLinearIndex ( const vtkAMRBox box,
const int  i,
const int  j,
const int  k,
int  imageDimension[3] 
)
static

Returns the linear index of the given cell structured coordinates.

◆ GetBounds()

static void vtkAMRBox::GetBounds ( const vtkAMRBox box,
const double  origin[3],
const double  spacing[3],
double  bounds[6] 
)
static

Get the bounds of this box.

◆ GetBoxOrigin()

static void vtkAMRBox::GetBoxOrigin ( const vtkAMRBox box,
const double  X0[3],
const double  spacing[3],
double  x0[3] 
)
static

Get the world space origin of this box.

The origin is the location of the lower corner cell's lower corner node,

◆ HasPoint()

static bool vtkAMRBox::HasPoint ( const vtkAMRBox box,
const double  origin[3],
const double  spacing[3],
double  x,
double  y,
double  z 
)
static

Checks if the point is inside this AMRBox instance.

x,y,z the world point

◆ ComputeStructuredCoordinates()

static int vtkAMRBox::ComputeStructuredCoordinates ( const vtkAMRBox box,
const double  dataOrigin[3],
const double  h[3],
const double  x[3],
int  ijk[3],
double  pcoords[3] 
)
static

Compute structured coordinates.

◆ Initialize()

void vtkAMRBox::Initialize ( )
protected

Initializes this box instance.

◆ IntersectBoxAlongDimension()

bool vtkAMRBox::IntersectBoxAlongDimension ( const vtkAMRBox other,
const int  q 
)
protected

Intersects this instance of vtkAMRbox with box passed through the argument list along the given dimension q.

True is returned iff the box intersects successfully. Otherwise, false is returned if there is no intersection at the given dimension.


The documentation for this class was generated from the following file: