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

This class extends StackArray with some std::vector-like convenience methods. More...

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

Inheritance diagram for axom::StaticArray< T, N >:

Public Types

using value_type = T
 

Public Member Functions

AXOM_HOST_DEVICE StaticArray ()
 Constructor. More...
 
AXOM_HOST_DEVICE StaticArray (const StaticArray &obj)
 Copy Constructor. More...
 
AXOM_HOST_DEVICE ~StaticArray ()
 Destructor. More...
 
AXOM_HOST_DEVICE StaticArrayoperator= (const StaticArray &obj)
 Copy assignment operator. More...
 
constexpr AXOM_HOST_DEVICE axom::IndexType capacity () const
 Returns the capacity of the static array. More...
 
AXOM_HOST_DEVICE axom::IndexType size () const
 Returns the size of the static array. More...
 
AXOM_HOST_DEVICE void push_back (const T &obj)
 Pushes an object to the back of the static array. More...
 
AXOM_HOST_DEVICE void pop_back ()
 Pops the last element off the list. More...
 
AXOM_HOST_DEVICE void clear ()
 Clears the data from the static array. More...
 
AXOM_HOST_DEVICE bool empty () const
 Determines whether the container is empty. More...
 
AXOM_HOST_DEVICE void fill (const T &fill_value)
 Fills the container with the supplied value. More...
 
AXOM_HOST_DEVICE T & operator[] (IndexType i) noexcept
 Accessor, returns a reference to the value at the given index. More...
 
constexpr AXOM_HOST_DEVICE const T & operator[] (IndexType i) const noexcept
 
AXOM_HOST_DEVICE operator T* () noexcept
 User defined conversion to a raw pointer. More...
 
constexpr AXOM_HOST_DEVICE operator const T * () const noexcept
 
AXOM_HOST_DEVICE T * data () noexcept
 
AXOM_HOST_DEVICE const T * data () const noexcept
 
AXOM_HOST_DEVICE T * begin () noexcept
 Begin/end iterators. More...
 
AXOM_HOST_DEVICE const T * begin () const noexcept
 
AXOM_HOST_DEVICE T * end () noexcept
 
AXOM_HOST_DEVICE const T * end () const noexcept
 

Static Public Member Functions

constexpr static AXOM_HOST_DEVICE int size ()
 Return size of the array. More...
 

Public Attributes

m_data [N]
 

Detailed Description

template<typename T, int N>
class axom::StaticArray< T, N >

This class extends StackArray with some std::vector-like convenience methods.

Template Parameters
Tthe type of the values to hold.
Nthe number of values in the array.
Note
Type T must be default-constructible on device for device execution.

Member Typedef Documentation

◆ value_type

template<typename T , int N>
using axom::StackArray< T, N >::value_type = T
inherited

Constructor & Destructor Documentation

◆ StaticArray() [1/2]

template<typename T , int N>
AXOM_HOST_DEVICE axom::StaticArray< T, N >::StaticArray ( )
inline

Constructor.

◆ StaticArray() [2/2]

template<typename T , int N>
AXOM_HOST_DEVICE axom::StaticArray< T, N >::StaticArray ( const StaticArray< T, N > &  obj)
inline

Copy Constructor.

Parameters
objThe object to be copied.

References axom::StackArray< T, N >::m_data.

◆ ~StaticArray()

template<typename T , int N>
AXOM_HOST_DEVICE axom::StaticArray< T, N >::~StaticArray ( )
inline

Destructor.

Member Function Documentation

◆ operator=()

template<typename T , int N>
AXOM_HOST_DEVICE StaticArray& axom::StaticArray< T, N >::operator= ( const StaticArray< T, N > &  obj)
inline

Copy assignment operator.

Parameters
objThe object to be copied.

References axom::StackArray< T, N >::m_data.

◆ capacity()

template<typename T , int N>
constexpr AXOM_HOST_DEVICE axom::IndexType axom::StaticArray< T, N >::capacity ( ) const
inlineconstexpr

Returns the capacity of the static array.

Returns
The capacity of the static array

◆ size() [1/2]

template<typename T , int N>
AXOM_HOST_DEVICE axom::IndexType axom::StaticArray< T, N >::size ( ) const
inline

Returns the size of the static array.

Returns
The size of the static array

◆ push_back()

template<typename T , int N>
AXOM_HOST_DEVICE void axom::StaticArray< T, N >::push_back ( const T &  obj)
inline

Pushes an object to the back of the static array.

Parameters
[in]objthe object to be added to the back.
Note
The number of push_backs must not exceed N, the max number of values in the array.
If the static array is full, push_back will not modify the static array.

References axom::StaticArray< T, N >::capacity().

◆ pop_back()

template<typename T , int N>
AXOM_HOST_DEVICE void axom::StaticArray< T, N >::pop_back ( )
inline

Pops the last element off the list.

◆ clear()

template<typename T , int N>
AXOM_HOST_DEVICE void axom::StaticArray< T, N >::clear ( )
inline

Clears the data from the static array.

◆ empty()

template<typename T , int N>
AXOM_HOST_DEVICE bool axom::StaticArray< T, N >::empty ( ) const
inline

Determines whether the container is empty.

Returns
True if empty, false otherwise.

◆ fill()

template<typename T , int N>
AXOM_HOST_DEVICE void axom::StaticArray< T, N >::fill ( const T &  fill_value)
inline

Fills the container with the supplied value.

Parameters
fill_valueThe fill value.

◆ size() [2/2]

template<typename T , int N>
constexpr static AXOM_HOST_DEVICE int axom::StackArray< T, N >::size ( )
inlinestaticconstexprinherited

Return size of the array.

◆ operator[]() [1/2]

template<typename T , int N>
AXOM_HOST_DEVICE T& axom::StackArray< T, N >::operator[] ( IndexType  i)
inlinenoexceptinherited

Accessor, returns a reference to the value at the given index.

Parameters
[in]ithe index to access.

References axom::StackArray< T, N >::m_data.

◆ operator[]() [2/2]

template<typename T , int N>
constexpr AXOM_HOST_DEVICE const T& axom::StackArray< T, N >::operator[] ( IndexType  i) const
inlineconstexprnoexceptinherited

◆ operator T*()

template<typename T , int N>
AXOM_HOST_DEVICE axom::StackArray< T, N >::operator T* ( )
inlinenoexceptinherited

User defined conversion to a raw pointer.

◆ operator const T *()

template<typename T , int N>
constexpr AXOM_HOST_DEVICE axom::StackArray< T, N >::operator const T * ( ) const
inlineconstexprnoexceptinherited

◆ data() [1/2]

template<typename T , int N>
AXOM_HOST_DEVICE T* axom::StackArray< T, N >::data ( )
inlinenoexceptinherited

◆ data() [2/2]

template<typename T , int N>
AXOM_HOST_DEVICE const T* axom::StackArray< T, N >::data ( ) const
inlinenoexceptinherited

◆ begin() [1/2]

template<typename T , int N>
AXOM_HOST_DEVICE T* axom::StackArray< T, N >::begin ( )
inlinenoexceptinherited

Begin/end iterators.

References axom::StackArray< T, N >::m_data.

◆ begin() [2/2]

template<typename T , int N>
AXOM_HOST_DEVICE const T* axom::StackArray< T, N >::begin ( ) const
inlinenoexceptinherited

◆ end() [1/2]

template<typename T , int N>
AXOM_HOST_DEVICE T* axom::StackArray< T, N >::end ( )
inlinenoexceptinherited

◆ end() [2/2]

template<typename T , int N>
AXOM_HOST_DEVICE const T* axom::StackArray< T, N >::end ( ) const
inlinenoexceptinherited

Member Data Documentation

◆ m_data

template<typename T , int N>
T axom::StackArray< T, N >::m_data[N]
inherited

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