WARPXM v1.10.0
Loading...
Searching...
No Matches
WxBox< TYPE > Class Template Reference

WxBox represents a n-dimensional box of elements specified by lower coordinates and upper coordinates. More...

#include <wxbox.h>

Inheritance diagram for WxBox< TYPE >:
WxObject

Detailed Description

template<typename TYPE>
class WxBox< TYPE >

WxBox represents a n-dimensional box of elements specified by lower coordinates and upper coordinates.

Public Member Functions

 WxBox ()
 
 WxBox (unsigned ndims)
 Create a 'ndims' dimensional box.
 
 WxBox (unsigned ndims, const TYPE *lower, const TYPE *upper)
 Constucts a box with given 'lower' and 'upper' bounds.
 
 WxBox (unsigned ndims, const TYPE *length)
 Constucts a box given lengths of each side.
 
 WxBox (TYPE s1, TYPE e1)
 The following constructors constuct a box with explicit passing of lower s* and upper e* coordinates.
 
 WxBox (TYPE s1, TYPE e1, TYPE s2, TYPE e2)
 Rank-2 ctor.
 
 WxBox (TYPE s1, TYPE e1, TYPE s2, TYPE e2, TYPE s3, TYPE e3)
 Rank-3 ctor.
 
 WxBox (TYPE s1, TYPE e1, TYPE s2, TYPE e2, TYPE s3, TYPE e3, TYPE s4, TYPE e4)
 Rank-4 ctor.
 
 WxBox (const WxBox< TYPE > &b)
 Copy constructor and assignment operators.
 
WxBoxoperator= (const WxBox< TYPE > &b)
 
virtual ~WxBox ()
 
virtual void setup (const WxCryptSet &wxc)
 Constructs a box specified in a cryptset.
 
void resize (const unsigned dim, const TYPE newLength)
 Modify upper indicex based on newly supplied length.
 
unsigned ndims () const
 Dimensionality of box.
 
TYPE lower (unsigned dim) const
 Lower bound along dimension 'dim'.
 
void lower (unsigned dim, TYPE low)
 Set lower bound along dimension 'dim'.
 
TYPE upper (unsigned dim) const
 Upper bound along dimension 'dim'.
 
void upper (unsigned dim, TYPE upp)
 Set upper bound along dimension 'dim'.
 
std::pair< TYPE, TYPE > boundsPair (unsigned dim) const
 Pair of upper and lower bound along dimension 'dim'.
 
virtual bool isEmpty () const
 Determine if box is empty.
 
virtual TYPE length (unsigned dim) const
 Length of edge along dimension 'dim'.
 
TYPE area () const
 Area of box.
 
TYPE size () const
 Area of box.
 
std::string coordinateString () const
 String of box coordinates.
 
WxBox< TYPE > intersect (const WxBox< TYPE > &box) const
 Computes intersection of this box with supplied box.
 
WxBox< TYPE > extend (const TYPE low[], const TYPE upp[]) const
 Returns a box which is extended by the given amount along each side in each dimension.
 
WxBox< TYPE > extend (const TYPE uniformPad[]) const
 Returns a box which is extended by the given amount along both sides in each dimension.
 
WxBox< TYPE > extend (TYPE uniformPad) const
 Returns a box which is extended by the given amount along both sides in every dimension.
 
WxBox< TYPE > extDim (TYPE low, TYPE upp) const
 Returns a new box which has one greater dimension than this one.
 
void extrude (const WxBox &box)
 Increases the rank of this box to match that of the supplied box argument.
 
WxBox< TYPE > reduceDim (unsigned int newDim) const
 Returns a new box which has up to new number of dimensions.
 
bool operator== (const WxBox< TYPE > &b) const
 Check if this box is equal to one supplied.
 
bool contains (const TYPE coord[]) const
 Check if the box contains the given point.
 
bool encloses (const WxBox< TYPE > &candidateBox) const
 Check if the box encloses the given box.
 
