Sierra Toolkit  Version of the Day
sierra::Array< ElementType, Tag0, Tag1, Tag2, Tag3, Tag4, Tag5, Tag6, Tag7 > Class Template Reference

Multidimensional array view of contiguous memory. More...

#include <Array.hpp>

Public Types

enum  { NumDim = TypeListLength<TagList>::value }
 
typedef ElementType element_type
 
typedef Array< element_type, Tag0, Tag1, Tag2, Tag3, Tag4, Tag5, Tag6, Tag7 > SelfType
 
typedef Array< const element_type, Tag0, Tag1, Tag2, Tag3, Tag4, Tag5, Tag6, Tag7 > Const
 
typedef MakeTypeList< Tag0, Tag1, Tag2, Tag3, Tag4, Tag5, Tag6, Tag7 >::type TagList
 
typedef FArray< ElementType, TypeListLength< typename MakeTypeList< Tag0, Tag1, Tag2, Tag3, Tag4, Tag5, Tag6, Tag7 >::type >::value > BaseType
 
typedef Array< ElementType, typename TypeListAt< typename TypeListEraseAt< TagList, NumDim - 1 >::list_type, 0 >::type, typename TypeListAt< typename TypeListEraseAt< TagList, NumDim - 1 >::list_type, 1 >::type, typename TypeListAt< typename TypeListEraseAt< TagList, NumDim - 1 >::list_type, 2 >::type, typename TypeListAt< typename TypeListEraseAt< TagList, NumDim - 1 >::list_type, 3 >::type, typename TypeListAt< typename TypeListEraseAt< TagList, NumDim - 1 >::list_type, 4 >::type, typename TypeListAt< typename TypeListEraseAt< TagList, NumDim - 1 >::list_type, 5 >::type, typename TypeListAt< typename TypeListEraseAt< TagList, NumDim - 1 >::list_type, 6 >::type, TypeListEndTrunc
 

Public Member Functions

const unsigned * dimension () const
 
const unsigned * stride () const
 
template<unsigned I>
unsigned dimension () const
 
unsigned dimension (const unsigned i) const
 
unsigned stride (const unsigned i) const
 
template<unsigned I>
unsigned stride () const
 
template<class Tag >
unsigned dimension () const
 
template<class Tag , unsigned Ordinal>
unsigned dimension () const
 
template<class Tag >
unsigned stride () const
 
template<class Tag , unsigned Ordinal>
unsigned stride () const
 
bool operator== (const SelfType &a) const
 
template<typename T >
bool operator== (const Array< T, Tag0, Tag1, Tag2, Tag3, Tag4, Tag5, Tag6, Tag7 > &a) const
 
bool operator!= (const SelfType &a) const
 
template<typename T >
bool operator!= (const Array< T, Tag0, Tag1, Tag2, Tag3, Tag4, Tag5, Tag6, Tag7 > &a) const
 
 Array (const SelfType &a)
 
template<typename T >
 Array (const Array< T, Tag0, Tag1, Tag2, Tag3, Tag4, Tag5, Tag6, Tag7 > &a)
 
 Array (element_type *const in_ptr, const unsigned n0, const unsigned n1, const unsigned n2, const unsigned n3, const unsigned n4, const unsigned n5, const unsigned n6, const unsigned n7)
 
 Array (element_type *const in_ptr, const unsigned n0, const unsigned n1, const unsigned n2, const unsigned n3, const unsigned n4, const unsigned n5, const unsigned n6)
 
 Array (element_type *const in_ptr, const unsigned n0, const unsigned n1, const unsigned n2, const unsigned n3, const unsigned n4, const unsigned n5)
 
 Array (element_type *const in_ptr, const unsigned n0, const unsigned n1, const unsigned n2, const unsigned n3, const unsigned n4)
 
 Array (element_type *const in_ptr, const unsigned n0, const unsigned n1, const unsigned n2, const unsigned n3)
 
 Array (element_type *const in_ptr, const unsigned n0, const unsigned n1, const unsigned n2)
 
 Array (element_type *const in_ptr, const unsigned n0, const unsigned n1)
 
 Array (element_type *const in_ptr, const unsigned n0)
 
 Array (element_type *const in_ptr, const unsigned n[NumDim])
 
