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

Static Public Member Functions

static vtkIdType GetBytesize ()
 Returns the number of bytes allocated by this instance.
 
static int GetCellLinearIndex (const vtkAMRBox &box, int i, int j, int k, int imageDimension[3])
 Returns the linear index of the given cell structured coordinates.
 
static void GetBounds (const vtkAMRBox &box, const double origin[3], const double spacing[3], double bounds[6])
 Get the bounds of this box.
 
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.
 
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.
 
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.
 

Protected Member Functions

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

Detailed Description

Encloses a rectangular region of voxel like cells.

vtkAMRBox stores information for an AMR block

See also
vtkAMRInformation
Examples:
vtkAMRBox (Examples)
Online Examples:

Tests:
vtkAMRBox (Tests)

Definition at line 67 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 ( )
virtualdefault

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 110 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 120 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

Gets the number of cells enclosed by the box.

◆ 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

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

◆ 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 174 of file vtkAMRBox.h.

◆ GetHiCorner()

const int * vtkAMRBox::GetHiCorner ( ) const
inline

Definition at line 175 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 184 of file vtkAMRBox.h.

◆ IsInvalid()

bool vtkAMRBox::IsInvalid ( ) const
inline

Check to see if the AMR box instance is invalid.

Definition at line 189 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 207 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

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

◆ 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,
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)

Grows the box in all directions.

◆ 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])

Shifts the box in index space.

◆ 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

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

◆ 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 312 of file vtkAMRBox.h.

◆ GetCellLinearIndex()

static int vtkAMRBox::GetCellLinearIndex ( const vtkAMRBox box,
int  i,
int  j,
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,
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: