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/v0.6.1/src/axom/core/ArrayBase.hpp>

Public Member Functions

 ArrayBase (IndexType=0)
 
template<typename OtherArrayType >
 ArrayBase (const ArrayBase< T, 1, OtherArrayType > &)
 
void push_back (const T &value)
 Push a value to the back of the array. More...
 
void push_back (T &&value)
 Push a value to the back of the array. More...
 
template<typename... Args>
void emplace_back (Args &&... args)
 Inserts new element at the end of the Array. More...
 
AXOM_HOST_DEVICE StackArray< IndexType, 1 > shape () const
 Returns the dimensions of the Array. More...
 
void swap (ArrayBase &)
 Swaps two ArrayBases No member data, so this is a no-op. More...
 
template<typename OtherArrayType >
void insert (IndexType pos, const ArrayBase< T, 1, OtherArrayType > &other)
 Appends an Array to the end of the calling object. 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 const T & operator[] (const IndexType idx) const
 

Protected Member Functions

IndexType blockSize () const
 Returns the minimum "chunk size" that should be allocated. More...
 

Detailed Description

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

Array implementation specific to 1D Arrays.

Constructor & Destructor Documentation

◆ ArrayBase() [1/2]

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

◆ ArrayBase() [2/2]

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

Member Function Documentation

◆ push_back() [1/2]

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

Push a value to the back of the array.

Parameters
[in]valuethe value to be added to the back.
Note
Reallocation is done if the new size will exceed the capacity.

◆ push_back() [2/2]

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

Push a value to the back of the array.

Parameters
[in]valuethe value to move to the back.
Note
Reallocation is done if the new size will exceed the capacity.

◆ emplace_back()

template<typename T , typename ArrayType >
template<typename... Args>
void axom::ArrayBase< T, 1, ArrayType >::emplace_back ( Args &&...  args)
inline

Inserts new element at the end of the Array.

Parameters
[in]argsthe arguments to forward to constructor of the element.
Note
Reallocation is done if the new size will exceed the capacity.
The size increases by 1.

◆ 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.

◆ 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).
Precondition
0 <= idx < m_num_elements

◆ operator[]() [2/2]

template<typename T , typename ArrayType >
AXOM_HOST_DEVICE const T& 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.

◆ 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.

◆ insert()

template<typename T , typename ArrayType >
template<typename OtherArrayType >
void axom::ArrayBase< T, 1, ArrayType >::insert ( IndexType  pos,
const ArrayBase< T, 1, OtherArrayType > &  other 
)
inline

Appends an Array to the end of the calling object.

Parameters
[in]otherThe Array to append
Note
Reallocation is done if the new size will exceed the capacity.

◆ blockSize()

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

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

References AXOM_HOST_DEVICE.


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