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

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

Public Types

using StagingBuffer = DeviceStagingBuffer< T >
 

Public Member Functions

 ArrayOps (int allocId, bool preferDevice)
 
void init (T *data, IndexType begin, IndexType nelems)
 Default-initializes the "new" segment of an array. More...
 
void fill (T *array, IndexType begin, IndexType nelems, const T &value)
 Fills an uninitialized array with objects of type T. More...
 
void fill_range (T *array, IndexType begin, IndexType nelems, const T *values, MemorySpace valueSpace)
 Fills an uninitialized array with a range of objects of type T. More...
 
template<typename... Args>
void emplace (T *array, IndexType i, Args &&... args)
 Constructs a new element in uninitialized memory. More...
 
void destroy (T *array, IndexType begin, IndexType nelems)
 Calls the destructor on a range of typed elements in the array. More...
 
void move (T *array, IndexType src_begin, IndexType src_end, IndexType dst)
 Moves a range of data in the array. More...
 
void realloc_move (T *array, IndexType nelems, T *values)
 Moves a range of elements to a new allocation. More...
 

Static Public Attributes

constexpr static MemorySpace space {MemorySpace::Dynamic}
 

Member Typedef Documentation

◆ StagingBuffer

template<typename T >
using axom::detail::ArrayOps< T >::StagingBuffer = DeviceStagingBuffer<T>

Constructor & Destructor Documentation

◆ ArrayOps()

template<typename T >
axom::detail::ArrayOps< T >::ArrayOps ( int  allocId,
bool  preferDevice 
)
inline

Member Function Documentation

◆ init()

template<typename T >
void axom::detail::ArrayOps< T >::init ( T *  data,
IndexType  begin,
IndexType  nelems 
)
inline

Default-initializes the "new" segment of an array.

Parameters
[in,out]dataThe data to initialize
[in]beginThe beginning of the subset of data that should be initialized
[in]nelemsthe number of elements to initialize

References AXOM_LAMBDA, axom::utilities::annotations::begin(), axom::detail::DeviceStagingBuffer< T >::getStagingBuffer(), and axom::detail::ArrayOps< T >::space.

◆ fill()

template<typename T >
void axom::detail::ArrayOps< T >::fill ( T *  array,
IndexType  begin,
IndexType  nelems,
const T &  value 
)
inline

Fills an uninitialized array with objects of type T.

Parameters
[in,out]arraythe array to fill
[in]beginthe index in the array to begin filling elements at
[in]nelemsthe number of elements to fill the array with
[in]valuethe value to set each array element to

References AXOM_LAMBDA, axom::utilities::annotations::begin(), axom::detail::DeviceStagingBuffer< T >::getStagingBuffer(), and axom::detail::ArrayOps< T >::space.

◆ fill_range()

template<typename T >
void axom::detail::ArrayOps< T >::fill_range ( T *  array,
IndexType  begin,
IndexType  nelems,
const T *  values,
MemorySpace  valueSpace 
)
inline

Fills an uninitialized array with a range of objects of type T.

Parameters
[in,out]arraythe array to fill
[in]beginthe index at which to begin placing elements
[in]nelemsthe number of elements in the range to fill the array with
[in]valuesthe values to set each array element to
[in]valueSpacethe memory space in which values resides

References axom::utilities::annotations::begin(), axom::copy(), axom::detail::DeviceStagingBuffer< T >::getStagingBuffer(), and axom::detail::ArrayOps< T >::space.

◆ emplace()

template<typename T >
template<typename... Args>
void axom::detail::ArrayOps< T >::emplace ( T *  array,
IndexType  i,
Args &&...  args 
)
inline

Constructs a new element in uninitialized memory.

Parameters
[in,out]arraythe array to construct in
[in]ithe array index in which to construct the new object
[in]argsthe arguments to forward to constructor of the element.

References AXOM_UNLIKELY, axom::copy(), and axom::detail::ArrayOps< T >::space.

◆ destroy()

template<typename T >
void axom::detail::ArrayOps< T >::destroy ( T *  array,
IndexType  begin,
IndexType  nelems 
)
inline

Calls the destructor on a range of typed elements in the array.

Parameters
[in,out]arraythe array with elements to destroy
[in]beginthe start index of the range of elements to destroy
[in]nelemsthe number of elements to destroy

References axom::utilities::annotations::begin(), axom::detail::DeviceStagingBuffer< T >::getStagingBuffer(), and axom::detail::ArrayOps< T >::space.

◆ move()

template<typename T >
void axom::detail::ArrayOps< T >::move ( T *  array,
IndexType  src_begin,
IndexType  src_end,
IndexType  dst 
)
inline

Moves a range of data in the array.

Parameters
[in,out]arraythe array with elements to move
[in]src_beginthe start index of the source range
[in]src_endthe end index of the source range, exclusive
[in]dstthe destination index of the range of elements

References axom::copy(), axom::deallocate(), and axom::detail::ArrayOps< T >::space.

◆ realloc_move()

template<typename T >
void axom::detail::ArrayOps< T >::realloc_move ( T *  array,
IndexType  nelems,
T *  values 
)
inline

Moves a range of elements to a new allocation.

Parameters
[in,out]arraythe array to move the elements to.
[in]nelemsthe number of elements to move.
[in]valuesthe destination index of the range of elements

References axom::copy(), axom::detail::ArrayOps< T >::destroy(), and axom::detail::ArrayOps< T >::space.

Member Data Documentation

◆ space

template<typename T >
constexpr static MemorySpace axom::detail::ArrayOps< T >::space {MemorySpace::Dynamic}
staticconstexpr

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