#include <source/patchdata/array/array_access/MDA_Access.h>
Inheritance diagram for MDA_OrderRowMajor< MDA_DIM >:
Public Types | |
enum | { MDA_Reduced_DIM = (MDA_DIM > 1 ? MDA_DIM-1 : 1) } |
Quantity of (MDA_DIM-1), used only if MDA_DIM > 1. Otherwise defined to 1 to avoid out-of-range subscripts. More... | |
typedef int | index_t |
Type for the index. | |
typedef MDA_IndexRange< MDA_DIM > | range_t |
typedef range_t::dim_t | dim_t |
Type for the dimension counter. | |
typedef MDA_OrderRowMajor< MDA_Reduced_DIM > | reduced_order_t |
Public Member Functions | |
MDA_OrderRowMajor (const size_t *sz=((size_t *) 0), const index_t *st=((index_t *) 0)) | |
Similar to MDA_IndexRange constructor. | |
MDA_OrderRowMajor (const index_t *si, const index_t *sf) | |
Similar to MDA_IndexRange constructor. | |
MDA_OrderRowMajor (const range_t &r) | |
Constructor for specifying index range object. | |
size_t | totalSize (unsigned short d) const |
Return the total size of subarray starting with dimension d. | |
size_t | reduce (index_t i, reduced_order_t &new_order) const |
Computes the order object and offset for reducing the slowest dimension. | |
Access to index range | |
const range_t & | range () const |
Const access to the index range object. | |
const MDA_OrderRowMajor & | setSizeAndStart (const size_t *sz=((size_t *) 0), const index_t *st=((index_t *) 0)) |
Similar to MDA_IndexRange::setSizeAndStart(). | |
const MDA_OrderRowMajor & | setInclusiveRange (const index_t first[MDA_DIM], const index_t final[MDA_DIM]) |
Similar to MDA_IndexRange::setInclusiveRange(). | |
const MDA_OrderRowMajor & | adjustDim (dim_t d, index_t first, index_t final) |
Similar to MDA_IndexRange::adjustDim(). | |
Logical comparisons | |
bool | operator== (const MDA_OrderRowMajor &r) const |
Equivalence comparison. | |
bool | operator!= (const MDA_OrderRowMajor &r) const |
Inequivalence comparison. | |
Functions to compute offsets | |
index_t | offset (const index_t i[MDA_DIM]) const |
Compute offsets for arbitrary MDA_DIM . | |
index_t | offset (index_t i0) const |
index_t | offset (index_t i0, index_t i1) const |
index_t | offset (index_t i0, index_t i1, index_t i2) const |
index_t | offset (index_t i0, index_t i1, index_t i2, index_t i3) const |
index_t | fixedOffset () const |
Protected Types | |
enum | { D0 = range_t::D0, D1 = range_t::D1, D2 = range_t::D2, D3 = range_t::D3 } |
This class computes things that are dependent on element order in memory, in this case, for the row-major order.
typedef int MDA_OrderRowMajor< MDA_DIM >::index_t |
typedef MDA_IndexRange<MDA_DIM> MDA_OrderRowMajor< MDA_DIM >::range_t |
typedef range_t::dim_t MDA_OrderRowMajor< MDA_DIM >::dim_t |
Type for the dimension counter.
Type dim_t could be "unsigned short" instead of "short", but using short causes the GNU compiler to issue unneeded warnings about certain comparisons always being false (when instantiating with MDA_DIM of 1).
Reimplemented from MDA_IndexRange< MDA_DIM >.
typedef MDA_OrderRowMajor<MDA_Reduced_DIM> MDA_OrderRowMajor< MDA_DIM >::reduced_order_t |
anonymous enum |
MDA_OrderRowMajor< MDA_DIM >::MDA_OrderRowMajor | ( | const size_t * | sz = ((size_t*)0) , |
|
const index_t * | st = ((index_t*)0) | |||
) | [inline] |
MDA_OrderRowMajor< MDA_DIM >::MDA_OrderRowMajor | ( | const index_t * | si, | |
const index_t * | sf | |||
) | [inline] |
Similar to MDA_IndexRange constructor.
si | Array of initial indices |
sf | Array of final indices |
MDA_OrderRowMajor< MDA_DIM >::MDA_OrderRowMajor | ( | const range_t & | r | ) | [inline] |
Constructor for specifying index range object.
r | Array index object |
const range_t& MDA_OrderRowMajor< MDA_DIM >::range | ( | ) | const [inline] |
Const access to the index range object.
The index range cannot be modified through this reference. To modify the index range, use other member functions.
const MDA_OrderRowMajor& MDA_OrderRowMajor< MDA_DIM >::setSizeAndStart | ( | const size_t * | sz = ((size_t*)0) , |
|
const index_t * | st = ((index_t*)0) | |||
) | [inline] |
const MDA_OrderRowMajor& MDA_OrderRowMajor< MDA_DIM >::setInclusiveRange | ( | const index_t | first[MDA_DIM], | |
const index_t | final[MDA_DIM] | |||
) | [inline] |
const MDA_OrderRowMajor& MDA_OrderRowMajor< MDA_DIM >::adjustDim | ( | dim_t | d, | |
index_t | first, | |||
index_t | final | |||
) | [inline] |
Similar to MDA_IndexRange::adjustDim().
bool MDA_OrderRowMajor< MDA_DIM >::operator== | ( | const MDA_OrderRowMajor< MDA_DIM > & | r | ) | const [inline] |
Equivalence comparison.
Only independent data is compared, not dependent (redundant) data.
bool MDA_OrderRowMajor< MDA_DIM >::operator!= | ( | const MDA_OrderRowMajor< MDA_DIM > & | r | ) | const [inline] |
Inequivalence comparison.
Only independent data is compared, not dependent (redundant) data.
index_t MDA_OrderRowMajor< MDA_DIM >::offset | ( | const index_t | i[MDA_DIM] | ) | const [inline] |
Compute offsets for arbitrary MDA_DIM
.
This is flexible but not efficient! You should use dimension-specific offset computations whenever possible.
index_t MDA_OrderRowMajor< MDA_DIM >::offset | ( | index_t | i0 | ) | const [inline] |
index_t MDA_OrderRowMajor< MDA_DIM >::offset | ( | index_t | i0, | |
index_t | i1 | |||
) | const [inline] |
index_t MDA_OrderRowMajor< MDA_DIM >::offset | ( | index_t | i0, | |
index_t | i1, | |||
index_t | i2 | |||
) | const [inline] |
index_t MDA_OrderRowMajor< MDA_DIM >::offset | ( | index_t | i0, | |
index_t | i1, | |||
index_t | i2, | |||
index_t | i3 | |||
) | const [inline] |
index_t MDA_OrderRowMajor< MDA_DIM >::fixedOffset | ( | ) | const [inline] |
size_t MDA_OrderRowMajor< MDA_DIM >::totalSize | ( | unsigned short | d | ) | const [inline] |
Return the total size of subarray starting with dimension d.
size_t MDA_OrderRowMajor< MDA_DIM >::reduce | ( | index_t | i, | |
reduced_order_t & | new_order | |||
) | const [inline] |
Computes the order object and offset for reducing the slowest dimension.
A reduced array is the subarray resulting from fixing the slowest (first) index. The reduced array has one fewer dimension, a different ordering object and its data starts at a different point in memory. The change in starting point is the returned offset value, and the new order object is returned in the referenced argument.