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>

Inheritance diagram for sierra::Array< ElementType, Tag0, Tag1, Tag2, Tag3, Tag4, Tag5, Tag6, Tag7 >:
Collaboration diagram for sierra::Array< ElementType, Tag0, Tag1, Tag2, Tag3, Tag4, Tag5, Tag6, Tag7 >:

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 Types inherited from sierra::FArray< ElementType, TypeListLength< MakeTypeList< Tag0, Tag1, Tag2, Tag3, Tag4, Tag5, Tag6, Tag7 >::type >::value >
enum  
 
typedef ElementType value_type
 
typedef size_t size_type
 
typedef ptrdiff_t difference_type
 
typedef value_type * pointer
 
typedef const value_type * const_pointer
 
typedef value_type & reference
 
typedef const value_type & const_reference
 
typedef pointer iterator
 
typedef const_pointer const_iterator
 
typedef std::reverse_iterator< iterator > reverse_iterator
 
typedef std::reverse_iterator< const_iterator > const_reverse_iterator
 
typedef FArray< ElementType, Dimension > SelfType
 
typedef FArrayContainer< ElementType, Dimension > Container
 
typedef FArray< ElementType, Dimension - 1 > Trunc
 

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)
 
- Public Member Functions inherited from sierra::FArray< ElementType, TypeListLength< MakeTypeList< Tag0, Tag1, Tag2, Tag3, Tag4, Tag5, Tag6, Tag7 >::type >::value >
const unsigned * dimension () const
 
unsigned dimension () const
 
unsigned dimension (const unsigned i) const
 
const unsigned * stride () const
 
unsigned stride () const
 
unsigned stride (const unsigned i) const
 
void array_dimension_verify (unsigned l_dimension, unsigned value, unsigned upper) const
 
unsigned size () const
 
bool operator== (const SelfType &a) const
 
bool operator== (const FArray< T, Dimension > &a) const
 
bool operator!= (const SelfType &a) const
 
bool operator!= (const FArray< T, Dimension > &a) const
 
value_type & operator() (const Index &index)
 
value_type & operator() (const unsigned i0, const unsigned i1, const unsigned i2, const unsigned i3, const unsigned i4, const unsigned i5, const unsigned i6, const unsigned i7)
 
value_type & operator() (const unsigned i0, const unsigned i1, const unsigned i2, const unsigned i3, const unsigned i4, const unsigned i5, const unsigned i6)
 
value_type & operator() (const unsigned i0, const unsigned i1, const unsigned i2, const unsigned i3, const unsigned i4, const unsigned i5)
 
value_type & operator() (const unsigned i0, const unsigned i1, const unsigned i2, const unsigned i3, const unsigned i4)
 
value_type & operator() (const unsigned i0, const unsigned i1, const unsigned i2, const unsigned i3)
 
value_type & operator() (const unsigned i0, const unsigned i1, const unsigned i2)
 
value_type & operator() (const unsigned i0, const unsigned i1)
 
value_type & operator() (const unsigned i0)
 
const value_type & operator() (const Index &index) const
 
const value_type & operator() (const unsigned i0, const unsigned i1, const unsigned i2, const unsigned i3, const unsigned i4, const unsigned i5, const unsigned i6, const unsigned i7) const
 
const value_type & operator() (const unsigned i0, const unsigned i1, const unsigned i2, const unsigned i3, const unsigned i4, const unsigned i5, const unsigned i6) const
 
const value_type & operator() (const unsigned i0, const unsigned i1, const unsigned i2, const unsigned i3, const unsigned i4, const unsigned i5) const
 
const value_type & operator() (const unsigned i0, const unsigned i1, const unsigned i2, const unsigned i3, const unsigned i4) const
 
const value_type & operator() (const unsigned i0, const unsigned i1, const unsigned i2, const unsigned i3) const
 
const value_type & operator() (const unsigned i0, const unsigned i1, const unsigned i2) const
 
const value_type & operator() (const unsigned i0, const unsigned i1) const
 
const value_type & operator() (const unsigned i0) const
 
value_type * ptr ()
 
value_type * ptr () const
 
value_type & operator[] (unsigned i)
 
const value_type & operator[] (unsigned i) const
 
bool verify_dimension (const unsigned n0, const unsigned n1, const unsigned n2, const unsigned n3, const unsigned n4, const unsigned n5, const unsigned n6, const unsigned n7) const
 
bool verify_dimension (const unsigned n0, const unsigned n1, const unsigned n2, const unsigned n3, const unsigned n4, const unsigned n5, const unsigned n6) const
 