void set (const SelfType &a)
 
void set (element_type *const in_ptr, const unsigned n0, const unsigned n1, const unsigned n2, const unsigned n3, const unsigned n4, const unsigned n5, const unsigned n6, const unsigned n7)
 
void set (element_type *const in_ptr, const unsigned n0, const unsigned n1, const unsigned n2, const unsigned n3, const unsigned n4, const unsigned n5, const unsigned n6)
 
void set (element_type *const in_ptr, const unsigned n0, const unsigned n1, const unsigned n2, const unsigned n3, const unsigned n4, const unsigned n5)
 
void set (element_type *const in_ptr, const unsigned n0, const unsigned n1, const unsigned n2, const unsigned n3, const unsigned n4)
 
void set (element_type *const in_ptr, const unsigned n0, const unsigned n1, const unsigned n2, const unsigned n3)
 
void set (element_type *const in_ptr, const unsigned n0, const unsigned n1, const unsigned n2)
 
void set (element_type *const in_ptr, const unsigned n0, const unsigned n1)
 
void set (element_type *const in_ptr, const unsigned n0)
 
void set (element_type *const in_ptr, const unsigned n[NumDim])
 
Trunc dive (int i)
 
const Trunc dive (int i) const
 
template<typename T >
void copy (const Array< T, Tag0, Tag1, Tag2, Tag3, Tag4, Tag5, Tag6, Tag7 > &a)
 
template<typename T >
void fill (const T &value)
 

Detailed Description

template<class ElementType, class Tag0, class Tag1, class Tag2, class Tag3, class Tag4, class Tag5, class Tag6, class Tag7>
class sierra::Array< ElementType, Tag0, Tag1, Tag2, Tag3, Tag4, Tag5, Tag6, Tag7 >

Multidimensional array view of contiguous memory.

Dimension tagging

Multidimensional array of contiguous memory. The memory is not owned by the array, but container access semantics are enforced, i.e. const Array<> elements cannot be assigned to.

class X {}; class Y {}; class Z {}; Array<double, X, Y, Z> grid;

describes a three dimensional array with the three indices associated with 'X', 'Y', and 'Z' respectively.

Indexing via 'operator()'

Elements of an array can be accessed via the () operator, where an index is provided for each dimension of the array. The number of dimensions is enforced at compile time; however, enforcement of the range of the indices is only performed at runtime in debug mode, i.e. 'NDEBUG' is not defined.

FArray<double, W, X, Y, Z> a(mem, n0, n1, n2, n3); a(i0, i1, i2, i3) = 24;

Construction with a block of memory

An array is created by providing it with memory and dimensions by which that memory is to be viewed.

FArray(pointer, ndim0, ndim1, ndim2, ...);

Shallow copy construction

The copy constructor is a shallow copy. The constructed array is just another a view into the same memory as the input array. This is the preferred method of passing arrays as access required less memory indirection.

Definition at line 147 of file Array.hpp.

Member Enumeration Documentation

◆ anonymous enum

template<class ElementType , class Tag0 , class Tag1 , class Tag2 , class Tag3 , class Tag4 , class Tag5 , class Tag6 , class Tag7 >
anonymous enum

Number of dimensions

Definition at line 162 of file Array.hpp.

Member Function Documentation

◆ dimension()

template<class ElementType , class Tag0 , class Tag1 , class Tag2 , class Tag3 , class Tag4 , class Tag5 , class Tag6 , class Tag7 >
const unsigned* sierra::Array< ElementType, Tag0, Tag1, Tag2, Tag3, Tag4, Tag5, Tag6, Tag7 >::dimension ( ) const
inline

Dimensions defined at contruction

Definition at line 177 of file Array.hpp.


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