MDA_OrderRowMajor< MDA_DIM > Class Template Reference

Performs computations based for row-major arrays. More...

#include <source/patchdata/array/array_access/MDA_Access.h>

Inheritance diagram for MDA_OrderRowMajor< MDA_DIM >:

Inheritance graph
[legend]
List of all members.

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_trange () const
 Const access to the index range object.
const MDA_OrderRowMajorsetSizeAndStart (const size_t *sz=((size_t *) 0), const index_t *st=((index_t *) 0))
 Similar to MDA_IndexRange::setSizeAndStart().
const MDA_OrderRowMajorsetInclusiveRange (const index_t first[MDA_DIM], const index_t final[MDA_DIM])
 Similar to MDA_IndexRange::setInclusiveRange().
const MDA_OrderRowMajoradjustDim (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 }

Detailed Description

template<unsigned short MDA_DIM>
class MDA_OrderRowMajor< MDA_DIM >

Performs computations based for row-major arrays.

This class computes things that are dependent on element order in memory, in this case, for the row-major order.


Member Typedef Documentation

template<unsigned short MDA_DIM>
typedef int MDA_OrderRowMajor< MDA_DIM >::index_t

Type for the index.

Reimplemented from MDA_IndexRange< MDA_DIM >.

template<unsigned short MDA_DIM>
typedef MDA_IndexRange<MDA_DIM> MDA_OrderRowMajor< MDA_DIM >::range_t

template<unsigned short MDA_DIM>
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 >.

template<unsigned short MDA_DIM>
typedef MDA_OrderRowMajor<MDA_Reduced_DIM> MDA_OrderRowMajor< MDA_DIM >::reduced_order_t


Member Enumeration Documentation

template<unsigned short MDA_DIM>
anonymous enum [protected]

Enumerator:
D0 
D1 
D2 
D3 

template<unsigned short MDA_DIM>
anonymous enum

Quantity of (MDA_DIM-1), used only if MDA_DIM > 1. Otherwise defined to 1 to avoid out-of-range subscripts.

Enumerator:
MDA_Reduced_DIM 


Constructor & Destructor Documentation

template<unsigned short MDA_DIM>
MDA_OrderRowMajor< MDA_DIM >::MDA_OrderRowMajor ( const size_t *  sz = ((size_t*)0),
const index_t st = ((index_t*)0) 
) [inline]

Similar to MDA_IndexRange constructor.

Parameters:
sz  Array sizes
st  Array starting indices

template<unsigned short MDA_DIM>
MDA_OrderRowMajor< MDA_DIM >::MDA_OrderRowMajor ( const index_t si,
const index_t sf 
) [inline]

Similar to MDA_IndexRange constructor.

Parameters:
si  Array of initial indices
sf  Array of final indices

template<unsigned short MDA_DIM>
MDA_OrderRowMajor< MDA_DIM >::MDA_OrderRowMajor ( const range_t r  )  [inline]

Constructor for specifying index range object.

Parameters:
r  Array index object


Member Function Documentation

template<unsigned short MDA_DIM>
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.

template<unsigned short MDA_DIM>
const MDA_OrderRowMajor& MDA_OrderRowMajor< MDA_DIM >::setSizeAndStart ( const size_t *  sz = ((size_t*)0),
const index_t st = ((index_t*)0) 
) [inline]

Similar to MDA_IndexRange::setSizeAndStart().

Reimplemented from MDA_IndexRange< MDA_DIM >.

template<unsigned short MDA_DIM>
const MDA_OrderRowMajor& MDA_OrderRowMajor< MDA_DIM >::setInclusiveRange ( const index_t  first[MDA_DIM],
const index_t  final[MDA_DIM] 
) [inline]

Similar to MDA_IndexRange::setInclusiveRange().

Reimplemented from MDA_IndexRange< MDA_DIM >.

template<unsigned short MDA_DIM>
const MDA_OrderRowMajor& MDA_OrderRowMajor< MDA_DIM >::adjustDim ( dim_t  d,
index_t  first,
index_t  final 
) [inline]

Similar to MDA_IndexRange::adjustDim().

template<unsigned short MDA_DIM>
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.

template<unsigned short MDA_DIM>
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.

template<unsigned short MDA_DIM>
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.

template<unsigned short MDA_DIM>
index_t MDA_OrderRowMajor< MDA_DIM >::offset ( index_t  i0  )  const [inline]

template<unsigned short MDA_DIM>
index_t MDA_OrderRowMajor< MDA_DIM >::offset ( index_t  i0,
index_t  i1 
) const [inline]

template<unsigned short MDA_DIM>
index_t MDA_OrderRowMajor< MDA_DIM >::offset ( index_t  i0,
index_t  i1,
index_t  i2 
) const [inline]

template<unsigned short MDA_DIM>
index_t MDA_OrderRowMajor< MDA_DIM >::offset ( index_t  i0,
index_t  i1,
index_t  i2,
index_t  i3 
) const [inline]

template<unsigned short MDA_DIM>
index_t MDA_OrderRowMajor< MDA_DIM >::fixedOffset (  )  const [inline]

template<unsigned short MDA_DIM>
size_t MDA_OrderRowMajor< MDA_DIM >::totalSize ( unsigned short  d  )  const [inline]

Return the total size of subarray starting with dimension d.

template<unsigned short MDA_DIM>
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.

Returns:
Pointer offset (always positive) to the reduced array pointer.


The documentation for this class was generated from the following file:
Generated on Thu Jun 18 11:28:18 2009 for SAMRAI by  doxygen 1.5.1