Chombo + EB  3.2
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | Static Protected Attributes | Friends | List of all members
Box Class Reference

A Rectangular Domain on an Integer Lattice. More...

#include <Box.H>

Public Member Functions

 Box ()
 
 Box (const IntVect &small, const IntVect &big)
 
void define (const IntVect &small, const IntVect &big)
 
 Box (const IntVect &small, const int *vec_len)
 
 Box (const IntVect &small, const IntVect &big, const IntVect &typ)
 
void define (const IntVect &small, const IntVect &big, const IntVect &typ)
 
 Box (const IntVect &small, const IntVect &big, const IndexType &t)
 
void define (const IntVect &small, const IntVect &big, const IndexType &t)
 
void define (const Box &b)
 
Box copy () const
 
const IntVectsmallEnd () const
 { Accessors} More...
 
IntVect sideEnd (Side::LoHiSide a_side) const
 
int smallEnd (int dir) const
 
const IntVectbigEnd () const
 
int bigEnd (int dir) const
 
const int * loVect () const
 
const int * hiVect () const
 
const int * getVect () const
 
long index (const IntVect &v) const
 
IndexType ixType () const
 centering More...
 
IntVect type () const
 
IndexType::CellIndex type (int dir) const
 
IntVect size () const
 size functions More...
 
int size (int dir) const
 
size_t numPts () const
 
size_t volume () const
 
int longside (int &dir) const
 
int longside () const
 
int shortside (int &dir) const
 
int shortside () const
 
bool isEmpty () const
 { Comparison Functions} More...
 
bool ok () const
 
bool contains (const IntVect &p) const
 
bool contains (const Box &b) const
 
bool intersects (const Box &b) const
 
bool intersectsNotEmpty (const Box &b) const
 
bool sameSize (const Box &b) const
 
bool sameType (const Box &b) const
 
bool operator== (const Box &b) const
 
bool eq (const Box &b) const
 
bool operator!= (const Box &b) const
 
bool neq (const Box &b) const
 
bool cellCentered () const
 
bool operator< (const Box &rhs) const
 
bool lt (const Box &rhs) const
 
BoxsetSmall (const IntVect &sm)
 { Modification Functions} More...
 
BoxsetSmall (int dir, int sm_index)
 
BoxsetBig (const IntVect &bg)
 
BoxsetBig (int dir, int bg_index)
 
BoxsetRange (int dir, int sm_index, int n_cells=1)
 
Boxconvert (IndexType typ)
 centering type conversion functions More...
 
Boxconvert (const IntVect &typ)
 
Boxconvert (int dir, IndexType::CellIndex typ)
 
BoxsurroundingNodes ()
 
BoxsurroundingNodes (int dir)
 
BoxsurroundingNodes_int (int dir)
 
BoxenclosedCells ()
 
BoxenclosedCells (int dir)
 
BoxenclosedCells_int (int dir)
 
Boxshift (int dir, int nzones)
 shift functions More...
 
Boxshift (const IntVect &iv)
 
Boxshift_intvect (const IntVect &iv)
 
BoxshiftHalf (int dir, int num_halfs)
 
void convertOldToNew (const IntVect &a_permutation, const IntVect &a_sign, const IntVect &a_translation)
 multiblock stuff. More...
 
void convertNewToOld (const IntVect &a_permutation, const IntVect &a_sign, const IntVect &a_translation)
 multiblock stuff More...
 
BoxshiftHalf (const IntVect &iv)
 
BoxshiftHalf_intvect (const IntVect &iv)
 
Boxoperator+= (const IntVect &v)
 
Box operator+ (const IntVect &v) const
 
Boxoperator-= (const IntVect &v)
 
Box operator- (const IntVect &v) const
 
Box operator & (const Box &) const
 intersection functions More...
 
Boxoperator &= (const Box &)
 
BoxminBox (const Box &b)
 
Boxgrow (int i)
 grow functions More...
 
Boxgrow (const IntVect &v)
 
Boxgrow (int idir, int n_cell)
 
BoxgrowLo (int idir, int n_cell=1)
 
BoxgrowDir (int a_idir, const Side::LoHiSide &a_sd, int a_cell)
 
BoxgrowHi (int idir, int n_cell=1)
 
Boxrefine (int refinement_ratio)
 refinement More...
 
Boxrefine (const IntVect &refinement_ratio)
 
bool coarsenable (int refrat) const
 coarsening More...
 
Boxcoarsen (int refinement_ratio)
 
Boxcoarsen (const IntVect &refinement_ratio)
 
void next (IntVect &) const
 
void next (IntVect &p, const int *shv) const
 
Box chop (int dir, int chop_pnt)
 misc More...
 
void degenerate (Box &a_to, const SliceSpec &a_sliceSpec, bool *a_outofbounds=0) const
 
