OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
Box< dim, T > Class Template Reference

This class represent an N-dimensional box. More...

Detailed Description

template<unsigned int dim, typename T>
class Box< dim, T >

This class represent an N-dimensional box.

The box is defined by two points p2 and p1

                     +---------+ p2
                     |         |
                     |         |
                     |         |
                     |         |
                     |         |
                p1   +---------+
Template Parameters
dimdimensionality of the Box
Ttype of space ... double float int size_t

Expand the box with some spacing

float spacing[2] = {0.1,0.1};
Box<2,float> sp({1.0,1.0},{2.0,3.0});
sp.expand(spacing);
BOOST_REQUIRE_CLOSE(sp.getLow(0),1.0,0.0001);
BOOST_REQUIRE_CLOSE(sp.getLow(1),1.0,0.0001);
BOOST_REQUIRE_CLOSE(sp.getHigh(0),2.1,0.0001);
BOOST_REQUIRE_CLOSE(sp.getHigh(1),3.1,0.0001);

Create an enclosing box

Box<3,float> box1({0.1,0.2,0.3},{1.0,1.1,1.3});
Box<3,float> box2({0.5,0.6,0.7},{2.0,2.1,2.2});
box1.enclose(box2);
BOOST_REQUIRE_EQUAL(box1.getLow(0),0.1f);
BOOST_REQUIRE_EQUAL(box1.getLow(1),0.2f);
BOOST_REQUIRE_EQUAL(box1.getLow(2),0.3f);
BOOST_REQUIRE_EQUAL(box1.getHigh(0),2.0f);
BOOST_REQUIRE_EQUAL(box1.getHigh(1),2.1f);
BOOST_REQUIRE_EQUAL(box1.getHigh(2),2.2f);

Create the smallest boxes between several boxes

Box<3,float> box1({0.0,0.0,0.0},{1.0,1.1,1.3});
Box<3,float> box2({0.5,2.0,0.5},{2.0,2.1,2.2});
Box<3,float> box3({1.5,1.5,4.2},{5.0,5.1,5.2});
box1.contained(box2);
box1.contained(box3);
BOOST_REQUIRE_CLOSE(box1.getHigh(0),1.0f,0.0001);
BOOST_REQUIRE_CLOSE(box1.getHigh(1),0.1f,0.0001);
BOOST_REQUIRE_CLOSE(box1.getHigh(2),1.0f,0.0001);

Enlarge the box

Box<3,float> box1({0.1,0.2,0.3},{1.0,1.1,1.3});
Box<3,float> box2({-0.5,-0.6,-0.7},{0.5,0.6,0.7});
box1.enlarge(box2);
BOOST_REQUIRE_CLOSE(box1.getLow(0),-0.4,0.0001);
BOOST_REQUIRE_CLOSE(box1.getLow(1),-0.4,0.0001);
BOOST_REQUIRE_CLOSE(box1.getLow(2),-0.4,0.0001);
BOOST_REQUIRE_CLOSE(box1.getHigh(0),1.5,0.0001);
BOOST_REQUIRE_CLOSE(box1.getHigh(1),1.7,0.0001);
BOOST_REQUIRE_CLOSE(box1.getHigh(2),2.0,0.0001);

Enlarge the box with fixed P1

Box<3,float> box1({0.1,0.2,0.3},{1.0,1.1,1.3});
Box<3,float> box2({-0.5,-0.6,-0.7},{0.5,0.6,0.7});
box1.enlarge_fix_P1(box2);
BOOST_REQUIRE_CLOSE(box1.getLow(0),0.1,0.0001);
BOOST_REQUIRE_CLOSE(box1.getLow(1),0.2,0.0001);
BOOST_REQUIRE_CLOSE(box1.getLow(2),0.3,0.0001);
BOOST_REQUIRE_CLOSE(box1.getHigh(0),2.0,0.0001);
BOOST_REQUIRE_CLOSE(box1.getHigh(1),2.3,0.0001);
BOOST_REQUIRE_CLOSE(box1.getHigh(2),2.7,0.0001);
See Also
SpaceBox

Definition at line 56 of file Box.hpp.

#include <Box.hpp>

+ Inheritance diagram for Box< dim, T >:

Public Types

typedef boost::fusion::vector
< T[dim], T[dim]> 
type
 boost fusion that store the point
 
typedef T btype
 type of the box
 

Public Member Functions

bool Intersect (const Box< dim, T > &b, Box< dim, T > &b_out) const
 Intersect. More...
 
template<typename Mem >
bool Intersect (const encapc< 1, Box< dim, T >, Mem > &e_b, Box< dim, T > &b_out) const
 Intersect. More...
 
template<typename distance >
bool Intersect (Sphere< dim, T > &sphere)
 Check if the sphere intersect the box. More...
 
template<unsigned int b>
getBase (const unsigned int i) const
 Get the coordinate of the bounding point. More...
 
Box< dim-1, T > getSubBox ()
 Get the the box of dimensionality dim-1 (it eliminate the last dimension) More...
 
Box< dim, T > & operator= (const Box< dim, T > &box)
 Operator= between boxes. More...
 
 Box ()
 default constructor
 
 Box (const Point< dim, T > &p1, const Point< dim, T > &p2)
 Constructor from two points. More...
 
 Box (std::initializer_list< T > p1, std::initializer_list< T > p2)
 Constructor from initializer list. More...
 
 Box (T *low, T *high)
 Box constructor from a box. More...
 
 Box (const Box< dim, T > &box)
 Box constructor from a box. More...
 
 Box (type box_data)
 Box constructor from vector::fusion. More...
 
 Box (T(&box_data)[dim])
 Box constructor from an array reference. More...
 
 Box (const grid_key_dx< dim > &key1, const grid_key_dx< dim > &key2)
 constructor from 2 grid_key_dx More...
 
template<unsigned int dimS>
 Box (boost::fusion::vector< T[dimS], T[dimS]> &box_data)
 Box constructor from vector::fusion of higher dimension. More...
 
template<typename Mem >
 Box (const encapc< 1, Box< dim, T >, Mem > &b)
 Box constructor from encapsulated box. More...
 
template<typename S >
 Box (const Box< dim, S > &b)
 constructor from a Box of different type More...
 
Box< dim, T > & operator/= (const Point< dim, T > &p)
 Divide component wise each box points with a point. More...
 
Box< dim, T > operator* (const Point< dim, T > &p)
 Multiply component wise each box points with a point. More...
 
void set (std::initializer_list< T > p1, std::initializer_list< T > p2)
 Constructor from initializer list. More...
 
void setLow (int i, T val)
 set the low interval of the box More...
 
void setHigh (int i, T val)
 set the high interval of the box More...
 
getLow (int i) const
 get the i-coordinate of the low bound interval of the box More...
 
getHigh (int i) const
 get the high interval of the box More...
 
void setP1 (const grid_key_dx< dim > &p1)
 Set the point P1 of the box. More...
 
void setP2 (const grid_key_dx< dim > &p2)
 Set the point P2 of the box. More...
 
void setP1 (const Point< dim, T > &p1)
 Set the point P1 of the box. More...
 
void setP2 (const Point< dim, T > &p2)
 Set the point P2 of the box. More...
 
Box< dim, T > & getBox ()
 Get the box enclosing this Box. More...
 
const Box< dim, T > & getBox () const
 Get the box enclosing this Box. More...
 
typegetVector ()
 Get the internal boost::fusion::vector that store the data. More...
 
grid_key_dx< dim > getKP1 () const
 Get the point p1 as grid_key_dx. More...
 
grid_key_dx< dim > getKP2 () const
 Get the point p12 as grid_key_dx. More...
 
Point< dim, T > getP1 () const
 Get the point p1. More...
 
Point< dim, T > getP2 () const
 Get the point p2. More...
 
Box< dim, T > & operator-= (const Point< dim, T > &p)
 Translate the box. More...
 
Box< dim, T > & operator+= (const Point< dim, T > &p)
 Translate the box. More...
 
void expand (T(&exp)[dim])
 expand the box by a vector More...
 
void enlarge (const Box< dim, T > &gh)
 Enlarge the box with ghost margin. More...
 
template<typename S >
void enlarge_fix_P1 (Box< dim, S > &gh)
 Enlarge the box with ghost margin keeping fix the point P1. More...
 
void invalidate ()
 Invalidate the box. More...
 
void magnify (T mg)
 Magnify the box. More...
 
void magnify_fix_P1 (T mg)
 Magnify the box by a factor keeping fix the point P1. More...
 
