bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
|
A wrapper class for a vector of Array::dimension structs. More...
#include <Shape.h>
Classes | |
class | IndexIterator |
Public Types | |
typedef std::vector< unsigned int > | IndexTuple |
Public Member Functions | |
Shape::IndexIterator | beginSpaceEnumeration () const |
Shape::IndexIterator | endSpaceEnumeration () const |
unsigned int | getConstrainedSpaceSize () const |
unsigned int | getNumDimensions () const |
unsigned int | getRowMajorIndex (const IndexTuple &indices, bool validate=true) const |
unsigned int | getUnconstrainedSpaceSize () const |
bool | isConstrained () const |
bool | operator!= (const Shape &rhs) const |
Shape & | operator= (const Shape &rhs) |
bool | operator== (const Shape &rhs) const |
void | print (std::ostream &strm) const |
void | setToUnconstrained () |
Shape () | |
Shape (const Array ©DimsFrom) | |
Shape (const Shape &proto) | |
std::string | toString () const |
bool | validateIndices (const IndexTuple &indices) const |
Static Public Member Functions | |
static bool | areDimensionsEqual (const Array::dimension &lhs, const Array::dimension &rhs) |
static void | printDimension (std::ostream &strm, const Array::dimension &dim) |
Friends | |
class | IndexIterator |
A wrapper class for a vector of Array::dimension structs.
We add functionality for equality, getting space sizes for constrained and unconstrained cases, and a way to get row major absolute indices into a linear array rep of a multi-dimensional array (as C stores them).
Shape::IndexIterator: We also add an iterator for generating the full set of index tuples for all the points in a given Shape (constrained or not) using a row major order memory traversal (i.e. for the case of no constraints, we should advance linearly one element at a time through the memory when looking up an index tuple). Leftmost component of the tuple varies fastest. Again, these iterator work if there is a constraint on the dataset as well, generating one index tuple for each entry in the defined hyperslab, also in row major order so that the constrained elements can be shoved into a Vector _buf for shipping off the hyperslab.
typedef std::vector<unsigned int> ncml_module::Shape::IndexTuple |
ncml_module::Shape::Shape | ( | ) |
The empty shape, with no dimensions. Not valid for anything useful except IndexIterator
Empty shape
ncml_module::Shape::Shape | ( | const Array & | copyDimsFrom | ) |
|
static |
Shape::IndexIterator ncml_module::Shape::beginSpaceEnumeration | ( | ) | const |
Create a forward iterator that returns IndexTuple's in a row major order (leftmost dimension slowest varying) enumeration of all the points in this Shape. This uses constraints, so should return getConstrainedSpaceSize() values. If constraints are not set, the getConstrainedSpaceSize() == getUnconstrainedSpaceSize().
ASSUMES: this Shape CANNOT be mutated during the life of the return value!! Only const functions should be used for the life of the returned iterator.
Shape::IndexIterator ncml_module::Shape::endSpaceEnumeration | ( | ) | const |
The end of the enumeration for testing end conditions.
|
inline |
|
inline |
unsigned int ncml_module::Shape::getRowMajorIndex | ( | const IndexTuple & | indices, |
bool | validate = true ) const |
Return the row major linear index into a slowest varying dimension first flattening of the given UNCONSTRAINED space (ie use dim.size for each dimension's size)
indices | an array with an index into each dimension of the space. |
validate | whether to do bounds checks or not. true means slightly slower, but safer. exceptions are only thrown if validate, unless a memory fault occurs from bad indices. |
ASSUME: indices.size() is the dimensionality of the space, which MUST match _dims.size() or we throw.
Given there are d dimensions of size n_i for i in {0, d-1} and indices is the d-tuple (i_0, i_1, ..., 1_{d-1}) where each i_j is in [0, n_j - 1] the index is: i_{d-1} + n_{d-1} * (i_{d-2} + n_{d-2} * ( ... + n_1 * i_0) )
If | the dimensionality of indices does not match the dimensionality of _dims. |
If | any index in indices is out of bounds for the matching dimension in _dims. |
|
inline |
bool ncml_module::Shape::isConstrained | ( | ) | const |
void ncml_module::Shape::print | ( | std::ostream & | strm | ) | const |
|
static |
void ncml_module::Shape::setToUnconstrained | ( | ) |
std::string ncml_module::Shape::toString | ( | ) | const |
bool ncml_module::Shape::validateIndices | ( | const IndexTuple & | indices | ) | const |