void p () const
 
void dumpOn (std::ostream &strm) const
 
void computeBoxLen ()
 { Box Constants} More...
 
void computeBoxLenNotEmpty ()
 
 Box (const IntVect &lb, const IntVect &ub)
 
int smallEnd (const int dir) const
 
int bigEnd (const int dir) const
 
IntVect size () const
 

Static Public Member Functions

static void setTempestOutputFormat (bool)
 

Public Attributes

IntVect m_lb
 
IntVect m_ub
 

Protected Attributes

IntVect smallend
 
IntVect bigend
 
IndexType btype
 

Static Protected Attributes

static bool s_tempestOutputFormat
 

Friends

class HDF5Handle
 
Box surroundingNodes (const Box &b, int dir)
 
Box surroundingNodes (const Box &b)
 
Box enclosedCells (const Box &b, int dir)
 
Box enclosedCells (const Box &b)
 
Box bdryBox (const Box &b, int dir, Side::LoHiSide a_sd, int len)
 neighbor box functions More...
 
Box bdryLo (const Box &b, int dir, int len)
 
Box bdryHi (const Box &b, int dir, int len)
 
Box adjCellLo (const Box &b, int dir, int len)
 
Box adjCellHi (const Box &b, int dir, int len)
 
Box adjCellBox (const Box &b, int dir, Side::LoHiSide a_side, int len)
 
Box minBox (const Box &b1, const Box &b2)
 
Box grow (const Box &b, int i)
 
Box grow (const Box &b, const IntVect &v)
 
Box refine (const Box &b, int refinement_ratio)
 
Box refine (const Box &b, const IntVect &refinement_ratio)
 
Box coarsen (const Box &b, int refinement_ratio)
 
Box coarsen (const Box &b, const IntVect &refinement_ratio)
 
std::ostream & operator<< (std::ostream &os, const Box &bx)
 { I/O Functions} More...
 
std::istream & operator>> (std::istream &os, Box &bx)
 

Detailed Description

A Rectangular Domain on an Integer Lattice.

A Box is an abstraction for defining discrete rectangular regions of SpaceDim-dimensioned indexing space. Boxes have an IndexType, which defines IndexType::CELL or IndexType::NODE based points for each direction and a low and high IntVect which defines the lower and upper corners of the Box. Boxes can exist in positive and negative indexing space.

Box is a dimension dependent class, so SpaceDim must be defined as either 1, 2, or 3 when compiling.

Constructor & Destructor Documentation

◆ Box() [1/6]

Box::Box ( )

The default constructor. The constructed Box is empty.

◆ Box() [2/6]

Box::Box ( const IntVect small,
const IntVect big 
)

The destructor. Let the compiler build the default version (bvs) Construct cell-centered type Box. It is an error if small is greater than big.

◆ Box() [3/6]

Box::Box ( const IntVect small,
const int *  vec_len 
)

Construct Box with specified lengths. It is an error if the lengths are negative.

◆ Box() [4/6]

Box::Box ( const IntVect small,
const IntVect big,
const IntVect typ 
)

Construct Box with given type. small and big are expected to be consistent with given type. It is an error if small is greater than big. It is an error if typ is not convertible to an IndexType.

◆ Box() [5/6]

Box::Box ( const IntVect small,
const IntVect big,
const IndexType t 
)

Construct Box with given type. small and big are expected to be consistent with given type. It is an error if small is greater than big.

◆ Box() [6/6]

Box::Box ( const IntVect lb,
const IntVect ub 
)
inline

Member Function Documentation

◆ define() [1/4]

void Box::define ( const IntVect small,
const IntVect big 
)

Modify cell-centered type Box. It is an error if small is greater than big.

◆ define() [2/4]

void Box::define ( const IntVect small,
const IntVect big,
const IntVect typ 
)

Modify Box with given type. small and big are expected to be consistent with given type. It is an error if small is greater than big. It is an error if typ is not convertible to an IndexType.

◆ define() [3/4]

void Box::define ( const IntVect small,
const IntVect big,
const IndexType t 
)

Modify Box with given type. small and big are expected to be consistent with given type. It is an error if small is greater than big.

◆ define() [4/4]

void Box::define ( const Box b)

The copy constructor. Compiler can build default copy (bvs)

◆ copy()

Box Box::copy ( ) const
inline

◆ smallEnd() [1/3]

const IntVect & Box::smallEnd ( ) const
inline

◆ sideEnd()

IntVect Box::sideEnd ( Side::LoHiSide  a_side) const
inline

return smallend if side is low, bigend if side is high.

References Side::Lo.

◆ smallEnd() [2/3]

int Box::smallEnd ( int  dir) const
inline