void shrinkP2 (T sh)
 Shrink moving p2 of sh quantity (on each direction) More...
 
void enclose (const Box< dim, T > &en)
 Refine the box to enclose the given box and itself. More...
 
void contained (const Box< dim, T > &en, const bool reset_p1=true)
 Refine the box to be contained in the given box and itself. More...
 
void zero ()
 Set p1 and p2 to 0. More...
 
bool isContained (const Box< dim, T > &b) const
 Check if the box is contained. More...
 
bool isInside (const Point< dim, T > &p) const
 Check if the point is inside the box. More...
 
bool isInsideNP (const Point< dim, T > &p) const
 Check if the point is inside the region excluding the positive part. More...
 
bool isInsideNB (const Point< dim, T > &p) const
 Check if the point is inside the region excluding the borders. More...
 
bool isInside (const T(&p)[dim]) const
 Check if the point is inside the region. More...
 
bool isValid () const
 Check if the Box is a valid box P2 >= P1. More...
 
bool isValidN () const
 Check if the Box is a valid box P2 > P1. More...
 
void floorP1 ()
 Apply the ceil operation to the point P1. More...
 
void floorP2 ()
 Apply the ceil operation to the point P2. More...
 
void ceilP1 ()
 Apply the ceil operation to the point P1. More...
 
void ceilP2 ()
 Apply the ceil operation to the point P2. More...
 
void shrinkP2 (const Point< dim, T > &p)
 Shrink the point P2 by one vector. More...
 
void swap (Box< dim, T > &b)
 exchange the data of two boxes More...
 
template<typename Mem >
bool isInside (const encapc< 1, Point< dim, T >, Mem > &p)
 Check if the point is inside the region. More...
 
getVolume () const
 Get the volume of the box. More...
 
getVolumeKey () const
 Get the volume spanned by the Box P1 and P2 interpreted as grid key. More...
 
Point< dim, T > middle () const
 Return the middle point of the box. More...
 
std::string toString () const
 Produce a string from the object. More...
 
bool operator== (const Box< dim, T > &b) const
 Compare two boxes. More...
 
bool operator!= (const Box< dim, T > &b) const
 Compare two boxes. More...
 

Static Public Member Functions

static T getVolumeKey (const T(&p1)[dim], const T(&p2)[dim])
 Get the volume spanned by the Box as grid_key_dx_iterator_sub. More...
 
static bool noPointers ()
 This structure has no internal pointers.
 

Data Fields

type data
 It store the two point bounding the box.
 

Static Public Attributes

static const unsigned int p1 = 0
 Low point.
 
static const unsigned int p2 = 1
 High point.
 
static const unsigned int max_prop = 2
 Maximum number of properties.
 
static const unsigned int dims = dim
 dimensionality of the box
 

Constructor & Destructor Documentation

template<unsigned int dim, typename T>
Box< dim, T >::Box ( const Point< dim, T > &  p1,
const Point< dim, T > &  p2 
)
inline

Constructor from two points.

Parameters
p1Low point, initialize as a list example {0.0,0.0,0.0}
p2High point, initialized as a list example {1.0,1.0,1.0}

Definition at line 239 of file Box.hpp.

template<unsigned int dim, typename T>
Box< dim, T >::Box ( std::initializer_list< T >  p1,
std::initializer_list< T >  p2 
)
inline

Constructor from initializer list.

Parameters
p1Low point, initialize as a list example {0.0,0.0,0.0}
p2High point, initialized as a list example {1.0,1.0,1.0}

Definition at line 251 of file Box.hpp.

template<unsigned int dim, typename T>
Box< dim, T >::Box ( T *  low,
T *  high 
)
inline

Box constructor from a box.

Parameters
higharray indicating the coordinates of the low point
lowarray indicating the coordinates of the high point

Definition at line 262 of file Box.hpp.

template<unsigned int dim, typename T>
Box< dim, T >::Box ( const Box< dim, T > &  box)
inline

Box constructor from a box.

Parameters
boxfrom which to construct

Definition at line 280 of file Box.hpp.

template<unsigned int dim, typename T>
Box< dim, T >::Box ( type  box_data)
inline

Box constructor from vector::fusion.

Parameters
box_datafrom which to construct

Definition at line 296 of file Box.hpp.

