58 WxRange(
const std::vector<int>&
lower,
const std::vector<int>& extent)
61 for (
unsigned int i = 0; i <
ndims(); ++i)
77 for (
unsigned int i = 0; i <
ndims; ++i)
79 int newLength =
length[i] - 1;
230 for (
unsigned j = 0; j <
_ndims; ++j)
232 lowerAdj[j] = std::max(
_lower[j], otherRange.
_lower[j]);
233 upperAdj[j] = std::min(
_upper[j], otherRange.
_upper[j]);
234 if (lowerAdj[j] > upperAdj[j])
259 j < std::min(static_cast<size_t>(
_ndims), newLowerCornerCoordinates.size());
262 lowerAdj[j] = newLowerCornerCoordinates[j];
263 upperAdj[j] = newLowerCornerCoordinates[j] + (
_upper[j] -
_lower[j]);
282 for (
unsigned i = 0; i <
_ndims; ++i)
309 for (
unsigned i = 0; i <
_ndims; ++i)
338 out <<
"Range ndims " << range.
_ndims <<
", length[";
339 for (
unsigned i = 0; i < range.
_ndims; i++)
342 if (i != range.
_ndims - 1)
348 for (
unsigned i = 0; i < range.
_ndims; i++)
350 out << range.
lower(i);
351 if (i != range.
_ndims - 1)
357 for (
unsigned i = 0; i < range.
_ndims; i++)
359 out << range.
upper(i);
360 if (i != range.
_ndims - 1)
WxBox represents a n-dimensional box of elements specified by lower coordinates and upper coordinates...
Definition: wxbox.h:25
bool operator==(const WxBox< TYPE > &b) const
Check if this box is equal to one supplied.
bool compareShape(const WxBox< TYPE > &candidateBox) const
Check if all side lengths of the supplied box match this one.
std::pair< int, int > boundsPair(unsigned dim) const
Pair of upper and lower bound along dimension 'dim'.
Definition: wxbox.h:170
unsigned _ndims
Definition: wxbox.h:324
static const int max_dims
Maximum rank box that can be represented.
Definition: wxbox.h:321
bool contains(const int coord[]) const
Check if the box contains the given point.
virtual void setup(const WxCryptSet &wxc)
Constructs a box specified in a cryptset.
void extrude(const WxBox &box)
Increases the rank of this box to match that of the supplied box argument.
unsigned ndims() const
Dimensionality of box.
Definition: wxbox.h:113
int _lower[max_dims]
Definition: wxbox.h:325
std::string coordinateString() const
String of box coordinates.
int upper(unsigned dim) const
Upper bound along dimension 'dim'.
Definition: wxbox.h:147
WxBox< int > reduceDim(unsigned int newDim) const
Returns a new box which has up to new number of dimensions.
int lower(unsigned dim) const
Lower bound along dimension 'dim'.
Definition: wxbox.h:124
int _upper[max_dims]
Definition: wxbox.h:325
WxBox & operator=(const WxBox< TYPE > &b)
bool encloses(const WxBox< TYPE > &candidateBox) const
Check if the box encloses the given box.
WxBox< int > extDim(int low, int upp) const
Returns a new box which has one greater dimension than this one.
int _length[max_dims]
Definition: wxbox.h:325
void resize(const unsigned dim, const TYPE newLength)
Modify upper indicex based on newly supplied length.
WxRange represents a hyper-rectangular domain of an n-dimensional space of integers.
Definition: wxrange.h:23
bool operator!=(const WxRange &r) const
Check if this range is not equal to one supplied.
Definition: wxrange.h:331
friend std::ostream & operator<<(std::ostream &out, const WxRange &range)
Definition: wxrange.h:336
bool isEmpty() const
Determine if range is empty.
Definition: wxrange.h:278
WxRange(unsigned ndims, const int *length)
Constucts a range given lengths of each side.
Definition: wxrange.h:75
int length(unsigned dim) const
Length of edge along dimension 'dim'.
Definition: wxrange.h:294
WxRange & operator=(const WxRange &b)
Definition: wxrange.h:100
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.
Definition: wxrange.h:253
WxRange(const WxBox< int > &templateBox)
Constructs a range matching a giving WxBox<int> template.
Definition: wxrange.h:89
bool compareShape(const WxRange &candidateRange) const
Check if all side lengths of the supplied range match this one.
Definition: wxrange.h:154
WxRange extend(const int uniformPad[]) const
Returns a range which is extended by the given amount along both sides in each dimension.
Definition: wxrange.h:182
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.
Definition: wxrange.h:170
bool encloses(const WxRange &candidateRange) const
Check if the range encloses the given range.
Definition: wxrange.h:143
WxRange(const std::vector< int > &lower, const std::vector< int > &extent)
Constucts a range with given 'lower' coordinates, and extent as specified.
Definition: wxrange.h:58
WxRange(unsigned ndims)
Create a 'ndims' dimensional range.
Definition: wxrange.h:34
WxRange(unsigned ndims, const int *lower, const int *upper)
Constucts a range with given 'lower' and 'upper' bounds.
Definition: wxrange.h:45
bool operator==(const WxRange &r) const
Check if this range is equal to one supplied.
Definition: wxrange.h:320
void extrude(const WxRange &range)
Increases the rank of this range to match that of the supplied range argument.
Definition: wxrange.h:206
int size() const
Number of elements in range.
Definition: wxrange.h:304
WxRange intersect(const WxRange &otherRange) const
Returns a range which is the intersection or logical union of this and the supplied range.
Definition: wxrange.h:220
WxRange()=default
Creates an empty range with no dimensions or extent.
WxRange extend(int uniformPad) const
Returns a range which is extended by the given amount along both sides in every dimension.
Definition: wxrange.h:193
WxRange(const WxRange &b)
Copy constructor and assignment operators.
Definition: wxrange.h:96