WARPXM v1.10.0
Loading...
Searching...
No Matches
WxRange Class Reference

WxRange represents a hyper-rectangular domain of an n-dimensional space of integers. More...

#include <wxrange.h>

Inheritance diagram for WxRange:
WxBox< int > WxObject

Detailed Description

WxRange represents a hyper-rectangular domain of an n-dimensional space of integers.

Counting includes extremum, so [0 1] has length 2 elements.

Public Member Functions

 WxRange ()=default
 Creates an empty range with no dimensions or extent.
 
 WxRange (unsigned ndims)
 Create a 'ndims' dimensional range.
 
 WxRange (unsigned ndims, const int *lower, const int *upper)
 Constucts a range with given 'lower' and 'upper' bounds.
 
 WxRange (const std::vector< int > &lower, const std::vector< int > &extent)
 Constucts a range with given 'lower' coordinates, and extent as specified.
 
 WxRange (unsigned ndims, const int *length)
 Constucts a range given lengths of each side.
 
 WxRange (const WxBox< int > &templateBox)
 Constructs a range matching a giving WxBox<int> template.
 
 WxRange (const WxRange &b)
 Copy constructor and assignment operators.
 
WxRangeoperator= (const WxRange &b)
 
bool encloses (const WxRange &candidateRange) const
 Check if the range encloses the given range.
 
bool compareShape (const WxRange &candidateRange) const
 Check if all side lengths of the supplied range match this one.
 
WxRange extend (const int low[], const int upp[]) const
 Returns a range which is extended by the given amount along each side in each dimension.
 
WxRange extend (const int uniformPad[]) const
 Returns a range which is extended by the given amount along both sides in each dimension.
 
WxRange extend (int uniformPad) const
 Returns a range which is extended by the given amount along both sides in every dimension.
 
void extrude (const WxRange &range)
 Increases the rank of this range to match that of the supplied range argument.
 
WxRange intersect (const WxRange &otherRange) const
 Returns a range which is the intersection or logical union of this and the supplied range.
 
WxRange getShiftedRange (const std::vector< int > &newLowerCornerCoordinates) const
 Returns a range which has the same shape as this one, but has been shifted to a new position.
 
bool isEmpty () const
 Determine if range is empty.
 
int length (unsigned dim) const
 Length of edge along dimension 'dim'.
 
int size () const
 Number of elements in range.
 
bool operator== (const WxRange &r) const
 Check if this range is equal to one supplied.
 
bool operator!= (const WxRange &r) const
 Check if this range is not equal to one supplied.
 

Friends

std::ostream & operator<< (std::ostream &out, const WxRange &range)
 

Additional Inherited Members

- Protected Member Functions inherited from WxBox< int >
 WxBox ()
 
 WxBox (unsigned ndims)
 Create a 'ndims' dimensional box.
 
 WxBox (unsigned ndims, const int *lower, const int *upper)
 Constucts a box with given 'lower' and 'upper' bounds.
 
 WxBox (unsigned ndims, const int *length)
 Constucts a box given lengths of each side.
 
 WxBox (int s1, int e1)
 The following constructors constuct a box with explicit passing of lower s* and upper e* coordinates.
 
 WxBox (int s1, int e1, int s2, int e2)
 Rank-2 ctor.
 
 WxBox (int s1, int e1, int s2, int e2, int s3, int e3)
 Rank-3 ctor.
 
 WxBox (int s1, int e1, int s2, int e2, int s3, int e3, int s4, int e4)
 Rank-4 ctor.
 
 WxBox (const WxBox< int > &b)
 Copy constructor and assignment operators.
 
WxBoxoperator= (const WxBox< int > &b)
 
virtual ~WxBox ()
 
virtual void setup (const WxCryptSet &wxc)
 Constructs a box specified in a cryptset.
 
void resize (const unsigned dim, const int newLength)
 Modify upper indicex based on newly supplied length.
 
unsigned ndims () const
 Dimensionality of box.
 
int lower (unsigned dim) const
 Lower bound along dimension 'dim'.
 
void lower (unsigned dim, int low)
 Set lower bound along dimension 'dim'.
 
int upper (unsigned dim) const
 Upper bound along dimension 'dim'.
 
void upper (unsigned dim, int upp)
 Set upper bound along dimension 'dim'.
 
std::pair< int, int > boundsPair (unsigned dim) const
 Pair of upper and lower bound along dimension 'dim'.
 
virtual bool isEmpty () const
 Determine if box is empty.
 
virtual int length (unsigned dim) const
 Length of edge along dimension 'dim'.
 
int area () const
 Area of box.
 
int size () const
 Area of box.
 
std::string coordinateString () const
 String of box coordinates.
 
WxBox< int > intersect (const WxBox< int > &box) const
 Computes intersection of this box with supplied box.
 
WxBox< int > extend (const int low[], const int upp[]) const
 Returns a box which is extended by the given amount along each side in each dimension.
 
WxBox< int > extend (const int uniformPad[]) const
 Returns a box which is extended by the given amount along both sides in each dimension.
 
WxBox< int > extend (int uniformPad) const
 Returns a box which is extended by the given amount along both sides in every dimension.
 