bool compareShape (const WxBox< TYPE > &candidateBox) const
 Check if all side lengths of the supplied box match this one.
 
- Public Member Functions inherited from WxObject
virtual ~WxObject ()
 Dtor: destroy object.
 
void setIo (WxIoBase &io)
 Set the I/O pointer for use in object.
 
void setMsg (WxMsgBase &msg)
 Set the msg pointer for use in object.
 
WxIoBasegetIo ()
 Return reference to I/O object.
 
const WxIoBasegetIo () const
 Return constant reference to I/O object.
 
WxMsgBasegetMsg ()
 Return reference to msg object.
 
const WxMsgBasegetMsg () const
 Return const reference to msg object.
 
virtual void setup (const WxCryptSet &wxc)
 Setup object using supplied crypset.
 
virtual void init ()
 Initialize the object.
 
virtual void finishBuild ()
 Finish building the object.
 
virtual void load (WxIoBase &io, const WxIoNodeType &grpNode)
 Load object from file.
 
virtual void dump (WxIoBase &io, WxIoNodeType &grpNode) const
 Dump object to file.
 
virtual std::string name () const
 Get name of object.
 
void setName (const std::string &nm)
 Set object's name.
 

Static Public Attributes

static const int max_dims = 8
 Maximum rank box that can be represented.
 

Protected Attributes

unsigned _ndims
 
TYPE _lower [max_dims]
 
TYPE _upper [max_dims]
 
TYPE _length [max_dims]
 

Additional Inherited Members

- Protected Member Functions inherited from WxObject
 WxObject ()
 Create object, that will be initialized subsequently.
 
 WxObject (const std::string &name)
 Create object with given name bypassing object setup phase Protected because there is no reason to have a WxObject directly, as it is meant to be a parent class.
 

Constructor & Destructor Documentation

◆ WxBox() [1/9]

template<typename TYPE >
WxBox< TYPE >::WxBox ( )
inline

◆ WxBox() [2/9]

template<typename TYPE >
WxBox< TYPE >::WxBox ( unsigned  ndims)

Create a 'ndims' dimensional box.

◆ WxBox() [3/9]

template<typename TYPE >
WxBox< TYPE >::WxBox ( unsigned  ndims,
const TYPE *  lower,
const TYPE *  upper 
)

Constucts a box with given 'lower' and 'upper' bounds.

Parameters
ndimsDimensionality of the box
lowerArray of lower corner coordinates
upperArray of upper corner coordinates

◆ WxBox() [4/9]

template<typename TYPE >
WxBox< TYPE >::WxBox ( unsigned  ndims,
const TYPE *  length 
)

Constucts a box given lengths of each side.

All lower[] values will be 0.

Parameters
ndimsDimensionality of the box
lengthArray of upper corner coordinates

◆ WxBox() [5/9]

template<typename TYPE >
WxBox< TYPE >::WxBox ( TYPE  s1,
TYPE  e1 
)

The following constructors constuct a box with explicit passing of lower s* and upper e* coordinates.

Rank-1 ctor

◆ WxBox() [6/9]

template<typename TYPE >
WxBox< TYPE >::WxBox ( TYPE  s1,
TYPE  e1,
TYPE  s2,
TYPE  e2 
)

Rank-2 ctor.

◆ WxBox() [7/9]

template<typename TYPE >
WxBox< TYPE >::WxBox ( TYPE  s1,
TYPE  e1,
TYPE  s2,
TYPE  e2,
TYPE  s3,
TYPE  e3 
)

Rank-3 ctor.

◆ WxBox() [8/9]

template<typename TYPE >
WxBox< TYPE >::WxBox ( TYPE  s1,
TYPE  e1,
TYPE  s2,
TYPE  e2,
TYPE  s3,
TYPE  e3,
TYPE  s4,
TYPE  e4 
)

Rank-4 ctor.

◆ WxBox() [9/9]

