PARTONS
|
PARtonic Tomography Of Nucleon Software
|
Multidimensional optimized array. More...
Public Member Functions | |
MDArray () | |
Default constructor. More... | |
MDArray (std::vector< size_t > _dims, const T &initValue=T()) | |
Constructor. More... | |
~MDArray () | |
Destructor. More... | |
void | push_back (T value) |
Push back one element. More... | |
const size_t | getSize () |
Get size of the data array. More... | |
T & | operator() (size_t coordValue,...) |
() accessor for setting value at target index. More... | |
T const & | operator() (size_t coordValue,...) const |
() accessor for getting value at target index. More... | |
std::string | toString () const |
Get string representing the array data. More... | |
Private Member Functions | |
size_t | indexOf (size_t coordValue, va_list ap) const |
Return index of specifics coordinates. More... | |
size_t | computeIntermediateIndex (size_t coordValue, unsigned int numDim) const |
Compute intermediate index value. More... | |
Private Attributes | |
std::vector< size_t > | dims |
Vector containing array dimension sizes. More... | |
std::vector< T > | data |
Array data. More... | |
Multidimensional optimized array.
This class acts as a STL-like container to store multidimensional data in a single vector only (here, std::vector). The usage of this class is illustrated by the following example:
which gives via Logger:
|
inline |
Default constructor.
|
inline |
Constructor.
_dims | Vector containing array dimension sizes. |
initValue | Initialization element to be used to fill this array. |
|
inline |
Destructor.
|
inlineprivate |
Compute intermediate index value.
|
inline |
Get size of the data array.
|
inlineprivate |
Return index of specifics coordinates.
Transform x,y,z,... coordinates to index x.
|
inline |
() accessor for setting value at target index.
|
inline |
() accessor for getting value at target index.
|
inline |
Push back one element.
To be used only with one dimensional arrays.
value | Element to be pushed back. |
|
inline |
Get string representing the array data.
|
private |
Array data.
|
private |
Vector containing array dimension sizes.