AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::ArrayBase< T, 1, ArrayType > Class Template Reference

Array implementation specific to 1D Arrays. More...

#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/latest/src/axom/core/ArrayBase.hpp>

Public Types

using RealConstT = typename std::conditional< is_array_view, T, const T >::type
 

Public Member Functions

AXOM_HOST_DEVICE ArrayBase (IndexType=0)
 
AXOM_HOST_DEVICE ArrayBase (const StackArray< IndexType, 1 > &, int stride=1)
 
AXOM_HOST_DEVICE ArrayBase (const StackArray< IndexType, 1 > &, const StackArray< IndexType, 1 > &stride)
 
template<typename OtherArrayType >
 ArrayBase (const ArrayBase< typename std::remove_const< T >::type, 1, OtherArrayType > &)
 
template<typename OtherArrayType >
 ArrayBase (const ArrayBase< const typename std::remove_const< T >::type, 1, OtherArrayType > &)
 
AXOM_HOST_DEVICE StackArray< IndexType, 1 > shape () const
 Returns the dimensions of the Array. More...
 
AXOM_HOST_DEVICE IndexType minStride () const
 Returns the stride between adjacent items. More...
 
void swap (ArrayBase &)
 Swaps two ArrayBases No member data, so this is a no-op. More...
 
AXOM_HOST_DEVICE void setShape (const StackArray< IndexType, 1 > &)
 Set the shape No member data, so this is a no-op. More...
 
AXOM_HOST_DEVICE T & operator[] (const IndexType idx)
 Accessor, returns a reference to the given value. For multidimensional arrays, indexes into the (flat) raw data. More...
 
AXOM_HOST_DEVICE RealConstToperator[] (const IndexType idx) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
AXOM_HOST_DEVICE T & flatIndex (const IndexType idx)
 Accessor, returns a reference to the given value. For multidimensional arrays, indexes into the (flat) raw data. More...
 
AXOM_HOST_DEVICE RealConstTflatIndex (const IndexType idx) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 

Protected Member Functions

IndexType blockSize () const
 Returns the minimum "chunk size" that should be allocated. More...
 
void updateShapeOnInsert (const StackArray< IndexType, 1 > &)
 Updates the internal dimensions and striding based on the insertion of a range of elements. No-op, since we don't keep any shape information in this specialization. More...
 

Detailed Description

template<typename T, typename ArrayType>
class axom::ArrayBase< T, 1, ArrayType >

Array implementation specific to 1D Arrays.

Member Typedef Documentation

◆ RealConstT

template<typename T , typename ArrayType >
using axom::ArrayBase< T, 1, ArrayType >::RealConstT = typename std::conditional<is_array_view, T, const T>::type

Constructor & Destructor Documentation

◆ ArrayBase() [1/5]

template<typename T , typename ArrayType >
AXOM_HOST_DEVICE axom::ArrayBase< T, 1, ArrayType >::ArrayBase ( IndexType  = 0)
inline

◆ ArrayBase() [2/5]

template<typename T , typename ArrayType >
AXOM_HOST_DEVICE axom::ArrayBase< T, 1, ArrayType >::ArrayBase ( const StackArray< IndexType, 1 > &  ,
int  stride = 1 
)
inline

◆ ArrayBase() [3/5]

template<typename T , typename ArrayType >
AXOM_HOST_DEVICE axom::ArrayBase< T, 1, ArrayType >::ArrayBase ( const StackArray< IndexType, 1 > &  ,
const StackArray< IndexType, 1 > &  stride 
)
inline

◆ ArrayBase() [4/5]

template<typename T , typename ArrayType >
template<typename OtherArrayType >
axom::ArrayBase< T, 1, ArrayType >::ArrayBase ( const ArrayBase< typename std::remove_const< T >::type, 1, OtherArrayType > &  )
inline

◆ ArrayBase() [5/5]

template<typename T , typename ArrayType >
template<typename OtherArrayType >
axom::ArrayBase< T, 1, ArrayType >::ArrayBase ( const ArrayBase< const typename std::remove_const< T >::type, 1, OtherArrayType > &  )
inline

Member Function Documentation

◆ shape()

template<typename T , typename ArrayType >
AXOM_HOST_DEVICE StackArray<IndexType, 1> axom::ArrayBase< T, 1, ArrayType >::shape ( ) const
inline

Returns the dimensions of the Array.

◆ minStride()

template<typename T , typename ArrayType >
AXOM_HOST_DEVICE IndexType axom::ArrayBase< T, 1, ArrayType >::minStride ( ) const
inline

Returns the stride between adjacent items.

◆ operator[]() [1/2]

template<typename T , typename ArrayType >
AXOM_HOST_DEVICE T& axom::ArrayBase< T, 1, ArrayType >::operator[] ( const IndexType  idx)
inline

Accessor, returns a reference to the given value. For multidimensional arrays, indexes into the (flat) raw data.

Parameters
[in]idxthe position of the value to return.
Note
equivalent to *(array.data() + idx * array.spacing()).
Precondition
0 <= idx < asDerived().size()

◆ operator[]() [2/2]

template<typename T , typename ArrayType >
AXOM_HOST_DEVICE RealConstT& axom::ArrayBase< T, 1, ArrayType >::operator[] ( const IndexType  idx) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ flatIndex() [1/2]

template<typename T , typename ArrayType >
AXOM_HOST_DEVICE T& axom::ArrayBase< T, 1, ArrayType >::flatIndex ( const IndexType  idx)
inline

Accessor, returns a reference to the given value. For multidimensional arrays, indexes into the (flat) raw data.

Parameters
[in]idxthe position of the value to return.
Note
equivalent to *(array.data() + idx * array.minStride()).
Precondition
0 <= idx < asDerived().size()

◆ flatIndex() [2/2]

template<typename T , typename ArrayType >
AXOM_HOST_DEVICE RealConstT& axom::ArrayBase< T, 1, ArrayType >::flatIndex ( const IndexType  idx) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ swap()

template<typename T , typename ArrayType >
void axom::ArrayBase< T, 1, ArrayType >::swap ( ArrayBase< T, 1, ArrayType > &  )
inline

Swaps two ArrayBases No member data, so this is a no-op.

◆ setShape()

template<typename T , typename ArrayType >
AXOM_HOST_DEVICE void axom::ArrayBase< T, 1, ArrayType >::setShape ( const StackArray< IndexType, 1 > &  )
inline

Set the shape No member data, so this is a no-op.

◆ blockSize()

template<typename T , typename ArrayType >
IndexType axom::ArrayBase< T, 1, ArrayType >::blockSize ( ) const
inlineprotected

Returns the minimum "chunk size" that should be allocated.

◆ updateShapeOnInsert()

template<typename T , typename ArrayType >
void axom::ArrayBase< T, 1, ArrayType >::updateShapeOnInsert ( const StackArray< IndexType, 1 > &  )
inlineprotected

Updates the internal dimensions and striding based on the insertion of a range of elements. No-op, since we don't keep any shape information in this specialization.


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