Box Class Reference

#include <Box.H>

List of all members.


Detailed Description

An interval in DIM dimensional space.

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 PointgetLowCorner () const
 Access a Box's lowCorner.
const PointgetHighCorner () const
 Access a Box's highCorner.
const PointgetLowCorner ()
 Access a Box's lowCorner.
const PointgetHighCorner ()
 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.


Constructor & Destructor Documentation

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).

Box::Box ( const Point a_lowCorner,
const Point a_highCorner 
)

Constructor for nontrivial Box using two Points.

Box::Box ( const Box a_Box  ) 

Copy constructor.


Member Function Documentation

Box Box::operator & ( const Box a_rightBox  )  const

Computes the intersection of the Box with a_rightBox. Box AND operation.

Returns a new Box which is the intersection of *this and *a_rightBox. *this is unchanged

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().

Box Box::shift ( const Point a_pt  )  const

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 all of the coordinate directions by a_numpoints.

Does not change *this. Returns the grown box. Returned Box satisfies: m_upperCorner_new = m_upperCorner_old + getOnes()*a_numpoints, m_lowerCorner_new = m_lowerCorner_old - getOnes()*a_numpoints.

Box Box::grow ( const Point a_pt  )  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().

Box Box::coarsen ( const Point a_pt  )  const

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().

Box Box::refine ( const Point a_pt  )  const

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 ( const Point a_pt  )  const

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]

const Point& Box::getHighCorner (  )  const [inline]

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]

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

bool Box::contains ( const Box a_rhs  )  const [inline]

Checks if the Box contains another Box a_rhs.

References contains(), m_highCorner, and m_lowCorner.

Point Box::mod ( const Point a_pt  )  const

Finds periodic image of input that is contained in the Box.

This function will test if the Box with lowCorner = a_rhs.m_lowerCorner + a_extent.m_lowerCorner and highCorner = // a_rhs.m_highCorner + a_extent.m_highCorner resides within *this.

Todo:
Determine the purpose of this function

unsigned int Box::getIndex ( const Point a_pt  )  const [inline]

bool Box::notDone ( const Point a_pt  )  const [inline]

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

Get Point corresponding to a linear index in [0, ... sizeOf()-1] inside the Box.

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]

Returns True if the Box has non-positive "volume".

References m_size.

void Box::recomputeSize (  )  [private]

Used to reevaluate the size of the box when it is changed.


Member Data Documentation

Point object containing the lower bounds of the Box.

Referenced by contains(), getIndex(), getLowCorner(), operator==(), and size().

Point object containing the upper bounds of the Box.

Referenced by contains(), getHighCorner(), getIndex(), notDone(), operator==(), and size().

int Box::m_size [private]

"Volume" of the box.

Referenced by isEmpty(), and sizeOf().


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

Generated on Fri Mar 11 12:53:44 2016 for AMRStencil by  doxygen 1.5.5