WxBox< int > extDim (int low, int 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< int > reduceDim (unsigned int newDim) const
 Returns a new box which has up to new number of dimensions.
 
bool operator== (const WxBox< int > &b) const
 Check if this box is equal to one supplied.
 
bool contains (const int coord[]) const
 Check if the box contains the given point.
 
bool encloses (const WxBox< int > &candidateBox) const
 Check if the box encloses the given box.
 
bool compareShape (const WxBox< int > &candidateBox) const
 Check if all side lengths of the supplied box match this one.
 
- 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.
 
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.
 
- Protected Attributes inherited from WxBox< int >
unsigned _ndims
 
int _lower [max_dims]
 
int _upper [max_dims]
 
int _length [max_dims]
 
- Static Protected Attributes inherited from WxBox< int >
static const int max_dims
 Maximum rank box that can be represented.
 

Constructor & Destructor Documentation

◆ WxRange() [1/7]

WxRange::WxRange ( )
default

Creates an empty range with no dimensions or extent.

◆ WxRange() [2/7]

WxRange::WxRange ( unsigned  ndims)
inline

Create a 'ndims' dimensional range.

◆ WxRange() [3/7]

WxRange::WxRange ( unsigned  ndims,
const int *  lower,
const int *  upper 
)
inline

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

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

◆ WxRange() [4/7]

WxRange::WxRange ( const std::vector< int > &  lower,
const std::vector< int > &  extent 
)
inline

Constucts a range with given 'lower' coordinates, and extent as specified.

Vector arguments must be same size.

Parameters
lowerlower corner coordinates
extentextent or length of range in each dimension

◆ WxRange() [5/7]

WxRange::WxRange ( unsigned  ndims,
const int *  length 
)
inline

Constucts a range given lengths of each side.

All lower[] values will be 0.

Parameters
ndimsDimensionality of the range
lengthArray of upper corner coordinates

◆ WxRange() [6/7]

WxRange::WxRange ( const WxBox< int > &  templateBox)
inline

Constructs a range matching a giving WxBox<int> template.

Parameters
templateBoxWxRange geometry will match that described by this box.

◆ WxRange() [7/7]

WxRange::WxRange ( const WxRange b)
inline

Copy constructor and assignment operators.

Member Function Documentation

◆ compareShape()

bool WxRange::compareShape ( const WxRange candidateRange) const
inline

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

Parameters
candidateRangeRange to check
Returns
true if range shape is the same as candidateRange, false otherwise

◆ encloses()

bool WxRange::encloses ( const WxRange candidateRange) const
inline

Check if the range encloses the given range.

Overlapping edges are considered contained.

Parameters
candidateRangeRange to check
Returns
true if range encloses this candidateRange, false otherwise

◆ extend() [1/3]

WxRange WxRange::extend ( const int  low[],
const int  upp[] 
) const
inline

Returns a range 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 range

◆ extend() [2/3]

WxRange WxRange::extend ( const int  uniformPad[]) const
inline

Returns a range 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 range

◆ extend() [3/3]

WxRange WxRange::extend ( int  uniformPad) const
inline

Returns a range 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 range

◆ extrude()

void WxRange::extrude ( const WxRange range)
inline

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

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

Parameters
rangetemplate range to use for extrusion.

◆ getShiftedRange()

WxRange WxRange::getShiftedRange ( const std::vector< int > &  newLowerCornerCoordinates) const
inline

Returns a range which has the same shape as this one, but has been shifted to a new position.

If size of newLowerCoordinates is less than the rank of this range, higher coordinates are not modified.

Parameters
newLowerCornerCoordinatesabsolute value for new lower position
Returns
shifted range with shape of this but repositioned based on directed absolute position of lower coordinates.

◆ intersect()

WxRange WxRange::intersect ( const WxRange otherRange) const
inline

Returns a range which is the intersection or logical union of this and the supplied range.

Parameters
otherRangerange to compare to
Returns
intersected range of this and otherRange. Returned range is empty rank 0 if any dimension has non-intersection. If range ranks do not match, an empty rank 0 range is returned.

◆ isEmpty()

bool WxRange::isEmpty ( ) const
inlinevirtual

Determine if range is empty.

Returns
true of range is empty, false otherwise

Reimplemented from WxBox< int >.

◆ length()

int WxRange::length ( unsigned  dim) const
inlinevirtual

Length of edge along dimension 'dim'.

Parameters
dimDirection
Returns
Length of side along dimension dim

Reimplemented from WxBox< int >.

◆ operator!=()

bool WxRange::operator!= ( const WxRange r) const
inline

Check if this range is not equal to one supplied.

Parameters
rWxRange to compare with
Returns
true if the ranges are not same, or false otherwise

◆ operator=()

WxRange & WxRange::operator= ( const WxRange b)
inline

◆ operator==()

bool WxRange::operator== ( const WxRange r) const
inline

Check if this range is equal to one supplied.

Parameters
rWxRange to compare with
Returns
true if the ranges are same, or false otherwise

◆ size()

int WxRange::size ( ) const
inline

Number of elements in range.

Returns
number of elements in range

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  out,
const WxRange range 
)
friend

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