Returns the coordinate of the low end of this Box in the given direction. Directions are zero-based. It is an error if not 0 <= dir < SpaceDim.

◆ bigEnd() [1/3]

const IntVect & Box::bigEnd ( ) const
inline

◆ bigEnd() [2/3]

int Box::bigEnd ( int  dir) const
inline

Returns the coordinate of the high end of this Box in the given direction. Directions are zero-based. It is an error if not 0 <= dir < SpaceDim.

◆ loVect()

const int * Box::loVect ( ) const
inline

Returns a constant pointer to the array of low end coordinates. Useful for calls to Fortran. It should not be used in any other circumstances.

Referenced by BaseFab< Real >::loVect().

◆ hiVect()

const int * Box::hiVect ( ) const
inline

Returns a constant pointer the array of high end coordinates. Useful for calls to Fortran. It should not be used in any other circumstances.

Referenced by BaseFab< Real >::hiVect().

◆ getVect()

const int * Box::getVect ( ) const
inline

Returns a constant pointer to the array of coordinates in the Box. Useful for calls to Fortran, but otherwise too dangerous for use.

◆ index()

long Box::index ( const IntVect v) const
inline

Returns offset of point from smallend; i.e. index(smallend) -> 0, bigend would return volume()-1. Is used in accessing FArrayBox.

References IntVect::vect.

Referenced by BaseFab< Real >::BaseFab(), BaseFab< Real >::define(), BaseFab< Real >::getVal(), BaseFab< Real >::operator()(), DenseIntVectSet::operator-=(), BaseFab< Real >::resize(), BaseFab< Real >::shift(), and BaseFab< Real >::shiftHalf().

◆ ixType()

IndexType Box::ixType ( ) const
inline

centering

Return the indexing type of this Box.

Referenced by CodimBox< S >::operator()().

◆ type() [1/2]

IntVect Box::type ( ) const
inline

Return the indexing type of this Box.

Referenced by ProblemDomain::contains(), and IndicesTransformation::transform().

◆ type() [2/2]

IndexType::CellIndex Box::type ( int  dir) const
inline

Return the indexing type of this Box in the specified direction. Directions are zero-based. It is an error if not 0 <= dir < SpaceDim.

◆ size() [1/3]

IntVect Box::size ( ) const
inline

◆ size() [2/3]

int Box::size ( int  dir) const
inline

Return the size of this Box in the specified coordinate direction. Directions are zero-based. It is an error if not 0 <= dir < SpaceDim.

◆ numPts()

size_t Box::numPts ( ) const

◆ volume()

size_t Box::volume ( ) const

Return the volume, in indexing space, of region enclosed by this Box. This is identical to numPts().

◆ longside() [1/2]

int Box::longside ( int &  dir) const

Returns length of the longest side of this Box. The argument dir is modified to give direction with longest side: 0...SpaceDim-1. Ignores type.

◆ longside() [2/2]

int Box::longside ( ) const

Returns length of the longest side of this Box. Ignores type.

◆ shortside() [1/2]

int Box::shortside ( int &  dir) const

Returns length of shortest side of this Box. The argument dir is modified to give direction with shortest side: 0...SpaceDim-1. Ignores type.

◆ shortside() [2/2]

int Box::shortside ( ) const

Returns length of the shortest side of this Box. Ignores type.

◆ isEmpty()

bool Box::isEmpty ( ) const
inline

◆ ok()

bool Box::ok ( ) const
inline

Returns true if this Box is not empty and all sizes are right

◆ contains() [1/2]

bool Box::contains ( const IntVect p) const
inline

◆ contains() [2/2]

bool Box::contains ( const Box b) const
inline

Returns true if argument is contained within this Box. It is an error if the Boxes have different types. An empty Box does not contain any IntVect.

References bigend, CH_assert, isEmpty(), isEmpty(), and smallend.

◆ intersects()

bool Box::intersects ( const Box b) const

Returns true if this Box and the argument have non-null intersections. It is an error if the Boxes have different types. An empty Box does not intersect any Box, including itself.

◆ intersectsNotEmpty()

bool Box::intersectsNotEmpty ( const Box b) const

Returns true if this Box and the argument have non-null intersections. It is an error if the Boxes have different types. This routine does not perform the check to see if *this or b are empty boxes. It is the callers responsibility to ensure that this never happens. If you are unsure, the use the .intersects(..) routine.

◆ sameSize()

bool Box::sameSize ( const Box b) const
inline

Returns true if this Box and the argument are the same size, ie translates of each other. It is an error if they have different types.

References bigend, CH_assert, D_TERM6, and smallend.

Referenced by CodimBox< S >::copy(), BaseFab< Real >::copy(), and BaseFab< Real >::performCopy().

◆ sameType()

bool Box::sameType ( const Box b) const
inline

