IBAMR  IBAMR version 0.19.
Public Types | Public Member Functions | Protected Types | Private Types | Private Member Functions | Private Attributes | List of all members
MDA_OrderColMajor< MDA_DIM > Class Template Reference

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

#include <MDA_Access.h>

Inheritance diagram for MDA_OrderColMajor< MDA_DIM >:
Inheritance graph
[legend]

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
 
typedef MDA_IndexRange< MDA_DIM > range_t
 
typedef range_t::dim_t dim_t
 
typedef MDA_OrderColMajor< MDA_Reduced_DIMreduced_order_t
 

Public Member Functions

 MDA_OrderColMajor (const size_t *sz=((size_t *) 0), const index_t *st=((index_t *) 0))
 Similar to MDA_IndexRange constructor. More...
 
 MDA_OrderColMajor (const index_t *si, const index_t *sf)
 Similar to MDA_IndexRange constructor. More...
 
 MDA_OrderColMajor (const range_t &r)
 Constructor for specifying index range object. More...
 
Access to index range (see MDA_IndexRange)
const range_trange () const
 Const access to the index range object. More...
 
const MDA_OrderColMajorsetSizeAndStart (const size_t *sz=((size_t *) 0), const index_t *st=((index_t *) 0))
 Similar to MDA_IndexRange::setSizeAndStart(). More...
 
const MDA_OrderColMajorsetInclusiveRange (const index_t first[MDA_DIM], const index_t final[MDA_DIM])
 Similar to MDA_IndexRange::setInclusiveRange(). More...
 
const MDA_OrderColMajoradjustDim (dim_t d, index_t first, index_t final)
 Similar to MDA_IndexRange::adjustDim(). More...
 
Logical comparisons
bool operator== (const MDA_OrderColMajor &r) const
 Equivalence comparison. More...
 
bool operator!= (const MDA_OrderColMajor &r) const
 Inequivalence comparison. More...
 

Protected Types

enum  { D0 = range_t::D0, D1 = range_t::D1, D2 = range_t::D2, D3 = range_t::D3 }
 

Private Types

enum  {
  D0 = 0, D1 = (MDA_DIM > 1 ? 1 : 0), D2 = (MDA_DIM > 2 ? 2 : 0), D3 = (MDA_DIM > 3 ? 3 : 0),
  D4 = (MDA_DIM > 4 ? 4 : 0)
}
 Dimension number (to avoid compiler warnings, set to zero when unused). More...
 

Private Member Functions

bool operator== (const MDA_IndexRange &r) const
 Equivalence comparison. More...
 
bool operator!= (const MDA_IndexRange &r) const
 Inequivalence comparison. More...
 
std::ostream & streamPut (std::ostream &os) const
 Output to ostream. More...
 
std::istream & streamGet (std::istream &is)
 Input from istream. More...
 
const index_tbeg (size_t i) const
 Give starting index of a given dimension. More...
 
const index_tend (size_t i) const
 Give ending index (one more than the last valid index) of a given dimension. More...
 
const size_t & size (size_t i) const
 Give size along a given dimension. More...
 
size_t totalSize () const
 Give size for all dimensions. More...
 
bool has (index_t i0) const
 Check if indices are in range. More...
 
bool has (index_t i0, index_t i1) const
 Check if indices are in range. More...
 
bool has (index_t i0, index_t i1, index_t i2) const
 Check if indices are in range. More...
 
bool has (index_t i0, index_t i1, index_t i2, index_t i3) const
 Check if indices are in range. More...
 
void setDependentData ()
 Set dependent data. More...
 

Private Attributes

index_t d_start [MDA_DIM >0?MDA_DIM:1]
 Array of starting indices. More...
 
index_t d_stop [MDA_DIM >0?MDA_DIM:1]
 Array of stopping indices. More...
 
size_t d_size [MDA_DIM >0?MDA_DIM:1]
 Array of sizes. More...
 

Functions to compute offsets

size_t d_total_size [MDA_DIM >0?MDA_DIM:1]
 Total sizes of sub-dimensional arrays. More...
 
index_t d_fixed_offset
 The fixed portions of offset calculations. More...
 
index_t offset (const index_t i[MDA_DIM]) const
 Compute offsets for arbitrary MDA_DIM. More...
 
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
 
