#include <Box.H>
A Box is a region specified by two corners, highCorner and lowCorner. In 2 dimensions, a Box is a rectangular region. In 3 dimensions, a Box is a rectangular prism, etc.
Public Member Functions | |
Box () | |
Default constructor. | |
Box (const Point &a_lowCorner, const Point &a_highCorner) | |
Constructor for nontrivial Box using two Points. | |
Box (const Box &a_Box) | |
Copy constructor. | |
Box | operator & (const Box &a_rightBox) const |
Computes the intersection of the Box with a_rightBox. Box AND operation. | |
void | operator &= (const Box &a_rightBox) |
Computes intersection of Box and a_rightBox in place. | |
Box | shift (int a_direction, int a_offset) const |
Computes shifted Box by a_offset in direction a_direction. | |
Box | shift (const Point &a_pt) const |
Computes a Box shifted according to the vector a_pt. | |
Box | grow (int a_numpoints) const |
Grow in all of the coordinate directions by a_numpoints. | |
Box | grow (const Point &a_pt) const |
Grow in each coordinate direction by an amount given by the component of a_pt. | |
Box | coarsen (int a_numpoints) const |
coarsen in all of the coordinate directions by a_numpoints. | |
Box | coarsen (const Point &a_pt) const |
coarsen in each coordinate direction by an amount given by the component of a_pt. | |
Box | refine (int a_numpoints) const |
refine in all of the coordinate directions by a_numpoints. | |
Box | refine (const Point &a_pt) const |
refine in each coordinate direction by an amount given by the component of a_pt. | |
Box | refineCC (const Point &a_pt) const |
refine in each coordinate direction by an amount given by the component of a_pt. | |
Box | refineCC (int a_nref) const |
const Point & | getLowCorner () const |
Access a Box's lowCorner. | |
const Point & | getHighCorner () const |
Access a Box's highCorner. | |
const Point & | getLowCorner () |
Access a Box's lowCorner. | |
const Point & | getHighCorner () |
Access a Box's highCorner. | |
const int & | sizeOf () const |
Computes the size, or "volume", of the Box. | |
bool | operator== (const Box &a_rhsBox) const |
Defines equality between Boxes. | |
bool | contains (const Point &a_pt) const |
Checks if the Box contains the Point a_pt. | |
bool | contains (const Box &a_rhs) const |
Checks if the Box contains another Box a_rhs. | |
Point | mod (const Point &a_pt) const |
Finds periodic image of input that is contained in the Box. | |
unsigned int | getIndex (const Point &a_pt) const |
Get linear index of a Point in a Box. | |
bool | notDone (const Point &a_pt) const |
Returns false if a_pt(k) > m_highCorner(k) for k in [0,Dim). | |
unsigned int | size (unsigned char a_dim) const |
Returns the number of points that lie along a Box's edge in direction a_dim. | |
void | increment (Point &a_pt) const |
iteration through the points in a Box. a_pt is incremented to the next point in the Box. | |
Point | getPoint (unsigned int k) const |
Get Point corresponding to a linear index in [0, ... sizeOf()-1] inside the Box. | |
void | print () const |
Prints the Box to the command line. | |
bool | isEmpty () const |
Returns True if the Box has non-positive "volume". | |
Private Member Functions | |
void | recomputeSize () |
Used to reevaluate the size of the box when it is changed. | |
Private Attributes | |
Point | m_lowCorner |
Point object containing the lower bounds of the Box. | |
Point | m_highCorner |
Point object containing the upper bounds of the Box. | |
int | m_size |
"Volume" of the box. |
Box::Box | ( | ) |
Default constructor.
The Box's upper and lower corner default to (-1,-1,...,-1) and (0,0,...,0) respectively. The default size is -1 (empty).
Constructor for nontrivial Box using two Points.
Box::Box | ( | const Box & | a_Box | ) |
Copy constructor.
void Box::operator &= | ( | const Box & | a_rightBox | ) |
Computes intersection of Box and a_rightBox in place.
Modifies *this to be the intersection of *this and a_rightBox.
Box Box::shift | ( | int | a_direction, | |
int | a_offset | |||
) | const |
Computes shifted Box by a_offset in direction a_direction.
Does not change *this. Returns the shifted box.
Referenced by RectMDArray< T, C, D, E >::copyTo(), and RectMDArray< T, C, D, E >::shift().
Computes a Box shifted according to the vector a_pt.
Does not change *this. Returns the shifted box. Each point is shifted by adding a_pt.
Box Box::grow | ( | int | a_numpoints | ) | const |
Grow in each coordinate direction by an amount given by the component of a_pt.
Does not change *this. Returns the grown box. Returned Box satisfies: m_upperCorner_new = m_upperCorner_old + a_pt, m_lowerCorner_new = m_lowerCorner_old - a_pt.
Box Box::coarsen | ( | int | a_numpoints | ) | const |
coarsen in all of the coordinate directions by a_numpoints.
does not change *this. returns the coarsened box
Referenced by LevelData< T, C, D, E >::generateBoxes().
coarsen in each coordinate direction by an amount given by the component of a_pt.
does not change *this. returns the coarsened box
Box Box::refine | ( | int | a_numpoints | ) | const |
refine in all of the coordinate directions by a_numpoints.
does not change *this. returns the refined box
Referenced by forall_CToF().
refine in each coordinate direction by an amount given by the component of a_pt.
does not change *this. returns the refined box
refine in each coordinate direction by an amount given by the component of a_pt.
does not change *this. returns the refined box
Box Box::refineCC | ( | int | a_nref | ) | const |
does not change *this. returns the refined box
const Point& Box::getLowCorner | ( | ) | const [inline] |
Access a Box's lowCorner.
Called by a constant Box. Returned object cannot be changed.
References m_lowCorner.
Referenced by abs_argmax(), abs_max(), Stencil< T >::apply(), componentApply(), RectMDArray< T, C, D, E >::copyTo(), RectMDArray< T, C, D, E >::divide(), LevelData< T, C, D, E >::exchange(), LevelData< T, C, D, E >::exchangeSingleBox(), forall(), forall_CToF(), forall_max(), forall_max_scal(), forall_scal(), forall_stride(), forall_vect(), forall_vect_max(), LevelData< T, C, D, E >::generateBoxes(), LevelData< T, C, D, E >::getGhostBox(), LevelData< T, C, D, E >::getNeighbor(), RectMDArray< T, C, D, E >::minus(), RectMDArray< T, C, D, E >::plus(), and RectMDArray< T, C, D, E >::times().
const Point& Box::getHighCorner | ( | ) | const [inline] |
Access a Box's highCorner.
Called by a constant Box. Returned object cannot be changed.
References m_highCorner.
Referenced by Stencil< T >::apply(), RectMDArray< T, C, D, E >::divide(), LevelData< T, C, D, E >::generateBoxes(), LevelData< T, C, D, E >::getGhostBox(), LevelData< T, C, D, E >::getNeighbor(), RectMDArray< T, C, D, E >::minus(), RectMDArray< T, C, D, E >::plus(), and RectMDArray< T, C, D, E >::times().
const Point& Box::getLowCorner | ( | ) | [inline] |
Access a Box's lowCorner.
Called by a non-constant Box. Returned object can be changed.
References m_lowCorner.
const Point& Box::getHighCorner | ( | ) | [inline] |
Access a Box's highCorner.
Called by a non-constant Box. Returned object can be changed.
References m_highCorner.
const int& Box::sizeOf | ( | ) | const [inline] |
Computes the size, or "volume", of the Box.
References m_size.
Referenced by RectMDArray< T, C, D, E >::dataSize(), RectMDArray< T, C, D, E >::divide(), RectMDArray< T, C, D, E >::get(), RectMDArray< T, C, D, E >::get2(), RectMDArray< T, C, D, E >::get3(), RectMDArray< T, C, D, E >::getConst(), RectMDArray< T, C, D, E >::getConst2(), RectMDArray< T, C, D, E >::getConst3(), RectMDArray< T, C, D, E >::minus(), RectMDArray< T, C, D, E >::plus(), slice(), and RectMDArray< T, C, D, E >::times().
bool Box::operator== | ( | const Box & | a_rhsBox | ) | const [inline] |
Defines equality between Boxes.
Two Boxes are considered equal if they have identical (==) lowCorner and highCorner
References m_highCorner, and m_lowCorner.
bool Box::contains | ( | const Point & | a_pt | ) | const |
Checks if the Box contains the Point a_pt.
Referenced by contains(), LevelData< T, C, D, E >::exchangeSingleBox(), LevelData< T, C, D, E >::generateBoxes(), LevelData< T, C, D, E >::getPeriodicCornerNeighborInfo(), and LevelData< T, C, D, E >::getPeriodicEdgeNeighborInfo().
bool Box::contains | ( | const Box & | a_rhs | ) | const [inline] |
unsigned int Box::getIndex | ( | const Point & | a_pt | ) | const [inline] |
Get linear index of a Point in a Box.
Indices have values from 0 to m_size-1.
References m_highCorner, and m_lowCorner.
Referenced by Stencil< T >::apply(), RectMDArray< T, C, D, E >::divide(), RectMDArray< T, C, D, E >::get(), RectMDArray< T, C, D, E >::get2(), RectMDArray< T, C, D, E >::get3(), RectMDArray< T, C, D, E >::getConst(), RectMDArray< T, C, D, E >::getConst2(), RectMDArray< T, C, D, E >::getConst3(), RectMDArray< T, C, D, E >::minus(), RectMDArray< T, C, D, E >::plus(), and RectMDArray< T, C, D, E >::times().
bool Box::notDone | ( | const Point & | a_pt | ) | const [inline] |
Returns false if a_pt(k) > m_highCorner(k) for k in [0,Dim).
References m_highCorner.
Referenced by abs_argmax(), abs_max(), componentApply(), RectMDArray< T, C, D, E >::copyTo(), RectMDArray< T, C, D, E >::divide(), LevelData< T, C, D, E >::exchange(), LevelData< T, C, D, E >::exchangeSingleBox(), forall(), forall_CToF(), forall_max(), forall_max_scal(), forall_scal(), forall_stride(), forall_vect(), forall_vect_max(), RectMDArray< T, C, D, E >::minus(), RectMDArray< T, C, D, E >::plus(), and RectMDArray< T, C, D, E >::times().
unsigned int Box::size | ( | unsigned char | a_dim | ) | const [inline] |
Returns the number of points that lie along a Box's edge in direction a_dim.
This is a measure of the "edge length" of the Box. Note that the value returned is the number of points along the Box's edge, NOT m_highCorner[a_dim] - m_lowCorner[a_dim].
References m_highCorner, and m_lowCorner.
Referenced by LevelData< T, C, D, E >::getGhostBox(), LevelData< T, C, D, E >::getPeriodicCornerNeighborInfo(), LevelData< T, C, D, E >::getPeriodicEdgeNeighborInfo(), and LevelData< T, C, D, E >::getPeriodicFlapNeighborInfo().
void Box::increment | ( | Point & | a_pt | ) | const |
iteration through the points in a Box. a_pt is incremented to the next point in the Box.
Currently, increment only works when DIM <= 3. When calling increment on m_highCorner, the resulting Point will no longer be inside *this (contains() will return FALSE).
Referenced by abs_argmax(), abs_max(), componentApply(), RectMDArray< T, C, D, E >::copyTo(), RectMDArray< T, C, D, E >::divide(), LevelData< T, C, D, E >::exchange(), LevelData< T, C, D, E >::exchangeSingleBox(), forall(), forall_CToF(), forall_max(), forall_max_scal(), forall_scal(), forall_stride(), forall_vect(), forall_vect_max(), RectMDArray< T, C, D, E >::minus(), RectMDArray< T, C, D, E >::plus(), and RectMDArray< T, C, D, E >::times().
Point Box::getPoint | ( | unsigned int | k | ) | const |
void Box::print | ( | ) | const |
Prints the Box to the command line.
Referenced by RectMDArray< T, C, D, E >::print(), and BoxLayout::print().
bool Box::isEmpty | ( | ) | const [inline] |
void Box::recomputeSize | ( | ) | [private] |
Used to reevaluate the size of the box when it is changed.
Point Box::m_lowCorner [private] |
Point object containing the lower bounds of the Box.
Referenced by contains(), getIndex(), getLowCorner(), operator==(), and size().
Point Box::m_highCorner [private] |
Point object containing the upper bounds of the Box.
Referenced by contains(), getHighCorner(), getIndex(), notDone(), operator==(), and size().
int Box::m_size [private] |