41 typedef std::vector<unsigned int>
shape;
46 unsigned int d_highest_offset;
51 unsigned int d_offset;
63 d_shape(shape), d_offset(0)
65 d_rank = d_shape.size();
68 for (
unsigned int i = 0; i < d_rank; ++i) {
69 d_highest_offset *= d_shape.at(i);
72 d_indices.resize(d_rank, 0);
91 for (
unsigned int i = 0; i < d_rank; ++i)
112 shape::reverse_iterator si = d_shape.rbegin();
113 for (shape::reverse_iterator i = d_indices.rbegin(), e = d_indices.rend(); i != e; ++i, ++si) {
156 return d_highest_offset;
void indices(shape &indices)
Return the current set of indices.
std::vector< unsigned int > shape
Odometer(shape shape)
Build an instance of Odometer using the given 'shape'.
void reset()
Reset the internal state.
unsigned int end()
Return the sentinel value that indicates that the offset (returned by offset()) is at the end of the ...
static class NCMLUtil overview
unsigned int offset()
The offset into memory for the current element.
Map the indices of a N-dimensional array to the offset into memory that matches those indices...
unsigned int next()
Increment the Odometer to the next element and return the offset value.