Returns true if this Box and the argument have same type.

References btype.

Referenced by BaseEBFaceFAB< Real >::copy(), and BaseFab< Real >::copy().

◆ operator==()

bool Box::operator== ( const Box b) const
inline

Returns true if this Box and the argument are identical, including type.

References bigend, btype, and smallend.

◆ eq()

bool Box::eq ( const Box b) const

◆ operator!=()

bool Box::operator!= ( const Box b) const
inline

Returns true if this Box and the argument differ, including type.

References IndexType::operator==().

◆ neq()

bool Box::neq ( const Box b) const

◆ cellCentered()

bool Box::cellCentered ( ) const
inline

Returns true if this Box is cell-centered in all indexing directions.

Referenced by BaseEBFaceFAB< Real >::copy(), BaseEBCellFAB< Real >::define(), and BaseEBFaceFAB< Real >::define().

◆ operator<()

bool Box::operator< ( const Box rhs) const
inline

Returns true if this Box is lexigraphically less than rhs box. All comparison is based on lower box corner. In the name of coding efficiency, we do not handle the case where two boxes have the same lower left corner. In DEBUG mode, this is checked for with an assert.

References bigend, isEmpty(), isEmpty(), and smallend.

◆ lt()

bool Box::lt ( const Box rhs) const

◆ setSmall() [1/2]

Box & Box::setSmall ( const IntVect sm)
inline

{ Modification Functions}

The assignment operator. Compiler can build default version for us (bvs) Redefine the lower corner of this Box. It is an error if the specified corner is greater than the exisiting upper corner of this Box.

References CH_assert.

◆ setSmall() [2/2]

Box & Box::setSmall ( int  dir,
int  sm_index 
)
inline

Redefines the lower end of this Box in the specified coordinate direction. It is an error if the specified value is greater than the exisiting upper end of this Box. Directions are zero-based. It is an error if not 0 <= dir < SpaceDim.

References CH_assert.

◆ setBig() [1/2]

Box & Box::setBig ( const IntVect bg)
inline

Redefines the upper corner of this Box. It is an error if the specified corner is less than the exisiting lower corner of this Box.

References CH_assert.

◆ setBig() [2/2]

Box & Box::setBig ( int  dir,
int  bg_index 
)
inline

Redefines the upper end of this Box in the specified coordinate direction. It is an error if the specified value is less than the exisiting lower end of this Box. Directions are zero-based. It is an error if not 0 <= dir < SpaceDim.

References CH_assert.

◆ setRange()

Box & Box::setRange ( int  dir,
int  sm_index,
int  n_cells = 1 
)
inline

Set the entire range in a given direction, starting at sm_index with length n_cells. It is an error if n_cells <= 0.

References CH_assert.

◆ convert() [1/3]

Box& Box::convert ( IndexType  typ)

centering type conversion functions

Modifies this Box by converting from the current type into the argument type. This may change the Box coordinates:\

type CELL -> NODE : increase coordinate by one on high end.\

type NODE -> CELL : reduce coordinate by one on high end.\

other type mappings make no change.

Referenced by grow(), grow(), growHi(), and growLo().

◆ convert() [2/3]

Box & Box::convert ( const IntVect typ)
inline

Modifies this Box by converting from the current type into the argument type. This may change the Box coordinates:\ type CELL -> NODE : increase coordinate by one on high end.\ type NODE -> CELL : reduce coordinate by one on high end.\ other type mappings make no change. It is an error if typ is not convertible to an IndexType.

References CH_assert, IndexType::IndexType(), isEmpty(), IntVect::Unit, and IntVect::Zero.

◆ convert() [3/3]

Box& Box::convert ( int  dir,
IndexType::CellIndex  typ 
)

Modifies this Box by converting from the current type into the argument type. This may change the Box coordinates:\

type CELL -> NODE : increase coordinate by one on high end.\

type NODE -> CELL : reduce coordinate by one on high end.\

Other type mappings make no change. Directions are zero-based. It is an error if not 0 <= dir < SpaceDim.

◆ surroundingNodes() [1/2]

Box& Box::surroundingNodes ( )

Modifies this Box by converting it to NODE type in all directions. This increases all components of the upper corner by one. The Empty Box is not modified by this function except for changing of type.

Referenced by ProblemDomain::contains(), CodimBox< S >::genOrientBox(), and surroundingNodes().

◆ surroundingNodes() [2/2]

Box & Box::surroundingNodes ( int  dir)
inline

Modifies this Box by converting it to NODE type in given direction. This increases the component of the upper corner in the given direction by one. Directions are zero-based. It is an error if not 0 <= dir < SpaceDim. The Empty Box is not modified by this function except for changing of type.

References isEmpty(), and shift().