size_t totalSize (unsigned short d) const
 Return the total size of subarray starting with dimension d. More...
 
size_t reduce (index_t i, reduced_order_t &new_order) const
 Computes the order object and offset for reducing the slowest dimension. More...
 
void computeSizeDependentData ()
 Recompute the total sizes array, which is dependent on sizes. More...
 

Detailed Description

template<unsigned short MDA_DIM>
class MDA_OrderColMajor< MDA_DIM >

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

Member Typedef Documentation

◆ index_t

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

◆ range_t

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

◆ dim_t

template<unsigned short MDA_DIM>
typedef range_t::dim_t MDA_OrderColMajor< MDA_DIM >::dim_t

◆ reduced_order_t

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

Member Enumeration Documentation

◆ anonymous enum

template<unsigned short MDA_DIM>
anonymous enum
protected
Enumerator
D0 
D1 
D2 
D3 

◆ anonymous enum

template<unsigned short MDA_DIM>
anonymous enum
Enumerator
MDA_Reduced_DIM 

◆ anonymous enum

template<unsigned short MDA_DIM>
anonymous enum
protectedinherited
Enumerator
D0 
D1 
D2 
D3 
D4 

Constructor & Destructor Documentation

◆ MDA_OrderColMajor() [1/3]

template<unsigned short MDA_DIM>
MDA_OrderColMajor< MDA_DIM >::MDA_OrderColMajor ( const size_t *  sz = ((size_t*)0),
const index_t st = ((index_t*)0) 
)
inline
Parameters
szArray sizes
stArray starting indices

◆ MDA_OrderColMajor() [2/3]

template<unsigned short MDA_DIM>
MDA_OrderColMajor< MDA_DIM >::MDA_OrderColMajor ( const index_t si,
const index_t sf 
)
inline
Parameters
siArray of initial indices
sfArray of final indices

◆ MDA_OrderColMajor() [3/3]

template<unsigned short MDA_DIM>
MDA_OrderColMajor< MDA_DIM >::MDA_OrderColMajor ( const range_t r)
inline
Parameters
rArray index object

Member Function Documentation

◆ range()

template<unsigned short MDA_DIM>
const range_t& MDA_OrderColMajor< MDA_DIM >::range ( ) const
inline

The index range cannot be modified through this reference. To modify the index range, use other member functions.

◆ setSizeAndStart()

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

◆ setInclusiveRange()

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

◆ adjustDim()

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

◆ operator==() [1/2]

template<unsigned short MDA_DIM>
bool MDA_OrderColMajor< MDA_DIM >::operator== ( const MDA_OrderColMajor< MDA_DIM > &  r) const
inline

Only independent data is compared, not dependent (redundant) data.

◆ operator!=() [1/2]

template<unsigned short MDA_DIM>
bool MDA_OrderColMajor< MDA_DIM >::operator!= ( const MDA_OrderColMajor< MDA_DIM > &  r) const
inline

Only independent data is compared, not dependent (redundant) data.

◆ offset() [1/5]

template<unsigned short MDA_DIM>
index_t MDA_OrderColMajor< MDA_DIM >::offset ( const index_t  i[MDA_DIM]) const
inline

This is flexible but not efficient! You should use dimension-specific offset computations whenever possible.

◆ offset() [2/5]

template<unsigned short MDA_DIM>
index_t MDA_OrderColMajor< MDA_DIM >::offset ( index_t  i0) const
inline

◆ offset() [3/5]

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

◆ offset() [4/5]

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

◆ offset() [5/5]

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

◆ fixedOffset()

template<unsigned short MDA_DIM>
index_t MDA_OrderColMajor< MDA_DIM >::fixedOffset ( ) const
inline

◆ totalSize() [1/2]

template<unsigned short MDA_DIM>
size_t MDA_OrderColMajor< MDA_DIM >::totalSize ( unsigned short  d) const
inline

◆ reduce()

template<unsigned short MDA_DIM>
size_t MDA_OrderColMajor< MDA_DIM >::reduce ( index_t  i,
reduced_order_t new_order 
) const
inline

A reduced array is the subarray resulting from fixing the slowest (last) 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.

◆ computeSizeDependentData()

template<unsigned short MDA_DIM>
void MDA_OrderColMajor< MDA_DIM >::computeSizeDependentData ( )
inlineprivate

◆ operator==() [2/2]

template<unsigned short MDA_DIM>
bool MDA_IndexRange< MDA_DIM >::operator== ( const MDA_IndexRange< MDA_DIM > &  r) const
inlineinherited

◆ operator!=() [2/2]

template<unsigned short MDA_DIM>
bool MDA_IndexRange< MDA_DIM >::operator!= ( const MDA_IndexRange< MDA_DIM > &  r) const
inlineinherited

◆ streamPut()

template<unsigned short MDA_DIM>
std::ostream& MDA_IndexRange< MDA_DIM >::streamPut ( std::ostream &  os) const
inlineinherited

◆ streamGet()

template<unsigned short MDA_DIM>
std::istream& MDA_IndexRange< MDA_DIM >::streamGet ( std::istream &  is)
inlineinherited

◆ beg()

template<unsigned short MDA_DIM>
const index_t& MDA_IndexRange< MDA_DIM >::beg ( size_t  i) const
inlineinherited
Parameters
iindex of dimension

◆ end()

template<unsigned short MDA_DIM>
const index_t& MDA_IndexRange< MDA_DIM >::end ( size_t  i) const
inlineinherited
Parameters
iindex of dimension

◆ size()

template<unsigned short MDA_DIM>
const size_t& MDA_IndexRange< MDA_DIM >::size ( size_t  i) const
inlineinherited
Parameters
iindex of dimension

◆ totalSize() [2/2]

template<unsigned short MDA_DIM>
size_t MDA_IndexRange< MDA_DIM >::totalSize ( ) const
inlineinherited

◆ has() [1/4]

template<unsigned short MDA_DIM>
bool MDA_IndexRange< MDA_DIM >::has ( index_t  i0) const
inlineinherited

◆ has() [2/4]

template<unsigned short MDA_DIM>
bool MDA_IndexRange< MDA_DIM >::has ( index_t  i0,
index_t  i1 
) const
inlineinherited

◆ has() [3/4]

template<unsigned short MDA_DIM>
bool MDA_IndexRange< MDA_DIM >::has ( index_t  i0,
index_t  i1,
index_t  i2 
) const
inlineinherited

◆ has() [4/4]

template<unsigned short MDA_DIM>
bool MDA_IndexRange< MDA_DIM >::has ( index_t  i0,
index_t  i1,
index_t  i2,
index_t  i3 
) const
inlineinherited

◆ setDependentData()

template<unsigned short MDA_DIM>
void MDA_IndexRange< MDA_DIM >::setDependentData ( )
inlineprivateinherited

Member Data Documentation

◆ d_total_size

template<unsigned short MDA_DIM>
size_t MDA_OrderColMajor< MDA_DIM >::d_total_size[MDA_DIM >0?MDA_DIM:1]
private

d_total_size[i] is the size of the sub-matrix contained in the first (fast) i+1 dimensions of the array. Incidentally, the stride size of dimension i is d_total_size[i-1] (and the stride size for dimension 0 is 1.

d_total_size[i] is really equal to \( \prod_{j=0}^{i} size_j \)

This member simply caches size-dependent data.

◆ d_fixed_offset

template<unsigned short MDA_DIM>
index_t MDA_OrderColMajor< MDA_DIM >::d_fixed_offset
private

Offsets can be separated into a fixed part (dependent only on range) and a variable part (dependent on indices). To prevent repeated computation of the fixed part, it is saved in this variable. Note that a good optimizing compiler should already do this, so doing it in the code may not really be needed.

This member simply caches size-dependent data.

◆ d_start

template<unsigned short MDA_DIM>
index_t MDA_IndexRange< MDA_DIM >::d_start[MDA_DIM >0?MDA_DIM:1]
protectedinherited

◆ d_stop

template<unsigned short MDA_DIM>
index_t MDA_IndexRange< MDA_DIM >::d_stop[MDA_DIM >0?MDA_DIM:1]
protectedinherited

◆ d_size

template<unsigned short MDA_DIM>
size_t MDA_IndexRange< MDA_DIM >::d_size[MDA_DIM >0?MDA_DIM:1]
protectedinherited

The documentation for this class was generated from the following file: