bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
|
#include <DmrppChunkOdometer.h>
Public Member Functions | |
DmrppChunkOdometer (shape chunk_shape, shape array_shape) | |
const shape & | indices () const noexcept |
bool | next () |
void | reset () noexcept |
Map the indices of a N-dimensional array to the offset into memory (i.e., a vector) that matches those indices. This code can be used to step through each element of an N-dim array without using multiplication to compute the offset into the vector that holds the array's data.
reset(): zero internal state
bool next(): move to the next element, incrementing the shape information and returning an offset into a linear vector for that element. Calling next() when the object is at the last element returns false. Calling next() after that is probably a bad idea.
vector<int> indices(): for the given state of the odometer, return the indices that match the offset.
Definition at line 56 of file DmrppChunkOdometer.h.
|
inline |
Build an instance of Odometer using the given 'shape'. Each element of the shape vector is the size of the corresponding dimension. E.G., a 10 by 20 by 30 array would be described by a vector of 10,20,30.
Initially, the Odometer object is set to index 0, 0, ..., 0 that matches the offset 0
Definition at line 78 of file DmrppChunkOdometer.h.
|
inlinenoexcept |
Return the current set of indices. These match the current offset. Both the offset and indices are incremented by the next() method.
To access the ith index, use [i] or .at(i)
Definition at line 129 of file DmrppChunkOdometer.h.
|
inline |
Increment the Odometer to the next element and return the offset value. This increments the internal state and returns the offset to that element in a vector of values. Calling indices() after calling this method will return a vector<unsigned int> of the current index value.
Definition at line 104 of file DmrppChunkOdometer.h.
|
inlinenoexcept |
Reset the internal state. The offset is reset to the 0th element and the indices are reset to 0, 0, ..., 0.
Definition at line 88 of file DmrppChunkOdometer.h.