◆ surroundingNodes_int()

Box& Box::surroundingNodes_int ( int  dir)

◆ enclosedCells() [1/2]

Box& Box::enclosedCells ( )

Modifies this Box by converting it to CELL type in all directions. This decreases all components of the upper corner by one. The Empty Box is not modified by this function except for changing of type.

Referenced by ProblemDomain::contains(), dataSize(), enclosedCells(), and LDaddEdgeOp< T >::linearIn().

◆ enclosedCells() [2/2]

Box & Box::enclosedCells ( int  dir)
inline

Modifies this Box by converting it to CELL type in given direction. This decreases the component of the upper corner in the given direction by one. Directions are zero-based. It is an error if not 0 <= dir < SpaceDim. The Empty Box is not modified by this function except for changing of type.

References isEmpty(), and shift().

◆ enclosedCells_int()

Box& Box::enclosedCells_int ( int  dir)

◆ shift() [1/2]

Box & Box::shift ( int  dir,
int  nzones 
)
inline

shift functions

Modifies this Box by shifting it nzones indexing positions in coordinate direction dir. Directions are zero-based. It is an error if not 0 <= dir < SpaceDim. The Empty Box is not modified by this function.

References isEmpty(), and shift().

Referenced by CodimBox< S >::copy(), enclosedCells(), grow(), growHi(), growLo(), DenseIntVectSet::shift(), BaseFab< Real >::shift(), shift(), NodeFArrayBox::shift(), ProblemDomain::shiftIt(), surroundingNodes(), and ProblemDomain::unshiftIt().

◆ shift() [2/2]

Box & Box::shift ( const IntVect iv)
inline

Modifies this Box by shifting. Equivalent to b.shift(0,iv[0]).shift(1,iv[1]) .... The Empty Box is not modified by this function.

References isEmpty(), and shift().

◆ shift_intvect()

Box& Box::shift_intvect ( const IntVect iv)

◆ shiftHalf() [1/2]

Box& Box::shiftHalf ( int  dir,
int  num_halfs 
)

This member modifies this Box by shifting by "half" indices, thereby converting the Box from type CELL to NODE or vice-versa. b.shiftHalf(0,1) shifts b to the right by 1/2 cells. b.shiftHalf(1,-3) shifts b in the -j direction by 3/2 cells. NOTE: If num_halfs is EVEN the shift is num_halfs/2 full zones and hence will not change the type. This is: b.shifthalf(4) == b.shift(2). Directions are zero-based. It is an error if not 0 <= dir < SpaceDim. The Empty Box is not modified by this function except for changing of type.

Referenced by BaseFab< Real >::shiftHalf().

◆ convertOldToNew()

void Box::convertOldToNew ( const IntVect a_permutation,
const IntVect a_sign,
const IntVect a_translation 
)

multiblock stuff.

◆ convertNewToOld()

void Box::convertNewToOld ( const IntVect a_permutation,
const IntVect a_sign,
const IntVect a_translation 
)

multiblock stuff

◆ shiftHalf() [2/2]

Box& Box::shiftHalf ( const IntVect iv)

Modifies this Box by shifting by half indices. Equivalent to b.shiftHalf(0,iv[0]).shiftHalf(1,iv[1]) ... The Empty Box is not modified by this function except for changing of type.

◆ shiftHalf_intvect()

Box& Box::shiftHalf_intvect ( const IntVect iv)

◆ operator+=()

Box & Box::operator+= ( const IntVect v)
inline

Modifies this Box by shifting it by given IntVect. The Empty Box is not modified by this function.

References isEmpty().

◆ operator+()

Box Box::operator+ ( const IntVect v) const
inline

Returns a Box that is this Box shifted by the given IntVect. The Empty Box is not modified by this function.

References isEmpty().

◆ operator-=()

Box & Box::operator-= ( const IntVect v)
inline

Modifies this Box by shifting it by given IntVect. The Empty Box is not modified by this function.

References isEmpty().

◆ operator-()

Box Box::operator- ( const IntVect v) const
inline

Returns a Box that is this Box shifted by the given IntVect. The Empty Box is not modified by this function.

References isEmpty().

◆ operator &()

Box Box::operator& ( const Box ) const

intersection functions

Returns the Box that is intersection of this Box and the argument Box. Intersection is commutative. The Boxes MUST be of same type. The intersection of the Empty Box and any Box is the Empty Box.

Referenced by growHi().

◆ operator &=()

Box& Box::operator&= ( const Box )

Modifies this Box by intersection with the argument Box. The Boxes MUST be of the same type. The intersection of the Empty Box and any Box is the Empty Box.

◆ minBox()

Box& Box::minBox ( const Box b)

Modifies this Box to that of the minimum Box containing both this Box and the argument Box. Both Boxes must have identical type.

