Proto
3.2
|
An interval in DIM dimensional space. More...
#include <Proto_Box.H>
Public Types | |
typedef BoxIterator | iterator |
Public Member Functions | |
void | recomputeSize () |
Used to reevaluate the size of the box when it is changed. More... | |
Constructors | |
Box () | |
Default Constructor. More... | |
Box | faceBox (int a_idir, const Side::LoHiSide a_side) const |
Box (const Point &a_low, const Point &a_high) | |
Two-Point Constructor. More... | |
Box (const int *a_low, const int *a_high) | |
Primitive Two-Point Constructor. More... | |
Box (const Point &a_sizes) | |
Size Constructor. More... | |
ACCEL_DECORATION | Box (const Box &a_box) |
Copy Constructor. More... | |
void | define (const int *a_lo, const int *a_hi) |
Primitive Two-Point Lazy Constructor. More... | |
Accessors And Queries | |
ACCEL_DECORATION Point | low () const |
Access Low Corner. More... | |
ACCEL_DECORATION Point | high () const |
Access High Corner. More... | |
Point | boundary (const Side::LoHiSide a_side) const |
ACCEL_DECORATION std::size_t | size (unsigned int a_dim) const |
Edge Size. More... | |
ACCEL_DECORATION std::size_t | size () const |
Volumetric Size. More... | |
ACCEL_DECORATION Point | sizes () const |
All Sizes. More... | |
ACCEL_DECORATION bool | containsPoint (const Point &a_pt) const |
Contains Point Query. More... | |
ACCEL_DECORATION bool | containsBox (const Box &a_rhs) const |
Contains Box Query. More... | |
bool | onBoundary (const Point &a_p) const |
Point on Boundry Query. More... | |
Point | whichBoundaryContains (const Point &a_point) const |
ACCEL_DECORATION bool | empty () const |
Empty Query. More... | |
ACCEL_DECORATION unsigned int | index (const Point &a_pt) const |
Point to Linear Index. More... | |
ACCEL_DECORATION Point | operator[] (unsigned int a_index) const |
Access Point by Index. More... | |
ACCEL_DECORATION Point | operator() (unsigned int a_idx, unsigned int a_idy, unsigned a_idz) const |
Operators | |
Box | operator & (const Box &a_rightBox) const |
Intersection Operator. More... | |
void | operator &= (const Box &a_rhs) |
In Place Intersection. More... | |
Box | operator+ (const Box &box) const |
void | operator+= (const Box &box) |
Box | operator & (const Point &a_pt) const |
Add Point Operator. More... | |
void | operator &= (const Point &a_pt) |
In Place Add Point Operator. More... | |
bool | operator== (const Box &a_rhsBox) const |
Equality Operator. More... | |
bool | operator!= (const Box &a_rhsBox) const |
Inequality Operator. More... | |
bool | operator< (const Box &a_rhsBox) const |
Less Than Operator. More... | |
ACCEL_DECORATION Point | operator% (const Point &a_pt) const |
Modulus Operator. More... | |
ACCEL_DECORATION Point | mod (const Point &a_pt) const |
Modulus Function. More... | |
Transformations | |
Box | shift (int a_direction, int a_offset) const |
Shift Transformation. More... | |
Box | shift (const Point &a_pt) const |
Point Shift Transformation. More... | |
Box | toOrigin () const |
Shift To Origin. More... | |
Box | grow (int a_numpoints) const |
Isotropic Grow Operation. More... | |
Box | grow (const Point &a_pt) const |
Anisotropic Grow Operation. More... | |
Box | grow (int a_dir, int a_dist) const |
Anisotropic Grow (Int Version) More... | |
Box | grow (int a_dir, Side::LoHiSide a_side, int a_dist) const |
One-Sided Grow. More... | |
Box | grow (Centering a_ctr) const |
Apply Centering. More... | |
Box | extrude (const Point &a_dir, int a_dist=1) const |
Extrude. More... | |
Box | extrude (int a_dir, int a_dist=1, bool a_upper=true) const |
Extrude (Primitive Version) More... | |
Box | growHi (int a_dir, int a_dist) const |
Grow High Side. More... | |
Box | growLo (int idir, int igrow) const |
Grow Low Side. More... | |
Box | coarsen (unsigned int a_ratio) const |
Isotropic Coarsen Operation. More... | |
Box | coarsen (const Point &a_pt) const |
Anisotropic Coarsen Operation. More... | |
bool | coarsenable (const int &a_ratio) const |
(Isotropic) Coarsenable Query More... | |
bool | coarsenable (const Point &a_ratio) const |
(Anisotropic) Coarsenable Query More... | |
Box | taperCoarsen (const Point &a_ref) const |
Tapered Coarsen. More... | |
Box | refine (const Point &a_pt) const |
Anisotropic Refine Operation. More... | |
Box | refine (unsigned int a_ratio) const |
Isotropic Refine Operation. More... | |
Box | edge (const Point &a_dir, int a_dist) const |
Edge. More... | |
Box | edge (const Point &a_dir) const |
Edge (Anisotropic) More... | |
Box | edge (int a_dir, Side::LoHiSide a_side, int a_dist) const |
Box | face (int a_dir, Side::LoHiSide a_side, int a_dist=1) const |
Face. More... | |
Box | face (Point a_dir, int a_dist=1) const |
Box | flatten (const int a_dir, bool a_upper=false) const |
Flatten. More... | |
Box | adjacent (const Point &a_dir, int a_dist) const |
Adjacent Cells. More... | |
Box | adjacent (const Point &a_dir) const |
Adjacent Cells (Anisotropic) More... | |
Box | adjacent (int a_dir, Side::LoHiSide a_side, int a_dist) const |
Adjacent Cells (Side) More... | |
Box | adjCellLo (int a_dir, int a_dist) const |
Box | adjCellHi (int a_dir, int a_dist) const |
Box | adjCellSide (int a_idir, int a_length, Side::LoHiSide a_sd) const |
Utility | |
BoxIterator | begin () const |
Iterator Begin. More... | |
BoxIterator | end () const |
Iterator End. More... | |
BoxIterator | rbegin () const |
Iterator Reverse Begin. More... | |
BoxIterator | rend () const |
Iterator Reverse End. More... | |
size_t | linearSize () const |
Linear Size. More... | |
void | linearIn (const char *a_buf) |
Read From Buffer. More... | |
void | linearOut (char *a_buf) const |
Write To Buffer. More... | |
void | print () const |
Print. More... | |
std::string | str () const |
Public Attributes | |
Point | m_low |
Point object containing the lower bounds of the Box. More... | |
Point | m_high |
Point object containing the upper bounds of the Box. More... | |
int | m_size |
"Volume" of the box. More... | |
Static Functions | |
static Box | Cube (int a_size) |
static Box | Kernel (int a_radius) |
Build Kernel Box. More... | |
static ACCEL_DECORATION unsigned int | sindex (Point a_pt, Point a_low, Point a_high) |
Stencil Index. More... | |
An interval in DIM dimensional space.
A Box is a region in \( \mathbb{Z}^{DIM} \) specified by two corner Point objects, high
and low
INCLUSIVELY. Equivalently, a Box is a collection of \(DIM\) linear intervals in \(\mathbb{Z}^{DIM}\) \([low[i] ,high[i]] : i \in [0,DIM)\). Boxes are written using the notation [low, high]
.
typedef BoxIterator Proto::Box::iterator |
|
inline |
Default Constructor.
Builds the empty Box [(-1,-1,...,-1), (0,0,...,0)]
Referenced by Box(), faceBox(), and Proto::operator>>().
Two-Point Constructor.
Builds the non-trivial Box [low, high]
a_low | low corner |
a_high | high corner |
|
inline |
|
inline |
Size Constructor.
Builds the non-trivial Box [(0,...,0), a_sizes - (1,...,1)]
. This is the box with its low corner at the origin and a_sizes[dir]
Points in direction dir
.
a_sizes | sizes |
|
inline |
Copy Constructor.
|
inline |
References adjCellSide(), Proto::Point::Basis(), Box(), Proto::Side::Lo, and shift().
|
inline |
|
inlinestatic |
Build Cube Box Creates the Box [Point::Zeros(), Point::Ones(a_size-1)]
, a cube in \(\bf{Z}^{DIM}\) of side length a_size
a_size | side length |
Referenced by Box().
|
inlinestatic |
Build Kernel Box.
Creates a Box of size 2*a_radius + 1
on all sides with (0,...,0) at the center. Useful for iterating through boundary cells, defining symmetric Stencils, etc.
a_radius | the number of "rings" of cells around the center cell. |
Example:
Referenced by Box().
|
inlinestaticprivate |
|
inline |
Access Low Corner.
This function returns by value; a Box cannot be altered through the output of low()
.
References ACCEL_DECORATION, and m_low.
Referenced by Proto::CompositeOp< NDOMAINS >::ghost(), and Proto::operator>>().
|
inline |
Access High Corner.
This function returns by value; a Box cannot be altered through the output of high()
.
References ACCEL_DECORATION, boundary(), containsBox(), containsPoint(), m_high, onBoundary(), size(), sizes(), and whichBoundaryContains().
Referenced by Proto::CompositeOp< NDOMAINS >::ghost(), and Proto::operator>>().
|
inline |
Referenced by high().
|
inline |
Edge Size.
Returns the "edge length" of this Box on a given axis
/param a_dim direction axis in [0,DIM)
Example:
Referenced by Proto::MBInterpLayout::isIgnoredAxis(), and Proto::BoxData< T, C, MEM, D, E >::size().
|
inline |
|
inline |
All Sizes.
Returns all sizes at once in the form of a Point.
Referenced by high(), and Proto::ProblemDomain::sizes().
|
inline |
Contains Point Query.
Checks if a_pt is inside of *this. Note that this->low()
and this->high()
are both considered inside *this
Example:
Referenced by high().
|
inline |
Contains Box Query.
Check if Box a_rhs is a subset of *this. Returns true even if a_rhs is not a proper subset. Equivalent to this->contains(a_rhs.low()) && this->contains(a_rhs.high()
Example:
Referenced by high().
|
inline |
Returns the direction of the region adjacent to this which contains a point. Point::Zeros() is returned if a_point is contained inside of this
Referenced by high().
|
inline |
Empty Query.
Check if *this contains no Points
References ACCEL_DECORATION, adjacent(), adjCellHi(), adjCellLo(), coarsen(), coarsenable(), edge(), extrude(), face(), flatten(), grow(), growHi(), growLo(), index(), m_size, mod(), operator &(), operator &=(), operator!=(), operator%(), operator()(), operator+(), operator+=(), operator<(), operator==(), operator[](), refine(), shift(), taperCoarsen(), and toOrigin().
|
inline |
Point to Linear Index.
Returns a linear index in [0,this->size())
associated with a_pt
. Fails by assertion if a_pt
is not inside *this
. Indices start at this->low()
which has an index of 0. Indices increase fastest in dimension 0 and slowest in dimension DIM-1
. this->high()
has an index of this->size()-1
as is consistent with the < operator of Point
.
a_pt | a Point inside *this |
Referenced by empty().
|
inline |
|
inline |
Referenced by empty().
Intersection Operator.
Returns a new Box which is the intersection of *this
and *a_rightBox
.
a_rightBox | Another Box |
Example:
Referenced by empty().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Shift Transformation.
Creates a new Box shifted in a_direction
by a_offset
units relative to *this
.
a_direction | an int in /f$[0,DIM)/f$ specifying a direction |
a_offset | number of points to offset. Use a negative value for a negative offset. |
Example:
|
inline |
|
inline |
Isotropic Grow Operation.
Returns a new Box which is larger in every direction by a_numpoints units. If a_numpoints is negative, the box will shrink.
a_numpoints | number of points to grow by in each direction |
Example:
Referenced by Proto::MBBoundaryData< T, C, MEM >::define(), empty(), and Proto::MBBoundaryData< T, C, MEM >::localBox().
|
inline |
Anisotropic Grow (Int Version)
Returns grow(Point::Basis(a_dir, a_dist)) Useful in places where plain-old-data inputs are preferable. To grow a grow a box only upwards / downwards, see Box::extrude
.
a_dir | A direction in [0,DIM) |
a_dist | Distance to grow |
|
inline |
Apply Centering.
Create a new Box that is grown in such a way as to accomodate the extra points needed by a domain with the specified centering. If a_ctr=PR_CELL this function is a null-op.
Extrude.
AKA directional grow. Returns a new Box with the a_dir
direction extruded a distance a_dist </code).
a_dir | Direction to extrude in. |
a_dist | (Optional) Distance to extrude (default: 1) |
Example:
Referenced by Proto::FluxBoxData< T, C, MEM, D, E >::define(), and empty().
|
inline |
Extrude (Primitive Version)
AKA directional grow. Returns a new Box with the a_dir
direction extruded a distance a_dist </code). By default, the extrusion is upwards. If
a_upper
is false, extrudes downwards.
a_dir | Axis to extrude along |
a_dist | (Optional) Distance to extrude (default: 1) |
a_upper | (Optional) Extrude upwards? (default: true) |
Example:
|
inline |
|
inline |
|
inline |
Isotropic Coarsen Operation.
Returns a new Box coarsened by a factor of a_numpoints
. Fails if user tries to coarsen using a non-positive ratio. If the limits of *this
are not multiples of the coarsening ratio (e.g. if this-> coarsenable() != true
) the resulting Box is not guaranteed to be a subset of *this
. In this situation, use Box::taperCoarsen
a_ratio | Coarsening ratio |
Example:
Referenced by empty().
Anisotropic Coarsen Operation.
Returns a new Box coarsened in each direction according to a_pt
. Fails if user tries to coarsen using a non-positive ratio. (*this).coarsen(a_pt).refine(a_pt) will always contain *this.
a_pt | Coarsening ratios |
Example:
|
inline |
(Isotropic) Coarsenable Query
Returns true if *this will coarsen normally by a given ratio.
a_ratio | Coarsening ratio |
Referenced by empty().
|
inline |
(Anisotropic) Coarsenable Query
Returns true if *this will coarsen normally by a given ratio.
a_ratio | Coarsening ratio |
Tapered Coarsen.
This function is identical to Box::coarsen when Box::coarsenable() is true. For non-coarsenable Boxes, the new Box's limits are rounded such that the result Is always a subset of *this. Specifically, the lower limits are always rounded UP. This function is used heavily in the automatic computation of domains and ranges for pointwise and Stencil operators, but generally has limited use otherwise.
a_ref | Coarsening ratio |
Referenced by empty().
|
inline |
Isotropic Refine Operation.
Returns a new Box refined in all directions by a_numpoints.
a_ratio | Refinement ratio |
Example:
Edge.
Returns the subset on the boundary of *this in a given direction with specified thickness. Very handy for adjacency and boundary based computations. This function is slightly more general than face(...)
in that it can return regions of all codimensionalities (faces, edges, corners, etc.) The returned Box
is always a subset of *this
a_dir | Direction of desired edge with respect to the cell center of *this |
a_dist | Thickness of the output (default: 1) |
Examples:
Referenced by empty().
|
inline |
|
inline |
Face.
Returns the face (e.g. region of codimension 1) of this box in a specified direction. The output box is always contained in *this. For adjacent faces, use adjacent(...)
. If a_dist >= size(a_dir)
, the rturned box = *this.
a_dir | Coordinate direction in [0, DIM) |
a_side | Side::Lo or Side::Hi |
a_dist | (Optional) Thickness of the output. (default: 1) |
Examples:
Referenced by empty().
|
inline |
Flatten.
Returns a copy of *this with dimension a_dir flattened to a thickness of 1. Useful for creating Boxes of dimensionality less than DIM (e.g. a plane in 3D).
a_dir | Direction to flatten |
a_upper | Flatten upwards? |
Example:
Referenced by empty().
Adjacent Cells.
Returns a box adjacent to *this in a given direction with a thickness a_dist in the normal direction. If there are multiple non-zero entries in a_dir, a_dist will be applied to the thickness in all of those directions
a_dir | "Normal" direction of the desired adjacent cell |
a_dist | (Optional) "thickness" of the desired adjacent cell (default: this->size(a_dir)) |
Examples:
Referenced by empty().
|
inline |
|
inline |
Referenced by adjCellSide(), and empty().
|
inline |
Referenced by adjCellSide(), and empty().
|
inline |
References adjCellHi(), adjCellLo(), begin(), end(), linearIn(), linearOut(), linearSize(), Proto::Side::Lo, print(), rbegin(), recomputeSize(), rend(), and str().
Referenced by faceBox().
|
inline |
Iterator Begin.
See documentation for Proto::BoxIterator for a basic usage example.
Referenced by adjCellSide().
|
inline |
Iterator End.
See documentation for Proto::BoxIterator for a basic usage example.
Referenced by adjCellSide().
|
inline |
Iterator Reverse Begin.
See documentation for Proto::BoxIterator for a basic usage example.
Referenced by adjCellSide().
|
inline |
Iterator Reverse End.
See documentation for Proto::BoxIterator for a basic usage example.
Referenced by adjCellSide().
|
inline |
Linear Size.
Computes the number of bytes needed to store *this in linear buffer.
Referenced by adjCellSide().
|
inline |
|
inline |
|
inline |
|
inline |
Referenced by adjCellSide(), and Proto::operator<<().
|
inline |
Used to reevaluate the size of the box when it is changed.
Referenced by adjCellSide().
int Proto::Box::m_size |
"Volume" of the box.
Referenced by empty().