template<typename TYPE >
WxBox< TYPE >::WxBox ( const WxBox< TYPE > &  b)

Copy constructor and assignment operators.

◆ ~WxBox()

template<typename TYPE >
virtual WxBox< TYPE >::~WxBox ( )
virtual

Member Function Documentation

◆ area()

template<typename TYPE >
TYPE WxBox< TYPE >::area ( ) const

Area of box.

Returns
area of box

◆ boundsPair()

template<typename TYPE >
std::pair< TYPE, TYPE > WxBox< TYPE >::boundsPair ( unsigned  dim) const
inline

Pair of upper and lower bound along dimension 'dim'.

Parameters
dimDirection
Returns
Pair of (lower, upper) bounds along dimension dim

◆ compareShape()

template<typename TYPE >
bool WxBox< TYPE >::compareShape ( const WxBox< TYPE > &  candidateBox) const

Check if all side lengths of the supplied box match this one.

Parameters
candidateBoxBox to check
Returns
true if box shape is the same as candidateBox, false otherwise

◆ contains()

template<typename TYPE >
bool WxBox< TYPE >::contains ( const TYPE  coord[]) const

Check if the box contains the given point.

Points lying on box edges are considered contained.

Parameters
coordPoint to check
Returns
true if box contains this point, false otherwise

◆ coordinateString()

template<typename TYPE >
std::string WxBox< TYPE >::coordinateString ( ) const

String of box coordinates.

Returns
string containing box coordinates

◆ encloses()

template<typename TYPE >
bool WxBox< TYPE >::encloses ( const WxBox< TYPE > &  candidateBox) const

Check if the box encloses the given box.

Overlapping edges are considered contained.

Parameters
candidateBoxBox to check
Returns
true if box encloses this candidateBox, false otherwise

◆ extDim()

template<typename TYPE >
WxBox< TYPE > WxBox< TYPE >::extDim ( TYPE  low,
TYPE  upp 
) const

Returns a new box which has one greater dimension than this one.

Parameters
lowlower coordinate for new dimension
uppupper coordinate for new dimension
Returns
box of one higher dimension. This box has the new dimension as its highest one.

◆ extend() [1/3]

template<typename TYPE >
WxBox< TYPE > WxBox< TYPE >::extend ( const TYPE  low[],
const TYPE  upp[] 
) const

Returns a box which is extended by the given amount along each side in each dimension.

Parameters
lowextend region along lower edge in direction dim is low[dim]
uppextend region along upper edge in direction dim is upp[dim]
Returns
extended box

◆ extend() [2/3]

template<typename TYPE >
WxBox< TYPE > WxBox< TYPE >::extend ( const TYPE  uniformPad[]) const

Returns a box which is extended by the given amount along both sides in each dimension.

Parameters
uniformPadextend region along both edges in direction dim is ng[dim]
Returns
extended box

◆ extend() [3/3]

template<typename TYPE >
WxBox< TYPE > WxBox< TYPE >::extend ( TYPE  uniformPad) const

Returns a box which is extended by the given amount along both sides in every dimension.

Parameters
uniformPadextend region along both edges in every dimension by same amount
Returns
extended box

◆ extrude()

template<typename TYPE >
void WxBox< TYPE >::extrude ( const WxBox< TYPE > &  box)

Increases the rank of this box to match that of the supplied box argument.

Positions of the new dimensions' corners match that of the supplied box argument. If supplied box argument has lower or equal rank as this box, nothing is modified.

Parameters
boxtemplate box to use for extrusion.

◆ intersect()

template<typename TYPE >
WxBox< TYPE > WxBox< TYPE >::intersect ( const WxBox< TYPE > &  box) const

Computes intersection of this box with supplied box.

Parameters
boxto intersect with
Returns
intersection box. If box ranks do not match, an empty rank 0 box is returned.

◆ isEmpty()

template<typename TYPE >
virtual bool WxBox< TYPE >::isEmpty ( ) const
virtual