Referenced by MergeSolver< T >::solve().

◆ grow() [1/3]

Box & Box::grow ( int  i)
inline

◆ grow() [2/3]

Box & Box::grow ( const IntVect v)
inline

Modifies this Box by growing it in each direction by specified amount. The Empty Box is not modified by this function. NOTE: components of iv may be negative, which would shrink this Box. If shrinking produces an empty Box, the Box is transformed into the canonical Empty Box.

References convert(), and isEmpty().

◆ grow() [3/3]

Box & Box::grow ( int  idir,
int  n_cell 
)
inline

Modifies this Box by growing it on the low and high end by n_cell cells in direction idir. The Empty Box is not modified by this function. NOTE: n_cell negative shrinks this Box by that number of cells. If shrinking produces an empty Box, the Box is transformed into the canonical Empty Box. Directions are zero-based. It is an error if not 0 <= dir < SpaceDim.

References convert(), isEmpty(), and shift().

◆ growLo()

Box & Box::growLo ( int  idir,
int  n_cell = 1 
)
inline

Modifies this Box by growing it on the low end by n_cell cells in direction idir. The Empty Box is not modified by this function. NOTE: n_cell negative shrinks this Box by that number of cells. If shrinking produces an empty Box, the Box is transformed into the canonical Empty Box. Directions are zero-based. It is an error if not 0 <= dir < SpaceDim.

References convert(), isEmpty(), and shift().

Referenced by ProblemDomain::growLo().

◆ growDir()

Box & Box::growDir ( int  a_idir,
const Side::LoHiSide a_sd,
int  a_cell 
)
inline

growLo if a_sd == Side::Lo \ growHi if a_sd= = Side::Hi

References Side::Lo.

◆ growHi()

Box & Box::growHi ( int  idir,
int  n_cell = 1 
)
inline

Modifies this Box by growing it on the high end by n_cell cells in direction idir. The Empty Box is not modified by this function. NOTE: n_cell negative shrinks the Box by that number of cells. If shrinking produces an empty Box, the Box is transformed into the canonical Empty Box. Directions are zero-based. It is an error if not 0 <= dir < SpaceDim.

References convert(), isEmpty(), operator &(), and shift().

Referenced by ProblemDomain::growHi().

◆ refine() [1/2]

Box& Box::refine ( int  refinement_ratio)

refinement

Modifies this Box by refining it by given (positive) refinement ratio. The Empty Box is not modified by this function. \

NOTE: if type(dir) = CELL centered: lo <- lo*ratio and hi <- (hi+1)*ratio - 1. \

NOTE: if type(dir) = NODE centered: lo <- lo*ratio and hi <- hi*ratio.

Referenced by coarsenable().

◆ refine() [2/2]

Box& Box::refine ( const IntVect refinement_ratio)

Modifies this Box by refining it by given (positive) refinement ratio. The Empty Box is not modified by this function. \

NOTE: if type(dir) = CELL centered: lo <- lo*ratio and hi <- (hi+1)*ratio - 1.\

NOTE: if type(dir) = NODE centered: lo <- lo*ratio and hi <- hi*ratio.

◆ coarsenable()

bool Box::coarsenable ( int  refrat) const
inline

◆ coarsen() [1/2]

Box& Box::coarsen ( int  refinement_ratio)

Modifies this Box by coarsening it by given (positive) refinement ratio. The Empty Box is not modified by this function. \

NOTE: if type(dir) = CELL centered: lo <- lo/ratio and hi <- hi/ratio.\

NOTE: if type(dir) = NODE centered: lo <- lo/ratio and hi <- hi/ratio + ((hiratio)==0 ? 0 : 1).\

That is, refinement of coarsened Box must contain the original Box.

Referenced by coarsenable(), and MultilevelLinearOp< T >::dotProduct().

◆ coarsen() [2/2]

Box& Box::coarsen ( const IntVect refinement_ratio)

Modifies this Box by coarsening by given (positive) refinement ratio. The Empty Box is not modified by this function. \

NOTE: if type(dir) = CELL centered: lo <- lo/ratio and hi <- hi/ratio.\

NOTE: if type(dir) = NODE centered: lo <- lo/ratio and hi <- hi/ratio + ((hiratio)==0 ? 0 : 1).\

That is, refinement of coarsened Box must contain the original Box.

◆ next() [1/2]

void Box::next ( IntVect ) const

◆ next() [2/2]

void Box::next ( IntVect p,
const int *  shv 
) const

◆ chop()

Box Box::chop ( int  dir,
int  chop_pnt 
)

misc

Chops the Box at the chop_pnt in the dir direction returns one Box, modifies the object Box. The union of the two is the original Box. The modified Box is the low end, the returned Box is the high end. If type(dir) = CELL, the Boxes are disjoint with the chop_pnt included in the high end (new Box). It is an ERROR if chop_pnt is the low end of the orig Box. If type(dir) = NODE, the chop_pnt is included in both Boxes but is the only point in common. It is also an error if the chop_pnt is an end node of the Box. Directions are zero-based. It is an error if not 0 <= dir < SpaceDim.

◆ degenerate()

void Box::degenerate ( Box a_to,
const SliceSpec a_sliceSpec,
bool *  a_outofbounds = 0 
) const

Makes a_to a box that's the same as *this except that it's just one cell thick in the a_sliceSpec.direction-th direction, and its (one) coordinate in that direction is a_sliceSpec.position.

If a_sliceSpec.position is outside the range of *this, and a_outofbounds isn't null, then we set *a_outofbounds to true, otherwise to false.

It would be more natural to return a Box, than to set the value of a Box reference, but we do it this way to be consistent with BaseFab::degenerate() where we can't return an object because of the policy of disallowing copy constructors for heavyweight classes.

Referenced by BaseFab< Real >::degenerate().

◆ p()

void Box::p ( ) const

print to pout()

◆ dumpOn()

void Box::dumpOn ( std::ostream &  strm) const

Gives more detail than printOn. Useful for exiting due to an error.

◆ computeBoxLen()

void Box::computeBoxLen ( )
inline

{ Box Constants}

This is a canonical empty Box of cell-centered type.

◆ computeBoxLenNotEmpty()

void Box::computeBoxLenNotEmpty ( )
inline

◆ setTempestOutputFormat()

static void Box::setTempestOutputFormat ( bool  )
static

Doesn't print the IndexType, and uses square outer brackets.

◆ smallEnd() [3/3]

int Box::smallEnd ( const int  dir) const
inline

◆ bigEnd() [3/3]

int Box::bigEnd ( const int  dir) const
inline

◆ size() [3/3]

IntVect Box::size ( ) const
inline

References D_DECL6, and IntVect::IntVect().

Friends And Related Function Documentation

◆ HDF5Handle

friend class HDF5Handle
friend

◆ surroundingNodes [1/2]

Box surroundingNodes ( const Box b,
int  dir 
)
friend

Returns a Box with NODE based coordinates in direction dir that encloses the argument Box. NOTE: equivalent to b.convert(dir,NODE). NOTE: error if b.type(dir) == NODE. Directions are zero-based. It is an error if not 0 <= dir < SpaceDim. The Empty Box is not modified by this function except for changing of type.

◆ surroundingNodes [2/2]

Box surroundingNodes ( const Box b)
friend

Returns a Box with NODE based coordinates in all directions that encloses argument Box. The upper corner of the return Box will be one more in all components than the upper corner of the argument Box. The Empty Box is not modified by this function except for changing of type.

◆ enclosedCells [1/2]

Box enclosedCells ( const Box b,
int  dir 
)
friend

Returns a Box with CELL based coordinates in direction dir that is enclosed by argument Box. NOTE: equivalent to b.convert(dir,CELL). NOTE: error if b.type(dir) == CELL. Directions are zero-based. It is an error if not 0 <= dir < SpaceDim. The Empty Box is not modified by this function except for changing of type.

◆ enclosedCells [2/2]

Box enclosedCells ( const Box b)
friend

Returns a Box with CELL based coordinates in all directions that is enclosed by argument Box. The upper corner of the return Box will be one less in all components than the upper corner of the argument Box. The Empty Box is not modified by this function except for changing of type.

◆ bdryBox

Box bdryBox ( const Box b,
int  dir,
Side::LoHiSide  a_sd,
int  len 
)
friend

neighbor box functions

◆ bdryLo

Box bdryLo ( const Box b,
int  dir,
int  len 
)
friend

Returns the edge-centered Box (in direction dir) defining the low side of the argument Box. The output Box will have the given length in the given direction. Directions are zero-based. It is an error if not 0 <= dir < SpaceDim. The neighbor of an Empty Box is an Empty Box of the appropriate type.

◆ bdryHi

Box bdryHi ( const Box b,
int  dir,
int  len 
)
friend

Returns the edge-centered Box (in direction dir) defining the high side of the argument Box. The return Box will have the given length in the given direction. Directions are zero-based. It is an error if not 0 <= dir < SpaceDim. The neighbor of an Empty Box is an Empty Box of the appropriate type.

◆ adjCellLo

Box adjCellLo ( const Box b,
int  dir,
int  len 
)
friend

Returns the cell centered Box of the given length adjacent to the argument Box on the low end along the given coordinate direction. The return Box is identical to the argument Box in the other directions. The return Box and the argument Box have an empty intersection. \

NOTE: len != 0. A negative length results in cells inside the original box. \