template<unsigned int dim, typename T>
Box< dim, T >::Box ( T(&)  box_data[dim])
inline

Box constructor from an array reference.

Parameters
box_dataarray from which to construct the box

Definition at line 312 of file Box.hpp.

template<unsigned int dim, typename T>
Box< dim, T >::Box ( const grid_key_dx< dim > &  key1,
const grid_key_dx< dim > &  key2 
)
inline

constructor from 2 grid_key_dx

Parameters
key1start point
key2stop point

Definition at line 329 of file Box.hpp.

template<unsigned int dim, typename T>
template<unsigned int dimS>
Box< dim, T >::Box ( boost::fusion::vector< T[dimS], T[dimS]> &  box_data)
inline

Box constructor from vector::fusion of higher dimension.

Parameters
box_datafusion vector from which to construct the vector

Definition at line 343 of file Box.hpp.

template<unsigned int dim, typename T>
template<typename Mem >
Box< dim, T >::Box ( const encapc< 1, Box< dim, T >, Mem > &  b)
inline

Box constructor from encapsulated box.

Parameters
bbox from which to construct the vector (encapsulated)

Definition at line 359 of file Box.hpp.

template<unsigned int dim, typename T>
template<typename S >
Box< dim, T >::Box ( const Box< dim, S > &  b)
inline

constructor from a Box of different type

Parameters
bbox

Definition at line 375 of file Box.hpp.

Member Function Documentation

template<unsigned int dim, typename T>
void Box< dim, T >::ceilP1 ( )
inline

Apply the ceil operation to the point P1.

Definition at line 1052 of file Box.hpp.

template<unsigned int dim, typename T>
void Box< dim, T >::ceilP2 ( )
inline

Apply the ceil operation to the point P2.

Definition at line 1064 of file Box.hpp.

template<unsigned int dim, typename T>
void Box< dim, T >::contained ( const Box< dim, T > &  en,
const bool  reset_p1 = true 
)
inline

Refine the box to be contained in the given box and itself.

All the boxes are considered centered at p1, so it only count its relative size

Parameters
enBox to be contained
reset_p1if true set p1 to 0

Definition at line 832 of file Box.hpp.

template<unsigned int dim, typename T>
void Box< dim, T >::enclose ( const Box< dim, T > &  en)
inline

Refine the box to enclose the given box and itself.

Parameters
enBox to enclose

Definition at line 812 of file Box.hpp.

template<unsigned int dim, typename T>
void Box< dim, T >::enlarge ( const Box< dim, T > &  gh)
inline

Enlarge the box with ghost margin.

Parameters
ghspacing of the margin to enlarge
                      ^ gh.p2[1]
                      |
                      |
                 +----+----+
                 |         |
                 |         |
   gh.p1[0]<-----+         +----> gh.p2[0]
                 |         |
                 |         |
                 +----+----+
                      |
                      v  gh.p1[1]

Definition at line 700 of file Box.hpp.

template<unsigned int dim, typename T>
template<typename S >
void Box< dim, T >::enlarge_fix_P1 ( Box< dim, S > &  gh)
inline

Enlarge the box with ghost margin keeping fix the point P1.

Parameters
ghspacing of the margin to enlarge
                      ^ gh.p2[1]
                      |
                      |
                 +----+----+
                 |         |
                 |         |
   gh.p1[0]<-----+         +----> gh.p2[0]
                 |         |
                 |         |
                 +----+----+
                      |
                      v  gh.p1[1]

Definition at line 733 of file Box.hpp.

template<unsigned int dim, typename T>
void Box< dim, T >::expand ( T(&)  exp[dim])
inline

expand the box by a vector

only P2 is expanded

Parameters
expexpand vector

Definition at line 670 of file Box.hpp.

template<unsigned int dim, typename T>
void Box< dim, T >::floorP1 ( )
inline

Apply the ceil operation to the point P1.

Definition at line 1028 of file Box.hpp.

template<unsigned int dim, typename T>
void Box< dim, T >::floorP2 ( )
inline

Apply the ceil operation to the point P2.

Definition at line 1040 of file Box.hpp.

template<unsigned int dim, typename T>
template<unsigned int b>
T Box< dim, T >::getBase ( const unsigned int  i) const
inline

Get the coordinate of the bounding point.

Template Parameters
binteger define (lower or upper interval)
Parameters
ii-coordinate of the point
Returns
the i-coordinate of the bounding point

Definition at line 190 of file Box.hpp.

template<unsigned int dim, typename T>
Box<dim,T>& Box< dim, T >::getBox ( )
inline

Get the box enclosing this Box.

basically return itself

Returns
itself

Definition at line 546 of file Box.hpp.

template<unsigned int dim, typename T>
const Box<dim,T>& Box< dim, T >::getBox ( ) const
inline

Get the box enclosing this Box.

basically return itself

Returns
itself

Definition at line 558 of file Box.hpp.

template<unsigned int dim, typename T>
T Box< dim, T >::getHigh ( int  i) const
inline

get the high interval of the box

Parameters
idimension
Returns
i coordinate of the high interval

Definition at line 490 of file Box.hpp.

template<unsigned int dim, typename T>
grid_key_dx<dim> Box< dim, T >::getKP1 ( ) const
inline

Get the point p1 as grid_key_dx.

Returns
the key

Definition at line 579 of file Box.hpp.

template<unsigned int dim, typename T>
grid_key_dx<dim> Box< dim, T >::getKP2 ( ) const
inline

Get the point p12 as grid_key_dx.

Returns
the key

Definition at line 592 of file Box.hpp.

template<unsigned int dim, typename T>
T Box< dim, T >::getLow ( int  i) const
inline

get the i-coordinate of the low bound interval of the box

Parameters
idimension
Returns
i-coordinate

Definition at line 479 of file Box.hpp.

template<unsigned int dim, typename T>
Point<dim,T> Box< dim, T >::getP1 ( ) const
inline

Get the point p1.

Returns
the point p1

Definition at line 605 of file Box.hpp.

template<unsigned int dim, typename T>
Point<dim,T> Box< dim, T >::getP2 ( ) const
inline

Get the point p2.

Returns
the point p2

Definition at line 619 of file Box.hpp.

template<unsigned int dim, typename T>
Box<dim-1,T> Box< dim, T >::getSubBox ( )
inline

Get the the box of dimensionality dim-1 (it eliminate the last dimension)

Returns
Return the sub-box of dimension dim-1

Definition at line 201 of file Box.hpp.

template<unsigned int dim, typename T>
type& Box< dim, T >::getVector ( )
inline

Get the internal boost::fusion::vector that store the data.

Returns
the internal boost::fusion::vector that store the data

Definition at line 569 of file Box.hpp.

template<unsigned int dim, typename T>
T Box< dim, T >::getVolume ( ) const
inline

Get the volume of the box.

Returns
the box volume

Definition at line 1139 of file Box.hpp.

template<unsigned int dim, typename T>
T Box< dim, T >::getVolumeKey ( ) const
inline

Get the volume spanned by the Box P1 and P2 interpreted as grid key.

Returns
The volume

Definition at line 1154 of file Box.hpp.

template<unsigned int dim, typename T>
static T Box< dim, T >::getVolumeKey ( const T(&)  p1[dim],
const T(&)  p2[dim] 
)
inlinestatic

Get the volume spanned by the Box as grid_key_dx_iterator_sub.

Warning
Careful it is not the simple volume calculation there is a +1 on each dimension, consider the case of a subgrid iterator with P1 = {5,7} ; P2 = {5,7}, the sub-grid iterator has one point {5,7}, that mean Volume=1, so the volume formula is (5 - 5 + 1) * (7 - 7 + 1)
Parameters
p1point p1
p2point p2
Returns
The volume

Definition at line 1176 of file Box.hpp.

template<unsigned int dim, typename T>
bool Box< dim, T >::Intersect ( const Box< dim, T > &  b,
Box< dim, T > &  b_out 
) const
inline

Intersect.

Intersect two boxes and return the result boxes, if the boxes does not intersect, return false

Parameters
bbox to intersect with
b_outbox result of the intersection
Returns
true if they intersect

Definition at line 88 of file Box.hpp.

template<unsigned int dim, typename T>
template<typename Mem >
bool Box< dim, T >::Intersect ( const encapc< 1, Box< dim, T >, Mem > &  e_b,
Box< dim, T > &  b_out 
) const
inline

Intersect.

Intersect two boxes and return the result boxes, if the boxes does not intersect, return false

Parameters
e_bencapsulator box to intersect with
b_outbox result of the intersection
Returns
true if they intersect

Definition at line 121 of file Box.hpp.

template<unsigned int dim, typename T>
template<typename distance >
bool Box< dim, T >::Intersect ( Sphere< dim, T > &  sphere)
inline

Check if the sphere intersect the box.

p1 _____ | | p. | | |____| p2

Given a point p and we search for the distance of the nearest point of the box from p. In this case the distance is p1.x-p0.x the Y dimension is alligned with p In general for each dimension we check if the point is in the interval if it is we do not accumulate, otherwise we accumulate the smallest between (p1-p0) (p2-p0).

if the distance of the nearest point is smaller than the radius we have an intersection

Template Parameters
distancefunctor
Parameters
sphereto check the intersection
Returns
true if intersect false otherwise

Definition at line 152 of file Box.hpp.

template<unsigned int dim, typename T>
void Box< dim, T >::invalidate ( )
inline

Invalidate the box.

Bring the state of this box in a way that isValid return false

Definition at line 748 of file Box.hpp.

template<unsigned int dim, typename T>
bool Box< dim, T >::isContained ( const Box< dim, T > &  b) const
inline

Check if the box is contained.

Parameters
bBox
Returns
true if the box is contained

Definition at line 863 of file Box.hpp.

template<unsigned int dim, typename T>
bool Box< dim, T >::isInside ( const Point< dim, T > &  p) const
inline

Check if the point is inside the box.

Parameters
ppoint to check
Returns
true if the point is inside the space

Definition at line 880 of file Box.hpp.

template<unsigned int dim, typename T>
bool Box< dim, T >::isInside ( const T(&)  p[dim]) const
inline

Check if the point is inside the region.

Parameters
ppoint to check
Returns
true if the point is inside the space

Definition at line 969 of file Box.hpp.

template<unsigned int dim, typename T>
template<typename Mem >
bool Box< dim, T >::isInside ( const encapc< 1, Point< dim, T >, Mem > &  p)
inline

Check if the point is inside the region.

Parameters
ppoint to check
Returns
true if the point is inside the space

Definition at line 1112 of file Box.hpp.

template<unsigned int dim, typename T>
bool Box< dim, T >::isInsideNB ( const Point< dim, T > &  p) const
inline

Check if the point is inside the region excluding the borders.

Parameters
ppoint to check
Returns
true if the point is inside the space

Definition at line 940 of file Box.hpp.

template<unsigned int dim, typename T>
bool Box< dim, T >::isInsideNP ( const Point< dim, T > &  p) const
inline

Check if the point is inside the region excluding the positive part.

In periodic boundary conditions the positive border is not included, but match the beginning

Parameters
ppoint to check
Returns
true if the point is inside the space

Definition at line 910 of file Box.hpp.

template<unsigned int dim, typename T>
bool Box< dim, T >::isValid ( ) const
inline

Check if the Box is a valid box P2 >= P1.

Returns
true if it is valid

Definition at line 997 of file Box.hpp.

template<unsigned int dim, typename T>
bool Box< dim, T >::isValidN ( ) const
inline

Check if the Box is a valid box P2 > P1.

Returns
true if it is valid

Definition at line 1013 of file Box.hpp.

template<unsigned int dim, typename T>
void Box< dim, T >::magnify ( mg)
inline

Magnify the box.

For example 1.001 enlarge the box of 0.1% on each direction

Warning
P1 is mooved if not zero
Parameters
mgMagnification factor

Definition at line 766 of file Box.hpp.

template<unsigned int dim, typename T>
void Box< dim, T >::magnify_fix_P1 ( mg)
inline

Magnify the box by a factor keeping fix the point P1.

For example 1.001 enlarge the box of 0.1% on each direction

Parameters
mgMagnification factor

Definition at line 784 of file Box.hpp.

template<unsigned int dim, typename T>
Point<dim,T> Box< dim, T >::middle ( ) const
inline

Return the middle point of the box.

Returns
the middle point of the box

Definition at line 1197 of file Box.hpp.

template<unsigned int dim, typename T>
bool Box< dim, T >::operator!= ( const Box< dim, T > &  b) const
inline

Compare two boxes.

Parameters
b
Returns
true if the boxes are equal

Definition at line 1256 of file Box.hpp.

template<unsigned int dim, typename T>
Box<dim,T> Box< dim, T >::operator* ( const Point< dim, T > &  p)
inline

Multiply component wise each box points with a point.

Parameters
ppoint
Returns
the result box

Definition at line 408 of file Box.hpp.

template<unsigned int dim, typename T>
Box<dim,T>& Box< dim, T >::operator+= ( const Point< dim, T > &  p)
inline

Translate the box.

Parameters
pPoint translation vector
Returns
itself

Definition at line 652 of file Box.hpp.

template<unsigned int dim, typename T>
Box<dim,T>& Box< dim, T >::operator-= ( const Point< dim, T > &  p)
inline

Translate the box.

Parameters
pPoint translation vector
Returns
itself

Definition at line 634 of file Box.hpp.

template<unsigned int dim, typename T>
Box<dim,T>& Box< dim, T >::operator/= ( const Point< dim, T > &  p)
inline

Divide component wise each box points with a point.

Parameters
ppoint
Returns
itself

Definition at line 391 of file Box.hpp.

template<unsigned int dim, typename T>
Box<dim,T>& Box< dim, T >::operator= ( const Box< dim, T > &  box)
inline

Operator= between boxes.

Operator= between boxes of the same size

Parameters
boxis the box that store the interval
Returns
itself

Definition at line 215 of file Box.hpp.

template<unsigned int dim, typename T>
bool Box< dim, T >::operator== ( const Box< dim, T > &  b) const
inline

Compare two boxes.

Parameters
b
Returns
true if the boxes are equal

Definition at line 1234 of file Box.hpp.

template<unsigned int dim, typename T>
void Box< dim, T >::set ( std::initializer_list< T >  p1,
std::initializer_list< T >  p2 
)
inline

Constructor from initializer list.

Constructor from initializer list

Parameters
p1Low point, initialize as a list example {0.0,0.0,0.0}
p2High point, initialized as a list example {1.0,1.0,1.0}

Definition at line 429 of file Box.hpp.

template<unsigned int dim, typename T>
void Box< dim, T >::setHigh ( int  i,
val 
)
inline

set the high interval of the box

Parameters
idimension
valvalue to set

Definition at line 467 of file Box.hpp.

template<unsigned int dim, typename T>
void Box< dim, T >::setLow ( int  i,
val 
)
inline

set the low interval of the box

Parameters
idimension
valvalue to set

Definition at line 456 of file Box.hpp.

template<unsigned int dim, typename T>
void Box< dim, T >::setP1 ( const grid_key_dx< dim > &  p1)
inline

Set the point P1 of the box.

Parameters
p1point

Definition at line 500 of file Box.hpp.

template<unsigned int dim, typename T>
void Box< dim, T >::setP1 ( const Point< dim, T > &  p1)
inline

Set the point P1 of the box.

Parameters
p1point

Definition at line 522 of file Box.hpp.

template<unsigned int dim, typename T>
void Box< dim, T >::setP2 ( const grid_key_dx< dim > &  p2)
inline

Set the point P2 of the box.

Parameters
p2point

Definition at line 511 of file Box.hpp.

template<unsigned int dim, typename T>
void Box< dim, T >::setP2 ( const Point< dim, T > &  p2)
inline

Set the point P2 of the box.

Parameters
p2point

Definition at line 533 of file Box.hpp.

template<unsigned int dim, typename T>
void Box< dim, T >::shrinkP2 ( sh)
inline

Shrink moving p2 of sh quantity (on each direction)

Parameters
sh

Definition at line 799 of file Box.hpp.

template<unsigned int dim, typename T>
void Box< dim, T >::shrinkP2 ( const Point< dim, T > &  p)
inline

Shrink the point P2 by one vector.

Parameters
pvector

Definition at line 1077 of file Box.hpp.

template<unsigned int dim, typename T>
void Box< dim, T >::swap ( Box< dim, T > &  b)
inline

exchange the data of two boxes

Parameters
bbox to switch

Definition at line 1090 of file Box.hpp.

template<unsigned int dim, typename T>
std::string Box< dim, T >::toString ( ) const
inline

Produce a string from the object.

Returns
string

Definition at line 1212 of file Box.hpp.

template<unsigned int dim, typename T>
void Box< dim, T >::zero ( )
inline

Set p1 and p2 to 0.

Definition at line 847 of file Box.hpp.


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