Determine if box is empty.

Returns
true of box is empty, false otherwise

Reimplemented in WxRange.

◆ length()

template<typename TYPE >
virtual TYPE WxBox< TYPE >::length ( unsigned  dim) const
inlinevirtual

Length of edge along dimension 'dim'.

Parameters
dimDirection
Returns
Length of side along dimension dim

Reimplemented in WxRange.

◆ lower() [1/2]

template<typename TYPE >
TYPE WxBox< TYPE >::lower ( unsigned  dim) const
inline

Lower bound along dimension 'dim'.

Parameters
dimDirection
Returns
lower bound along dimension dim

◆ lower() [2/2]

template<typename TYPE >
void WxBox< TYPE >::lower ( unsigned  dim,
TYPE  low 
)
inline

Set lower bound along dimension 'dim'.

Parameters
dimDirection
Returns
lower bound along dimension dim

◆ ndims()

template<typename TYPE >
unsigned WxBox< TYPE >::ndims ( ) const
inline

Dimensionality of box.

Returns
dimensionality of box

◆ operator=()

template<typename TYPE >
WxBox & WxBox< TYPE >::operator= ( const WxBox< TYPE > &  b)

◆ operator==()

template<typename TYPE >
bool WxBox< TYPE >::operator== ( const WxBox< TYPE > &  b) const

Check if this box is equal to one supplied.

Parameters
bBox to compare with
Returns
true if the boxes are same, or false otherwise

◆ reduceDim()

template<typename TYPE >
WxBox< TYPE > WxBox< TYPE >::reduceDim ( unsigned int  newDim) const

Returns a new box which has up to new number of dimensions.

This box is projected into the lower dimensional box. Projection maintains the lower dimension shape of this box

Parameters
newDimrequested new dimensionality of the projection
Returns
box of lower or equal dimension.

◆ resize()

template<typename TYPE >
void WxBox< TYPE >::resize ( const unsigned  dim,
const TYPE  newLength 
)

Modify upper indicex based on newly supplied length.

Number of dimensions remains the same. Lower coordinate remain the same.

Parameters
dimensionto modify
newlength to adjust box upper limit to.

◆ setup()

template<typename TYPE >
virtual void WxBox< TYPE >::setup ( const WxCryptSet wxc)
virtual

Constructs a box specified in a cryptset.

The cryptset should have variables

Lower = [dim0Low, dim1Low, ...] Upper = [dim0Upper, dim1Upper, ...]

Lower and Upper vectors must have same length that establishes the number of box dimensions.

Parameters
wxcWxCryptSet to initialize box with.

Reimplemented from WxObject.

◆ size()

template<typename TYPE >
TYPE WxBox< TYPE >::size ( ) const
inline

Area of box.

Returns
area of box

◆ upper() [1/2]

template<typename TYPE >
TYPE WxBox< TYPE >::upper ( unsigned  dim) const
inline

Upper bound along dimension 'dim'.

Parameters
dimDirection
Returns
Upper bound along dimension dim

◆ upper() [2/2]

template<typename TYPE >
void WxBox< TYPE >::upper ( unsigned  dim,
TYPE  upp 
)
inline

Set upper bound along dimension 'dim'.

Parameters
dimDirection
Returns
Upper bound along dimension dim

Member Data Documentation

◆ _length

template<typename TYPE >
TYPE WxBox< TYPE >::_length[max_dims]
protected

◆ _lower

template<typename TYPE >
TYPE WxBox< TYPE >::_lower[max_dims]
protected

◆ _ndims

template<typename TYPE >
unsigned WxBox< TYPE >::_ndims
protected

◆ _upper

template<typename TYPE >
TYPE WxBox< TYPE >::_upper[max_dims]
protected

◆ max_dims

template<typename TYPE >
const int WxBox< TYPE >::max_dims = 8
static

Maximum rank box that can be represented.


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