NOTE: Box retval = adjCellLo(b,dir,len) is equivalent to the following set of operations: \

Box retval(b); \

retval.convert(dir,Box::CELL); \

retval.setrange(dir,retval.smallEnd(dir)-len,len); \

Directions are zero-based. It is an error if not 0 <= dir < SpaceDim. The neighbor of an Empty Box is an Empty Box of the appropriate type.

◆ adjCellHi

Box adjCellHi ( const Box b,
int  dir,
int  len 
)
friend

Returns the cell centered Box of the given length adjacent to the argument Box on the high end along the given coordinate direction. The return Box is identical to the argument Box in the other directions. The return Box and the argument Box have an empty intersection. \

NOTE: len != 0. A Negative length results in cells inside the original box. \

NOTE: Box retval = adjCellHi(b,dir,len) is equivalent to the following set of operations: \

Box retval(b); \

retval.convert(dir,Box::CELL); \

retval.setrange(dir,retval.bigEnd(dir)+1,len);\

Directions are zero-based. It is an error if not 0 <= dir < SpaceDim. The neighbor of an Empty Box is an Empty Box of the appropriate type.

◆ adjCellBox

Box adjCellBox ( const Box b,
int  dir,
Side::LoHiSide  a_side,
int  len 
)
friend

◆ minBox

Box minBox ( const Box b1,
const Box b2 
)
friend

Returns a Box that is the minimum Box containing both the argument Boxes. Both Boxes must have identical type.

◆ grow [1/2]

Box grow ( const Box b,
int  i 
)
friend

Returns a Box that is the argument Box grown in all directions by given amount. The Empty Box is not modified by this function. NOTE: n_cell negative shrinks the Box by that number of cells. If shrinking produces an empty Box, the Box is transformed into the canonical Empty Box.

◆ grow [2/2]

Box grow ( const Box b,
const IntVect v 
)
friend

Returns a Box that is the argument Box grown in each direction by specified amount. The Empty Box is not modified by this function. NOTE: components of iv may be negative, which would return a shrunken Box. If shrinking produces an empty Box, the Box is transformed into the canonical Empty Box.

◆ refine [1/2]

Box refine ( const Box b,
int  refinement_ratio 
)
friend

Returns a Box that is the argument Box refined by given (positive) refinement ratio. The Empty Box is not modified by this function. \

NOTE: if type(dir) = CELL centered: lo <- lo*ratio and hi <- (hi+1)*ratio - 1.\

NOTE: if type(dir) = NODE centered: lo <- lo*ratio and hi <- hi*ratio.

◆ refine [2/2]

Box refine ( const Box b,
const IntVect refinement_ratio 
)
friend

Returns a Box that is the argument Box refined by given (positive) refinement ratio. The Empty Box is not modified by this function. \

NOTE: if type(dir) = CELL centered: lo <- lo*ratio and hi <- (hi+1)*ratio - 1.\

NOTE: if type(dir) = NODE centered: lo <- lo*ratio and hi <- hi*ratio.

◆ coarsen [1/2]

Box coarsen ( const Box b,
int  refinement_ratio 
)
friend

Returns a Box that is the argument Box coarsened by given (positive) refinement ratio. The Empty Box is not modified by this function. \

NOTE: if type(dir) = CELL centered: lo <- lo/ratio and hi <- hi/ratio.\

NOTE: if type(dir) = NODE centered: lo <- lo/ratio and hi <- hi/ratio + ((hiratio)==0 ? 0 : 1).\

That is, refinement of coarsened Box must contain the original Box.

◆ coarsen [2/2]

Box coarsen ( const Box b,
const IntVect refinement_ratio 
)
friend

Returns a Box that is the argument Box coarsened by given (positive) refinement ratio. The Empty Box is not modified by this function. \

NOTE: if type(dir) = CELL centered: lo <- lo/ratio and hi <- hi/ratio.\

NOTE: if type(dir) = NODE centered: lo <- lo/ratio and hi <- hi/ratio + ((hiratio)==0 ? 0 : 1).\

That is, refinement of coarsened Box must contain the original Box.

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const Box bx 
)
friend

{ I/O Functions}

Write an ASCII representation to the ostream.

◆ operator>>

std::istream& operator>> ( std::istream &  os,
Box bx 
)
friend

Read from istream.

Member Data Documentation

◆ smallend

IntVect Box::smallend
protected

◆ bigend

IntVect Box::bigend
protected

◆ btype

IndexType Box::btype
protected

Referenced by grow(), operator==(), and sameType().

◆ s_tempestOutputFormat

bool Box::s_tempestOutputFormat
staticprotected

◆ m_lb

IntVect Box::m_lb

◆ m_ub

IntVect Box::m_ub

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