bool verify_dimension (const unsigned n0, const unsigned n1, const unsigned n2, const unsigned n3, const unsigned n4, const unsigned n5) const
 
bool verify_dimension (const unsigned n0, const unsigned n1, const unsigned n2, const unsigned n3, const unsigned n4) const
 
bool verify_dimension (const unsigned n0, const unsigned n1, const unsigned n2, const unsigned n3) const
 
bool verify_dimension (const unsigned n0, const unsigned n1, const unsigned n2) const
 
bool verify_dimension (const unsigned n0, const unsigned n1) const
 
bool verify_dimension (const unsigned n0) const
 
unsigned set_dim (const unsigned d[])
 
unsigned set_dim (const unsigned n0, const unsigned n1, const unsigned n2, const unsigned n3, const unsigned n4, const unsigned n5, const unsigned n6, const unsigned n7)
 
unsigned set_dim (const unsigned n0, const unsigned n1, const unsigned n2, const unsigned n3, const unsigned n4, const unsigned n5, const unsigned n6)
 
unsigned set_dim (const unsigned n0, const unsigned n1, const unsigned n2, const unsigned n3, const unsigned n4, const unsigned n5)
 
unsigned set_dim (const unsigned n0, const unsigned n1, const unsigned n2, const unsigned n3, const unsigned n4)
 
unsigned set_dim (const unsigned n0, const unsigned n1, const unsigned n2, const unsigned n3)
 
unsigned set_dim (const unsigned n0, const unsigned n1, const unsigned n2)
 
unsigned set_dim (const unsigned n0, const unsigned n1)
 
unsigned set_dim (const unsigned n0)
 
unsigned set_dim (const SelfType &a)
 
 FArray (const SelfType &a)
 
 FArray (const FArray< T, Dimension > &a)
 
 FArray (value_type *const l_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)
 
 FArray (value_type *const l_ptr, const unsigned n0, const unsigned n1, const unsigned n2, const unsigned n3, const unsigned n4, const unsigned n5, const unsigned n6)
 
 FArray (value_type *const l_ptr, const unsigned n0, const unsigned n1, const unsigned n2, const unsigned n3, const unsigned n4, const unsigned n5)
 
 FArray (value_type *const l_ptr, const unsigned n0, const unsigned n1, const unsigned n2, const unsigned n3, const unsigned n4)
 
 FArray (value_type *const l_ptr, const unsigned n0, const unsigned n1, const unsigned n2, const unsigned n3)
 
 FArray (value_type *const l_ptr, const unsigned n0, const unsigned n1, const unsigned n2)
 
 FArray (value_type *const l_ptr, const unsigned n0, const unsigned n1)
 
 FArray (value_type *const l_ptr, const unsigned n0)
 
 FArray (value_type *const l_ptr, const unsigned n[NumDim])
 
SelfTypeoperator= (SelfType const &a)
 
void set (const SelfType &a)
 
void set (value_type *const l_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 (value_type *const l_ptr, const unsigned n0, const unsigned n1, const unsigned n2, const unsigned n3, const unsigned n4, const unsigned n5, const unsigned n6)
 
void set (value_type *const l_ptr, const unsigned n0, const unsigned n1, const unsigned n2, const unsigned n3, const unsigned n4, const unsigned n5)
 
void set (value_type *const l_ptr, const unsigned n0, const unsigned n1, const unsigned n2, const unsigned n3, const unsigned n4)
 
void set (value_type *const l_ptr, const unsigned n0, const unsigned n1, const unsigned n2, const unsigned n3)
 
void set (value_type *const l_ptr, const unsigned n0, const unsigned n1, const unsigned n2)
 
void set (value_type *const l_ptr, const unsigned n0, const unsigned n1)
 
void set (value_type *const l_ptr, const unsigned n0)
 
void set (value_type *const l_ptr, const unsigned n[NumDim])
 
Trunc dive (int i)
 
const Trunc dive (int i) const
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
void dimensions (const_iterator it, Index &index) const
 
void copy (const FArray< T, Dimension > &a)
 
void fill (const T &value)
 

Additional Inherited Members

- Protected Attributes inherited from sierra::FArray< ElementType, TypeListLength< MakeTypeList< Tag0, Tag1, Tag2, Tag3, Tag4, Tag5, Tag6, Tag7 >::type >::value >
value_type * m_ptr
 
unsigned m_dim [NumDim]
 
unsigned m_stride [NumDim+1]
 

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 82 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: