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

Provides a generic multidimensional array container. More...

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

Inheritance diagram for axom::Array< T, DIM, SPACE, StoragePolicy >:

Public Types

using value_type = T
 
using ArrayIterator = ArrayIteratorBase< Array< T, DIM, SPACE, StoragePolicy >, T >
 
using ConstArrayIterator = ArrayIteratorBase< const Array< T, DIM, SPACE, StoragePolicy >, const T >
 
using ArrayViewType = ArrayView< T, DIM, SPACE >
 
using ConstArrayViewType = ArrayView< const T, DIM, SPACE >
 
using RealConstT = typename std::conditional< is_array_view, T, const T >::type
 
using SliceType = typename std::conditional< DIM==IdxDim, T &, typename detail::SubsliceProxy< T, DIM - IdxDim, Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > >::type >::type
 
using ConstSliceType = typename std::conditional< DIM==IdxDim, RealConstT &, typename detail::SubsliceProxy< T, DIM - IdxDim, const Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > >::type >::type
 

Public Member Functions

 ~Array ()
 
template<int LENGTH1D, typename TT = T, int TDIM = DIM>
std::enable_if< TDIM==1, axom::StackArray< TT, LENGTH1D > >::type to_stack_array () const
 Convert 1D Array into a StackArray. More...
 
template<typename... Args>
void emplace_back_device (Args &&... args)
 Inserts new element at the end of the Array. More...
 
template<typename... Args>
Array< T, DIM, SPACE, StoragePolicy >::ArrayIterator emplace (Array< T, DIM, SPACE, StoragePolicy >::ArrayIterator pos, Args &&... args)
 
AXOM_HOST_DEVICE SliceType< sizeof...(Args)> operator() (Args... args)
 Dimension-aware accessor; with N=DIM indices, returns a reference to the given value at that index. Otherwise, returns a sub-array pointed to by the given sub-index. More...
 
AXOM_HOST_DEVICE ConstSliceType< sizeof...(Args)> operator() (Args... args) 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 SliceType< 1 > operator[] (const IndexType idx)
 Scalar accessor; returns a sub-array referenced by the given sub- index, beginning at array(idx, 0...) More...
 
AXOM_HOST_DEVICE ConstSliceType< 1 > operator[] (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 SliceType< UDim > operator[] (const StackArray< IndexType, UDim > &idx)
 Dimension-aware accessor; with UDim=DIM indices, returns a reference to the given value at that index. Otherwise, returns a sub-array pointed to by the given sub-index. More...
 
AXOM_HOST_DEVICE ConstSliceType< UDim > operator[] (const StackArray< IndexType, UDim > &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...
 
void swap (ArrayBase &other)
 Swaps two ArrayBases. More...
 
AXOM_HOST_DEVICE const StackArray< IndexType, DIM > & shape () const
 Returns the dimensions of the Array. More...
 
AXOM_HOST_DEVICE const MDMapping< DIM > & mapping () const
 Returns the multidimensional mapping for the Array. More...
 
AXOM_HOST_DEVICE const StackArray< IndexType, DIM > & strides () const
 Returns the memory strides of the Array. More...
 
AXOM_HOST_DEVICE IndexType minStride () const
 Returns the minimum stride between adjacent items. More...
 
Native Storage Array Constructors
 Array ()
 Default constructor. Constructs an Array instance with no elements and default allocator ID. More...
 
template<IndexType SFINAE_DIM = DIM, MemorySpace SFINAE_SPACE = SPACE, typename std::enable_if< SFINAE_DIM==1 >::type * = nullptr>
 Array (IndexType num_elements, IndexType capacity=0, int allocator_id=axom::detail::getAllocatorID< SPACE >())
 Constructs a 1D Array instance with the given number of elements. More...
 
template<IndexType SFINAE_DIM = DIM, MemorySpace SFINAE_SPACE = SPACE, typename std::enable_if< SFINAE_DIM==1 >::type * = nullptr>
 Array (ArrayOptions::Uninitialized, IndexType num_elements, IndexType capacity=0, int allocator_id=axom::detail::getAllocatorID< SPACE >())
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
 Array (const axom::StackArray< axom::IndexType, DIM > &shape, int allocator_id=axom::detail::getAllocatorID< SPACE >())
 
 Array (const axom::StackArray< axom::IndexType, DIM > &shape, axom::ArrayStrideOrder rowOrColumn, int allocator_id=axom::detail::getAllocatorID< SPACE >())
 Construct Array with row- or column-major data ordering. More...
 
template<typename DirType = axom::IndexType>
 Array (const axom::StackArray< axom::IndexType, DIM > &shape, const axom::StackArray< DirType, DIM > &slowestDirs, int allocator_id=axom::detail::getAllocatorID< SPACE >())
 Construct Array with data ordering specifications. More...
 
template<typename... Args, typename Enable = typename std::enable_if< sizeof...(Args) == DIM && detail::all_types_are_integral<Args...>::value>::type>
 Array (Args... args)
 Generic constructor for an Array of arbitrary dimension. More...
 
template<typename... Args, typename Enable = typename std::enable_if< sizeof...(Args) == DIM && detail::all_types_are_integral<Args...>::value>::type>
 Array (ArrayOptions::Uninitialized, Args... args)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
template<int UDIM = DIM, typename Enable = typename std::enable_if<UDIM == 1>::type>
 Array (std::initializer_list< T > elems, int allocator_id=axom::detail::getAllocatorID< SPACE >())
 Initializer list constructor for a one-dimensional Array. More...
 
 Array (const Array &other)
 Copy constructor for an Array instance. More...
 
 Array (Array &&other) noexcept
 Move constructor for an Array instance. More...
 
template<typename OtherArrayType >
 Array (const ArrayBase< T, DIM, OtherArrayType > &other)
 Constructor for transferring between memory spaces. More...
 
template<typename OtherArrayType >
 Array (const ArrayBase< const T, DIM, OtherArrayType > &other)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
template<typename OtherArrayType >
 Array (const ArrayBase< T, DIM, OtherArrayType > &other, int allocator_id)
 Constructor for transferring between memory spaces, with a user- specified allocator. More...
 
template<typename OtherArrayType >
 Array (const ArrayBase< const T, DIM, OtherArrayType > &other, int allocator_id)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
Array copy and move operators
Arrayoperator= (const Array &other)
 Copy assignment operator for Array. More...
 
Arrayoperator= (Array &&other) noexcept
 Move assignment operator for Array. More...
 
template<int UDIM = DIM, typename Enable = typename std::enable_if<UDIM == 1>::type>
Arrayoperator= (std::initializer_list< T > elems)
 Initializer list assignment operator for Array. More...
 
Array element access operators
T * data ()
 Return a pointer to the array of data. More...
 
const T * data () const
 
Array methods to modify the data.
void fill (const T &value)
 Set all the values of the array. More...
 
void fill (const T &value, IndexType n, IndexType pos)
 Set a range of elements to a given value. More...
 
void set (const T *elements, IndexType n, IndexType pos)
 Modify the values of existing elements. More...
 
void assign (axom::IndexType count, const T &value)
 Set the array contents. More...
 
template<class InputIt >
void assign (InputIt first, InputIt last)
 Replaces contents with copies of objects in [first, last). More...
 
void assign (std::initializer_list< T > elems)
 Set the array contents using an initializer list. More...
 
void clear ()
 Clears the contents of the array. More...
 
void insert (IndexType pos, const T &value)
 Insert an element into the array at the given position. More...
 
ArrayIterator insert (ArrayIterator pos, const T &value)
 Insert an element into the array at the value before pos. More...
 
void insert (IndexType pos, IndexType n, const T *values)
 Insert elements into the array at the given position. More...
 
ArrayIterator insert (ArrayIterator pos, IndexType n, const T *values)
 Insert elements into the array at the value before pos. More...
 
void insert (IndexType pos, IndexType n, const T &value)
 Insert n copies of element into the array at the given position. More...
 
ArrayIterator insert (ArrayIterator pos, IndexType n, const T &value)
 Insert n copies of element into the array at the value before pos. More...
 
template<MemorySpace OtherSpace>
void insert (IndexType pos, ArrayView< const T, DIM, OtherSpace > other)
 Inserts an Array to the end of the calling object. More...
 
template<MemorySpace OtherSpace>
void insert (IndexType pos, ArrayView< T, DIM, OtherSpace > other)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
template<MemorySpace OtherSpace>
void append (ArrayView< const T, DIM, OtherSpace > other)
 Appends an Array to the end of the calling object. More...
 
template<MemorySpace OtherSpace>
void append (ArrayView< T, DIM, OtherSpace > other)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
ArrayIterator erase (ArrayIterator pos)
 Erases an element from the Array. More...
 
ArrayIterator erase (ArrayIterator first, ArrayIterator last)
 Erases elements in the range [first, last) from the Array. More...
 
template<typename... Args>
void emplace (IndexType pos, Args &&... args)
 Inserts new element into Array at the given position. More...
 
template<typename... Args>
ArrayIterator emplace (ArrayIterator pos, Args &&... args)
 Inserts new element into Array before pos. More...
 
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...
 
void pop_back ()
 Removes the last element from the Array. More...
 
void push_back_device (const T &value)
 Push a value to the back of the array. More...
 
void push_back_device (T &&value)
 
Array methods to query and set attributes
IndexType capacity () const
 Return the number of elements allocated for the data array. More...
 
void reserve (IndexType capacity)
 Increase the capacity. Does nothing if the new capacity is less than the current capacity. More...
 
ArrayIterator begin ()
 Returns an ArrayIterator to the first element of the Array. More...
 
ConstArrayIterator begin () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
ArrayIterator end ()
 Returns an ArrayIterator to the element following the last element of the Array. More...
 
ConstArrayIterator end () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
T & front ()
 Returns a reference to the first element in the Array. More...
 
const T & front () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
T & back ()
 Returns a reference to the last element in the Array. More...
 
const T & back () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
void shrink ()
 Shrink the capacity to be equal to the size. More...
 
bool empty () const
 Returns true iff the Array stores no elements. More...
 
IndexType size () const
 Return the number of elements stored in the data array. More...
 
template<typename... Args, typename Enable = typename std::enable_if< sizeof...(Args) == DIM && detail::all_types_are_integral<Args...>::value>::type>
void resize (Args... args)
 Update the number of elements stored in the data array. More...
 
template<typename... Args, typename Enable = typename std::enable_if< sizeof...(Args) == DIM && detail::all_types_are_integral<Args...>::value>::type>
void resize (ArrayOptions::Uninitialized, Args... args)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
template<int Dims = DIM, typename Enable = std::enable_if_t<Dims == 1>>
void resize (IndexType size, const T &value)
 
void resize (const StackArray< IndexType, DIM > &size, const T &value)
 
void swap (Array &other)
 Exchanges the contents of this Array with the other. More...
 
double getResizeRatio () const
 Get the ratio by which the capacity increases upon dynamic resize. More...
 
void setResizeRatio (double ratio)
 Set the ratio by which the capacity increases upon dynamic resize. More...
 
int getAllocatorID () const
 Get the ID for the umpire allocator. More...
 
void setDevicePreference (bool on_device)
 Sets the preferred space where operations on this array should be performed. More...
 
ArrayViewType view ()
 Returns a view of the array. More...
 
ConstArrayViewType view () 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...
 

Static Public Attributes

static constexpr double DEFAULT_RESIZE_RATIO = 2.0
 
static constexpr IndexType MIN_DEFAULT_CAPACITY = 32
 
static constexpr MemorySpace space = SPACE
 
constexpr static int Dims
 

Protected Member Functions

void initialize (IndexType num_elements, IndexType capacity, bool should_default_construct=true)
 Initialize an Array instance with the given number of elements. More...
 
void initialize_from_other (const T *data, IndexType num_elements, MemorySpace data_space, bool user_provided_allocator)
 Helper function for initializing an Array instance with an existing range of elements. More...
 
void resizeImpl (const StackArray< IndexType, DIM > &dims, bool construct_with_values, const T *value=nullptr)
 Updates the number of elements stored in the data array. More...
 
T * reserveForInsert (IndexType n, IndexType pos)
 Make space for a subsequent insertion into the array. More...
 
IndexType reserveForPushBack ()
 Make space for a subsequent insertion into the array. More...
 
void updateNumElements (IndexType new_num_elements)
 Update the number of elements. More...
 
void setCapacity (IndexType new_capacity)
 Set the number of elements allocated for the data array. More...
 
void dynamicRealloc (IndexType new_num_elements)
 Reallocates the data array when the size exceeds the capacity. More...
 
AXOM_HOST_DEVICE void setShape (const StackArray< IndexType, DIM > &shape_)
 Set the shape. More...
 
AXOM_SUPPRESS_HD_WARN AXOM_HOST_DEVICE void setShapeAndStride (const StackArray< IndexType, DIM > &shape, const StackArray< IndexType, DIM > &stride)
 Set the shape and stride. More...
 
IndexType blockSize () const
 Returns the minimum "chunk size" that should be allocated For example, 2 would be the chunk size of a 2D array whose second dimension is of size 2. This is used when resizing/reallocating; it wouldn't make sense to have a capacity of 3 in the array described above. More...
 
AXOM_HOST_DEVICE void updateStrides (int min_stride=1)
 Updates the internal striding information to a row-major format Intended to be called after shape is updated. More...
 
void updateShapeOnInsert (const StackArray< IndexType, DIM > &range_shape)
 Updates the internal dimensions and striding based on the insertion of a range of elements. Intended to be called after the insertion of a multidimensional subslice. More...
 
template<int Dims>
void onShapeUpdate (StackArray< IndexType, Dims >)
 Callback to report changes in shape of data in Array. More...
 
template<typename Func >
T * reallocate (T *old_data, int, int allocator_id, int new_capacity, Func &&nontrivial_move)
 Reallocates a buffer. More...
 
void deallocate (T *data)
 Frees a buffer. More...
 

Protected Attributes

T * m_data = nullptr
 
IndexType m_num_elements = 0
 The full number of elements in the array i.e., 3 for a 1D Array of size 3, 9 for a 3x3 2D array, etc. More...
 
IndexType m_capacity = 0
 
double m_resize_ratio = DEFAULT_RESIZE_RATIO
 
int m_allocator_id = INVALID_ALLOCATOR_ID
 
bool m_executeOnGPU = false
 
OpHelper m_arrayOps
 
StackArray< IndexType, DIM > m_shape
 The extent in each direction. More...
 
MDMapping< DIM > m_mapping
 For converting between multidim indices and offset. More...
 
IndexType m_minStride
 Cached value for optimization. More...
 

Detailed Description

template<typename T, int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
class axom::Array< T, DIM, SPACE, StoragePolicy >

Provides a generic multidimensional array container.

The Array class provides a generic multidimensional array container with dynamic reallocation and insertion. The dimensionality of the array must be known at compile time but the extents in each dimension are dynamic and can be changed at runtime. Array elements are stored contiguously.

Note
For a multi-component array container, where each element is a tuple of 1 or more components, Axom provides the MCArray alias, which corresponds to Array<T, 2>.

The Array class mirrors std::vector, with future support for GPUs in-development. The class's multidimensional array functionality roughly mirrors the multidimensional array support provided by numpy's ndarray.

See also
https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html

Some interfaces accomodate data ordering specifications. Unless otherwise specified, data storage defaults to row-major.

This class is meant to be a drop-in replacement for std::vector. However, it differs in its memory management and construction semantics. Specifically, we do not require axom::Array to initialize/construct its memory at allocation time and we use axom's memory_management and allocator ID abstractions rather than std::allocator.

Array always retains exclusive ownership of its data and is responsible for freeing its memory.

See also
ArrayView for non-owning views of one- or multi-dimensional data Depending on which constructor is used, the Array object can have two different underlying storage types:
Template Parameters
Tthe type of the values to hold.
DIMThe dimension of the array.
SPACEThe memory space of the array.
Precondition
T must be CopyAssignable and Erasable
See also
https://en.cppreference.com/w/cpp/named_req
Precondition
When Array is allocated on the device, T must be relocatable, i.e. moving the object to a new index and destroying the original should be equivalent to a memcpy.
See also
https://github.com/facebook/folly/blob/main/folly/docs/FBVector.md#object-relocation

Member Typedef Documentation

◆ value_type

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
using axom::Array< T, DIM, SPACE, StoragePolicy >::value_type = T

◆ ArrayIterator

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
using axom::Array< T, DIM, SPACE, StoragePolicy >::ArrayIterator = ArrayIteratorBase<Array<T, DIM, SPACE, StoragePolicy>, T>

◆ ConstArrayIterator

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
using axom::Array< T, DIM, SPACE, StoragePolicy >::ConstArrayIterator = ArrayIteratorBase<const Array<T, DIM, SPACE, StoragePolicy>, const T>

◆ ArrayViewType

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
using axom::Array< T, DIM, SPACE, StoragePolicy >::ArrayViewType = ArrayView<T, DIM, SPACE>

◆ ConstArrayViewType

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
using axom::Array< T, DIM, SPACE, StoragePolicy >::ConstArrayViewType = ArrayView<const T, DIM, SPACE>

◆ RealConstT

using axom::ArrayBase< T, DIM, Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > >::RealConstT = typename std::conditional<is_array_view, T, const T>::type
inherited

◆ SliceType

using axom::ArrayBase< T, DIM, Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > >::SliceType = typename std::conditional<DIM == IdxDim, T&, typename detail::SubsliceProxy<T, DIM - IdxDim, Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > >::type>::type
inherited

◆ ConstSliceType

using axom::ArrayBase< T, DIM, Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > >::ConstSliceType = typename std::conditional<DIM == IdxDim, RealConstT&, typename detail::SubsliceProxy<T, DIM - IdxDim, const Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > >::type>::type
inherited

Constructor & Destructor Documentation

◆ Array() [1/15]

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
axom::Array< T, DIM, SPACE, StoragePolicy >::Array

Default constructor. Constructs an Array instance with no elements and default allocator ID.

◆ Array() [2/15]

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
template<IndexType SFINAE_DIM, MemorySpace SFINAE_SPACE, typename std::enable_if< SFINAE_DIM==1 >::type * >
axom::Array< T, DIM, SPACE, StoragePolicy >::Array ( IndexType  num_elements,
IndexType  capacity = 0,
int  allocator_id = axom::detail::getAllocatorID<SPACE>() 
)

Constructs a 1D Array instance with the given number of elements.

Parameters
[in]num_elementsthe number of elements the Array holds.
[in]capacitythe number of elements to allocate space for.
[in]allocator_idthe ID of the allocator to use (optional)
Note
If no capacity or capacity less than num_elements is specified then it will default to at least num_elements * DEFAULT_RESIZE_RATIO.
a capacity is specified for the number of elements to store in the array and does not correspond to the actual bytesize.
The option to select a capacity is only available for 1-dimensional Arrays
Some overloads have an ArrayOptions::Uninitialized first parameter. These are intended for cases where the array data should not be initialized when memory is allocated, e.g. if the code is known to initialize the data
Precondition
num_elements >= 0
Postcondition
capacity() >= size()
size() == num_elements
getResizeRatio() == DEFAULT_RESIZE_RATIO

References axom::Array< T, DIM, SPACE, StoragePolicy >::capacity(), axom::Dynamic, axom::detail::getAllocatorSpace(), axom::Array< T, DIM, SPACE, StoragePolicy >::initialize(), axom::Array< T, DIM, SPACE, StoragePolicy >::m_allocator_id, axom::Array< T, DIM, SPACE, StoragePolicy >::m_arrayOps, and axom::Array< T, DIM, SPACE, StoragePolicy >::m_executeOnGPU.

◆ Array() [3/15]

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
template<IndexType SFINAE_DIM, MemorySpace SFINAE_SPACE, typename std::enable_if< SFINAE_DIM==1 >::type * >
axom::Array< T, DIM, SPACE, StoragePolicy >::Array ( ArrayOptions::Uninitialized  ,
IndexType  num_elements,
IndexType  capacity = 0,
int  allocator_id = axom::detail::getAllocatorID<SPACE>() 
)

◆ Array() [4/15]

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
axom::Array< T, DIM, SPACE, StoragePolicy >::Array ( const axom::StackArray< axom::IndexType, DIM > &  shape,
int  allocator_id = axom::detail::getAllocatorID<SPACE>() 
)

◆ Array() [5/15]

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
axom::Array< T, DIM, SPACE, StoragePolicy >::Array ( const axom::StackArray< axom::IndexType, DIM > &  shape,
axom::ArrayStrideOrder  rowOrColumn,
int  allocator_id = axom::detail::getAllocatorID<SPACE>() 
)

Construct Array with row- or column-major data ordering.

Precondition
rowOrColumn must be either ArrayStrideOrder::ROW or ArrayStrideOrder::COLUMN (or, if DIM is 1, ArrayStrideOrder::BOTH).

References axom::ArrayBase< T, 1, Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > >::shape().

◆ Array() [6/15]

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
template<typename DirType >
axom::Array< T, DIM, SPACE, StoragePolicy >::Array ( const axom::StackArray< axom::IndexType, DIM > &  shape,
const axom::StackArray< DirType, DIM > &  slowestDirs,
int  allocator_id = axom::detail::getAllocatorID<SPACE>() 
)

Construct Array with data ordering specifications.

Example of 3D Array where j is slowest and i is fastest: Array<3, int> ar( shape, axom::StackArray<axom::IndexType, DIM>{2, 0, 1});

Precondition
slowestDirs must be a permutation of [0 ... DIM-1]

References axom::ArrayBase< T, 1, Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > >::shape().

◆ Array() [7/15]

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
template<typename... Args, typename Enable >
axom::Array< T, DIM, SPACE, StoragePolicy >::Array ( Args...  args)

Generic constructor for an Array of arbitrary dimension.

Parameters
[in]argsThe parameter pack containing the "shape" of the Array
See also
https://numpy.org/doc/stable/reference/generated/numpy.empty.html#numpy.empty
Precondition
sizeof...(Args) == DIM
Postcondition
capacity() >= size()
size() == num_elements
getResizeRatio() == DEFAULT_RESIZE_RATIO

◆ Array() [8/15]

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
template<typename... Args, typename Enable >
axom::Array< T, DIM, SPACE, StoragePolicy >::Array ( ArrayOptions::Uninitialized  ,
Args...  args 
)

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

◆ Array() [9/15]

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
template<int UDIM, typename Enable >
axom::Array< T, DIM, SPACE, StoragePolicy >::Array ( std::initializer_list< T >  elems,
int  allocator_id = axom::detail::getAllocatorID<SPACE>() 
)

Initializer list constructor for a one-dimensional Array.

Parameters
[in]elemsThe elements to initialize the array with
[in]allocator_idthe ID of the allocator to use (optional)

References axom::Dynamic, and axom::Array< T, DIM, SPACE, StoragePolicy >::initialize_from_other().

◆ Array() [10/15]

◆ Array() [11/15]

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
axom::Array< T, DIM, SPACE, StoragePolicy >::Array ( Array< T, DIM, SPACE, StoragePolicy > &&  other)
noexcept

Move constructor for an Array instance.

References axom::INVALID_ALLOCATOR_ID, and axom::isDeviceAllocator().

◆ Array() [12/15]

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
template<typename OtherArrayType >
axom::Array< T, DIM, SPACE, StoragePolicy >::Array ( const ArrayBase< T, DIM, OtherArrayType > &  other)

Constructor for transferring between memory spaces.

Parameters
[in]otherThe array in a different memory space to copy from
Note
The new Array will be constructed with the allocator ID of the copied-from array, if compatible with the memory space of the target array. Otherwise, the new Array will be constructed with the default allocator for the memory space.

An Array specified with the default Dynamic memory space will always propagate the allocator ID from the source array.

References axom::Array< T, DIM, SPACE, StoragePolicy >::data(), axom::detail::getAllocatorSpace(), axom::Array< T, DIM, SPACE, StoragePolicy >::initialize_from_other(), axom::Array< T, DIM, SPACE, StoragePolicy >::m_allocator_id, and axom::Array< T, DIM, SPACE, StoragePolicy >::size().

◆ Array() [13/15]

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
template<typename OtherArrayType >
axom::Array< T, DIM, SPACE, StoragePolicy >::Array ( const ArrayBase< const T, DIM, OtherArrayType > &  other)

◆ Array() [14/15]

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
template<typename OtherArrayType >
axom::Array< T, DIM, SPACE, StoragePolicy >::Array ( const ArrayBase< T, DIM, OtherArrayType > &  other,
int  allocator_id 
)

Constructor for transferring between memory spaces, with a user- specified allocator.

Parameters
[in]otherThe array in a different memory space to copy from
[in]allocator_idthe ID of the allocator to use
Note
The specified allocator ID must be compatible with the memory space of the new Array.

References axom::Array< T, DIM, SPACE, StoragePolicy >::data(), axom::Array< T, DIM, SPACE, StoragePolicy >::getAllocatorID(), axom::detail::getAllocatorSpace(), axom::Array< T, DIM, SPACE, StoragePolicy >::initialize_from_other(), and axom::Array< T, DIM, SPACE, StoragePolicy >::size().

◆ Array() [15/15]

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
template<typename OtherArrayType >
axom::Array< T, DIM, SPACE, StoragePolicy >::Array ( const ArrayBase< const T, DIM, OtherArrayType > &  other,
int  allocator_id 
)

◆ ~Array()

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
axom::Array< T, DIM, SPACE, StoragePolicy >::~Array

Destructor. Frees the associated buffer.

References axom::deallocate().

Member Function Documentation

◆ operator=() [1/3]

◆ operator=() [2/3]

◆ operator=() [3/3]

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
template<int UDIM = DIM, typename Enable = typename std::enable_if<UDIM == 1>::type>
Array& axom::Array< T, DIM, SPACE, StoragePolicy >::operator= ( std::initializer_list< T >  elems)
inline

Initializer list assignment operator for Array.

Parameters
[in]elemsthe elements to set the array to.

References axom::Array< T, DIM, SPACE, StoragePolicy >::clear(), and axom::Array< T, DIM, SPACE, StoragePolicy >::insert().

◆ data() [1/2]

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
T* axom::Array< T, DIM, SPACE, StoragePolicy >::data ( )
inline

Return a pointer to the array of data.

References axom::Array< T, DIM, SPACE, StoragePolicy >::m_data.

◆ data() [2/2]

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
const T* axom::Array< T, DIM, SPACE, StoragePolicy >::data ( ) const
inline

◆ to_stack_array()

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
template<int LENGTH1D, typename TT = T, int TDIM = DIM>
std::enable_if<TDIM == 1, axom::StackArray<TT, LENGTH1D> >::type axom::Array< T, DIM, SPACE, StoragePolicy >::to_stack_array ( ) const
inline

◆ fill() [1/2]

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
void axom::Array< T, DIM, SPACE, StoragePolicy >::fill ( const T &  value)
inline

Set all the values of the array.

Parameters
[in]valuethe value to set to.

◆ fill() [2/2]

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
void axom::Array< T, DIM, SPACE, StoragePolicy >::fill ( const T &  value,
IndexType  n,
IndexType  pos 
)
inline

Set a range of elements to a given value.

Parameters
[in]valuethe value to set to.
[in]nthe number of elements to write.
[in]posthe position at which to begin writing.
Note
The size is unchanged by calls to fill.
Precondition
pos + n <= m_num_elements.

◆ set()

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
void axom::Array< T, DIM, SPACE, StoragePolicy >::set ( const T *  elements,
IndexType  n,
IndexType  pos 
)
inline

Modify the values of existing elements.

Parameters
[in]elementsthe new elements to write.
[in]nthe number of elements to write.
[in]posthe position at which to begin writing.
Note
It's assumed that elements is of length n.
The size is unchanged by calls to set.
Precondition
pos + n <= m_num_elements.

References axom::Dynamic.

◆ assign() [1/3]

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
void axom::Array< T, DIM, SPACE, StoragePolicy >::assign ( axom::IndexType  count,
const T &  value 
)
inline

Set the array contents.

Parameters
[in]countThe new number of elements.
[in]valueThe value to store in the elements.
Postcondition
Size of Array is count, all elements contain value.

◆ assign() [2/3]

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
template<class InputIt >
void axom::Array< T, DIM, SPACE, StoragePolicy >::assign ( InputIt  first,
InputIt  last 
)
inline

Replaces contents with copies of objects in [first, last).

Parameters
[in]firstThe iterator for the first value to use in a container.
[in]lastThe last iterator to use in a container.
Postcondition
Size of Array is changed to the number of items in the range designated by the iterators (last-first), and values referenced by the iterator range are copied into the Array.

References axom::Array< T, DIM, SPACE, StoragePolicy >::data(), axom::Dynamic, axom::Array< T, DIM, SPACE, StoragePolicy >::push_back(), and axom::Array< T, DIM, SPACE, StoragePolicy >::size().

◆ assign() [3/3]

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
void axom::Array< T, DIM, SPACE, StoragePolicy >::assign ( std::initializer_list< T >  elems)
inline

Set the array contents using an initializer list.

Parameters
[in]elemsAn initializer list containing the new array values.
Postcondition
The Array contains copies of the initializer list elements.

References axom::Dynamic.

◆ clear()

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
void axom::Array< T, DIM, SPACE, StoragePolicy >::clear
inline

Clears the contents of the array.

Postcondition
size of Array is 0
capacity is unchanged

◆ insert() [1/8]

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
void axom::Array< T, DIM, SPACE, StoragePolicy >::insert ( IndexType  pos,
const T &  value 
)
inline

Insert an element into the array at the given position.

Parameters
[in]posthe position at which to insert.
[in]valuethe element value to insert.
Note
Reallocation is done if the new size will exceed the capacity.
The size increases by 1.

◆ insert() [2/8]

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
ArrayIterator axom::Array< T, DIM, SPACE, StoragePolicy >::insert ( ArrayIterator  pos,
const T &  value 
)

Insert an element into the array at the value before pos.

Parameters
[in]posthe ArrayIterator before which value will be inserted.
[in]valuethe element value to insert.
Note
Reallocation is done if the new size will exceed the capacity.
The size increases by 1.
Returns
ArrayIterator to inserted value

◆ insert() [3/8]

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
void axom::Array< T, DIM, SPACE, StoragePolicy >::insert ( IndexType  pos,
IndexType  n,
const T *  values 
)
inline

Insert elements into the array at the given position.

Parameters
[in]posthe position at which to begin the insertion.
[in]nthe number of elements to insert.
[in]valuesthe element values to insert.
Note
It's assumed that elements is of length n.
Reallocation is done if the new size will exceed the capacity.
The size increases by n.
Precondition
pos <= m_num_elements.

References axom::Dynamic.

◆ insert() [4/8]

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
ArrayIterator axom::Array< T, DIM, SPACE, StoragePolicy >::insert ( ArrayIterator  pos,
IndexType  n,
const T *  values 
)

Insert elements into the array at the value before pos.

Parameters
[in]posthe ArrayIterator before which value will be inserted.
[in]nthe number of elements to insert.
[in]valuesthe element values to insert.
Note
It's assumed that elements is of length n.
Reallocation is done if the new size will exceed the capacity.
The size increases by n.
Precondition
pos <= end()
Returns
ArrayIterator to first element inserted (pos if n == 0)

◆ insert() [5/8]

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
void axom::Array< T, DIM, SPACE, StoragePolicy >::insert ( IndexType  pos,
IndexType  n,
const T &  value 
)
inline

Insert n copies of element into the array at the given position.

Parameters
[in]posthe position at which to begin the insertion.
[in]nthe number of elements to insert.
[in]valuethe element value to insert.
Note
Reallocation is done if the new size will exceed the capacity.
The size increases by n.
This method is used to create space for elements in the middle of the array.
Precondition
pos <= m_num_elements.

◆ insert() [6/8]

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
ArrayIterator axom::Array< T, DIM, SPACE, StoragePolicy >::insert ( ArrayIterator  pos,
IndexType  n,
const T &  value 
)

Insert n copies of element into the array at the value before pos.

Parameters
[in]posthe ArrayIterator before which value will be inserted.
[in]nthe number of elements to insert.
[in]valuethe element value to insert.
Note
Reallocation is done if the new size will exceed the capacity.
The size increases by n.
This method is used to create space for elements in the middle of the array.
Precondition
pos <= end()
Returns
ArrayIterator to first element inserted (pos if n == 0)

◆ insert() [7/8]

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
template<MemorySpace OtherSpace>
void axom::Array< T, DIM, SPACE, StoragePolicy >::insert ( IndexType  pos,
ArrayView< const T, DIM, OtherSpace >  other 
)
inline

Inserts an Array to the end of the calling object.

Parameters
[in]otherThe Array to append
Precondition
The shapes of the calling Array and other are the same (excluding the leading dimension), i.e., shape()[1:] == other.shape()[1:]
Note
Reallocation is done if the new size will exceed the capacity.

References axom::ArrayView< T, DIM, SPACE >::data(), axom::ArrayBase< T, DIM, ArrayType >::shape(), and axom::ArrayView< T, DIM, SPACE >::size().

◆ insert() [8/8]

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
template<MemorySpace OtherSpace>
void axom::Array< T, DIM, SPACE, StoragePolicy >::insert ( IndexType  pos,
ArrayView< T, DIM, OtherSpace >  other 
)
inline

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

References axom::Array< T, DIM, SPACE, StoragePolicy >::insert().

◆ append() [1/2]

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
template<MemorySpace OtherSpace>
void axom::Array< T, DIM, SPACE, StoragePolicy >::append ( ArrayView< const T, DIM, OtherSpace >  other)
inline

Appends an Array to the end of the calling object.

Parameters
[in]otherThe Array to append
Template Parameters
OtherArrayTypeThe underlying type of the other array
Note
Reallocation is done if the new size will exceed the capacity.

References axom::Array< T, DIM, SPACE, StoragePolicy >::insert(), and axom::Array< T, DIM, SPACE, StoragePolicy >::size().

◆ append() [2/2]

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
template<MemorySpace OtherSpace>
void axom::Array< T, DIM, SPACE, StoragePolicy >::append ( ArrayView< T, DIM, OtherSpace >  other)
inline

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

References axom::Array< T, DIM, SPACE, StoragePolicy >::insert(), and axom::Array< T, DIM, SPACE, StoragePolicy >::size().

◆ erase() [1/2]

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
ArrayIterator axom::Array< T, DIM, SPACE, StoragePolicy >::erase ( ArrayIterator  pos)

Erases an element from the Array.

Parameters
[in]posthe ArrayIterator to the element in the Array
Returns
An ArrayIterator following the last element removed.

◆ erase() [2/2]

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
ArrayIterator axom::Array< T, DIM, SPACE, StoragePolicy >::erase ( ArrayIterator  first,
ArrayIterator  last 
)

Erases elements in the range [first, last) from the Array.

Parameters
[in]firstthe ArrayIterator to the beginning of the range.
[in]lastthe ArrayIterator to end of range.
Returns
An ArrayIterator following the last element removed.

◆ emplace() [1/3]

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
template<typename... Args>
void axom::Array< T, DIM, SPACE, StoragePolicy >::emplace ( IndexType  pos,
Args &&...  args 
)
inline

Inserts new element into Array at the given position.

Parameters
[in]posthe position to insert element at.
[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.
Precondition
T must be MoveAssignable

◆ emplace() [2/3]

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
template<typename... Args>
ArrayIterator axom::Array< T, DIM, SPACE, StoragePolicy >::emplace ( ArrayIterator  pos,
Args &&...  args 
)

Inserts new element into Array before pos.

Parameters
[in]posthe ArrayIterator to insert element before.
[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.
Precondition
T must be MoveAssignable
Returns
An ArrayIterator to the emplaced element.

◆ push_back() [1/2]

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
void axom::Array< T, DIM, SPACE, StoragePolicy >::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.
Precondition
DIM == 1

◆ push_back() [2/2]

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
void axom::Array< T, DIM, SPACE, StoragePolicy >::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.
Precondition
DIM == 1

◆ emplace_back()

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
template<typename... Args>
void axom::Array< T, DIM, SPACE, StoragePolicy >::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.
Precondition
DIM == 1

◆ pop_back()

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
void axom::Array< T, DIM, SPACE, StoragePolicy >::pop_back
inline

Removes the last element from the Array.

Note
The size decreases by 1 and the capacity is unchanged.
Precondition
DIM == 1
array.empty() == false

◆ push_back_device() [1/2]

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
void axom::Array< T, DIM, SPACE, StoragePolicy >::push_back_device ( const 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.
If used in a device kernel, the number of push_backs must not exceed the capacity, since device-side reallocations aren't supported.
Array must be allocated in unified memory if calling on the device.
Precondition
DIM == 1

◆ push_back_device() [2/2]

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
void axom::Array< T, DIM, SPACE, StoragePolicy >::push_back_device ( T &&  value)
inline

◆ emplace_back_device()

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
template<typename... Args>
void axom::Array< T, DIM, SPACE, StoragePolicy >::emplace_back_device ( 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.
If used in a device kernel, the number of push_backs must not exceed the capacity, since device-side reallocations aren't supported.
Array must be allocated in unified memory if calling on the device.
Precondition
DIM == 1

◆ capacity()

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
IndexType axom::Array< T, DIM, SPACE, StoragePolicy >::capacity ( ) const
inline

Return the number of elements allocated for the data array.

References axom::Array< T, DIM, SPACE, StoragePolicy >::m_capacity.

◆ reserve()

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
void axom::Array< T, DIM, SPACE, StoragePolicy >::reserve ( IndexType  capacity)
inline

Increase the capacity. Does nothing if the new capacity is less than the current capacity.

Parameters
[in]capacitythe new number of elements to allocate.

References axom::Array< T, DIM, SPACE, StoragePolicy >::capacity(), axom::Array< T, DIM, SPACE, StoragePolicy >::m_capacity, and axom::Array< T, DIM, SPACE, StoragePolicy >::setCapacity().

◆ begin() [1/2]

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
ArrayIterator axom::Array< T, DIM, SPACE, StoragePolicy >::begin ( )
inline

Returns an ArrayIterator to the first element of the Array.

◆ begin() [2/2]

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
ConstArrayIterator axom::Array< T, DIM, SPACE, StoragePolicy >::begin ( ) const
inline

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

◆ end() [1/2]

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
ArrayIterator axom::Array< T, DIM, SPACE, StoragePolicy >::end ( )
inline

Returns an ArrayIterator to the element following the last element of the Array.

References axom::Array< T, DIM, SPACE, StoragePolicy >::size().

◆ end() [2/2]

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
ConstArrayIterator axom::Array< T, DIM, SPACE, StoragePolicy >::end ( ) const
inline

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

References axom::Array< T, DIM, SPACE, StoragePolicy >::size().

◆ front() [1/2]

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
T& axom::Array< T, DIM, SPACE, StoragePolicy >::front ( )
inline

Returns a reference to the first element in the Array.

Precondition
array.empty() == false

References axom::Array< T, DIM, SPACE, StoragePolicy >::begin(), and axom::Array< T, DIM, SPACE, StoragePolicy >::empty().

◆ front() [2/2]

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
const T& axom::Array< T, DIM, SPACE, StoragePolicy >::front ( ) const
inline

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

References axom::Array< T, DIM, SPACE, StoragePolicy >::begin(), and axom::Array< T, DIM, SPACE, StoragePolicy >::empty().

◆ back() [1/2]

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
T& axom::Array< T, DIM, SPACE, StoragePolicy >::back ( )
inline

Returns a reference to the last element in the Array.

Precondition
array.size() > 0

References axom::Array< T, DIM, SPACE, StoragePolicy >::empty(), and axom::Array< T, DIM, SPACE, StoragePolicy >::end().

◆ back() [2/2]

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
const T& axom::Array< T, DIM, SPACE, StoragePolicy >::back ( ) const
inline

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

References axom::Array< T, DIM, SPACE, StoragePolicy >::empty(), and axom::Array< T, DIM, SPACE, StoragePolicy >::end().

◆ shrink()

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
void axom::Array< T, DIM, SPACE, StoragePolicy >::shrink ( )
inline

◆ empty()

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
bool axom::Array< T, DIM, SPACE, StoragePolicy >::empty ( ) const
inline

Returns true iff the Array stores no elements.

Note
If the Array is empty the capacity can still be greater than zero.

References axom::Array< T, DIM, SPACE, StoragePolicy >::m_num_elements.

◆ size()

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
IndexType axom::Array< T, DIM, SPACE, StoragePolicy >::size ( ) const
inline

Return the number of elements stored in the data array.

References axom::Array< T, DIM, SPACE, StoragePolicy >::m_num_elements.

◆ resize() [1/4]

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
template<typename... Args, typename Enable = typename std::enable_if< sizeof...(Args) == DIM && detail::all_types_are_integral<Args...>::value>::type>
void axom::Array< T, DIM, SPACE, StoragePolicy >::resize ( Args...  args)
inline

Update the number of elements stored in the data array.

Note
Reallocation is done if the new size will exceed the capacity.

References axom::Array< T, DIM, SPACE, StoragePolicy >::resizeImpl().

◆ resize() [2/4]

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
template<typename... Args, typename Enable = typename std::enable_if< sizeof...(Args) == DIM && detail::all_types_are_integral<Args...>::value>::type>
void axom::Array< T, DIM, SPACE, StoragePolicy >::resize ( ArrayOptions::Uninitialized  ,
Args...  args 
)
inline

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

References axom::Array< T, DIM, SPACE, StoragePolicy >::resizeImpl().

◆ resize() [3/4]

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
template<int Dims = DIM, typename Enable = std::enable_if_t<Dims == 1>>
void axom::Array< T, DIM, SPACE, StoragePolicy >::resize ( IndexType  size,
const T &  value 
)
inline

◆ resize() [4/4]

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
void axom::Array< T, DIM, SPACE, StoragePolicy >::resize ( const StackArray< IndexType, DIM > &  size,
const T &  value 
)
inline

◆ swap() [1/2]

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
void axom::Array< T, DIM, SPACE, StoragePolicy >::swap ( Array< T, DIM, SPACE, StoragePolicy > &  other)
inline

◆ getResizeRatio()

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
double axom::Array< T, DIM, SPACE, StoragePolicy >::getResizeRatio ( ) const
inline

Get the ratio by which the capacity increases upon dynamic resize.

References axom::Array< T, DIM, SPACE, StoragePolicy >::m_resize_ratio.

◆ setResizeRatio()

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
void axom::Array< T, DIM, SPACE, StoragePolicy >::setResizeRatio ( double  ratio)
inline

Set the ratio by which the capacity increases upon dynamic resize.

Parameters
[in]ratiothe new resize ratio.

References axom::Array< T, DIM, SPACE, StoragePolicy >::m_resize_ratio.

◆ getAllocatorID()

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
int axom::Array< T, DIM, SPACE, StoragePolicy >::getAllocatorID ( ) const
inline

Get the ID for the umpire allocator.

References axom::Array< T, DIM, SPACE, StoragePolicy >::m_allocator_id.

◆ setDevicePreference()

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
void axom::Array< T, DIM, SPACE, StoragePolicy >::setDevicePreference ( bool  on_device)
inline

Sets the preferred space where operations on this array should be performed.

This option only has an effect for memory which is both accessible on the CPU and the GPU. For CUDA this is the Unified and Pinned memory spaces, while for HIP this is the Unified, Pinned, and Device memory spaces.

References axom::Array< T, DIM, SPACE, StoragePolicy >::m_executeOnGPU.

◆ view() [1/2]

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
ArrayViewType axom::Array< T, DIM, SPACE, StoragePolicy >::view ( )
inline

Returns a view of the array.

See also
ArrayView

◆ view() [2/2]

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
ConstArrayViewType axom::Array< T, DIM, SPACE, StoragePolicy >::view ( ) const
inline

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

◆ initialize()

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
void axom::Array< T, DIM, SPACE, StoragePolicy >::initialize ( IndexType  num_elements,
IndexType  capacity,
bool  should_default_construct = true 
)
inlineprotected

Initialize an Array instance with the given number of elements.

Parameters
[in]num_elementsthe number of elements the Array holds.
[in]capacitythe number of elements to allocate space for.
[in]should_default_constructwhether to create default-constructed objects in the region [0, num_elements). Defaults to true.
Note
If no capacity or capacity less than num_elements is specified then it will default to at least num_elements * DEFAULT_RESIZE_RATIO.
a capacity is specified for the number of elements to store in the array and does not correspond to the actual bytesize.
Precondition
num_elements >= 0
Postcondition
capacity() >= size()
size() == num_elements
getResizeRatio() == DEFAULT_RESIZE_RATIO

References axom::isDeviceAllocator().

◆ initialize_from_other()

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
void axom::Array< T, DIM, SPACE, StoragePolicy >::initialize_from_other ( const T *  data,
IndexType  num_elements,
MemorySpace  data_space,
bool  user_provided_allocator 
)
inlineprotected

Helper function for initializing an Array instance with an existing range of elements.

Parameters
[in]datapointer to the existing array of elements
[in]num_elementsthe number of elements in the existing array
[in]data_spacethe memory space in which data has been allocated
[in]user_provided_allocatortrue if the Array's allocator ID was provided by the user

References axom::Dynamic, axom::detail::getAllocatorSpace(), and axom::isDeviceAllocator().

◆ resizeImpl()

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
void axom::Array< T, DIM, SPACE, StoragePolicy >::resizeImpl ( const StackArray< IndexType, DIM > &  dims,
bool  construct_with_values,
const T *  value = nullptr 
)
inlineprotected

Updates the number of elements stored in the data array.

Parameters
[in]dimsthe number of elements to allocate in each dimension
[in]construct_with_valuesif true, sets new elements in the array to a specified value
[in]valuepointer to the value to fill new elements in the array with. If null, will default-construct elements in place.

References axom::detail::allNonNegative(), axom::StackArray< T, N >::m_data, and axom::detail::packProduct().

◆ reserveForInsert()

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
T * axom::Array< T, DIM, SPACE, StoragePolicy >::reserveForInsert ( IndexType  n,
IndexType  pos 
)
inlineprotected

Make space for a subsequent insertion into the array.

Parameters
[in]nthe number of elements to insert.
[in]posthe position at which to begin the insertion.
Returns
a pointer to the beginning of the insertion space.
Note
Reallocation is done if the new size will exceed the capacity.

◆ reserveForPushBack()

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
IndexType axom::Array< T, DIM, SPACE, StoragePolicy >::reserveForPushBack
inlineprotected

Make space for a subsequent insertion into the array.

Note
This version supports concurrent GPU insertions.
Reallocation is not supported on the GPU.

References axom::slic::abort(), AXOM_UNLIKELY, and axom::utilities::annotations::end().

◆ updateNumElements()

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
void axom::Array< T, DIM, SPACE, StoragePolicy >::updateNumElements ( IndexType  new_num_elements)
inlineprotected

Update the number of elements.

Parameters
[in]new_num_elementsthe new number of elements.

◆ setCapacity()

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
void axom::Array< T, DIM, SPACE, StoragePolicy >::setCapacity ( IndexType  new_capacity)
inlineprotected

Set the number of elements allocated for the data array.

Parameters
[in]capacitythe new number of elements to allocate.

References axom::reallocate().

◆ dynamicRealloc()

template<typename T , int DIM, MemorySpace SPACE, typename StoragePolicy >
void axom::Array< T, DIM, SPACE, StoragePolicy >::dynamicRealloc ( IndexType  new_num_elements)
inlineprotected

Reallocates the data array when the size exceeds the capacity.

Parameters
[in]new_num_elementsthe number of elements which exceeds the current capacity.

References axom::utilities::processAbort().

◆ emplace() [3/3]

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
template<typename... Args>
Array<T, DIM, SPACE, StoragePolicy>::ArrayIterator axom::Array< T, DIM, SPACE, StoragePolicy >::emplace ( Array< T, DIM, SPACE, StoragePolicy >::ArrayIterator  pos,
Args &&...  args 
)
inline

◆ operator()() [1/2]

AXOM_HOST_DEVICE SliceType<sizeof...(Args)> axom::ArrayBase< T, DIM, Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > >::operator() ( Args...  args)
inlineinherited

Dimension-aware accessor; with N=DIM indices, returns a reference to the given value at that index. Otherwise, returns a sub-array pointed to by the given sub-index.

Parameters
[in]argsthe parameter pack of indices in each dimension.
Note
equivalent to *(array.data() + idx).
Precondition
sizeof...(Args) <= DIM
0 <= args[i] < shape()[i] for i in [0, sizeof...(Args))

◆ operator()() [2/2]

AXOM_HOST_DEVICE ConstSliceType<sizeof...(Args)> axom::ArrayBase< T, DIM, Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > >::operator() ( Args...  args) const
inlineinherited

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

◆ operator[]() [1/4]

AXOM_HOST_DEVICE SliceType<1> axom::ArrayBase< T, DIM, Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > >::operator[] ( const IndexType  idx)
inlineinherited

Scalar accessor; returns a sub-array referenced by the given sub- index, beginning at array(idx, 0...)

Parameters
[in]idxthe index of the first dimension.
Precondition
0 <= idx < shape()[0]

◆ operator[]() [2/4]

AXOM_HOST_DEVICE ConstSliceType<1> axom::ArrayBase< T, DIM, Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > >::operator[] ( const IndexType  idx) const
inlineinherited

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

◆ operator[]() [3/4]

AXOM_HOST_DEVICE SliceType<UDim> axom::ArrayBase< T, DIM, Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > >::operator[] ( const StackArray< IndexType, UDim > &  idx)
inlineinherited

Dimension-aware accessor; with UDim=DIM indices, returns a reference to the given value at that index. Otherwise, returns a sub-array pointed to by the given sub-index.

Parameters
[in]argsa stack array of indices in each dimension.
Note
equivalent to *(array.data() + idx).
Precondition
UDim <= DIM
0 <= args[i] < shape()[i] for i in [0, UDim)

◆ operator[]() [4/4]

AXOM_HOST_DEVICE ConstSliceType<UDim> axom::ArrayBase< T, DIM, Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > >::operator[] ( const StackArray< IndexType, UDim > &  idx) const
inlineinherited

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]

AXOM_HOST_DEVICE T& axom::ArrayBase< T, DIM, Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > >::flatIndex ( const IndexType  idx)
inlineinherited

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 * minStride()).
Precondition
0 <= idx < asDerived().size()

◆ flatIndex() [2/2]

AXOM_HOST_DEVICE RealConstT& axom::ArrayBase< T, DIM, Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > >::flatIndex ( const IndexType  idx) const
inlineinherited

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

◆ swap() [2/2]

void axom::ArrayBase< T, DIM, Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > >::swap ( ArrayBase< T, 1, Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > > &  other)
inlineinherited

Swaps two ArrayBases.

◆ shape()

AXOM_HOST_DEVICE const StackArray<IndexType, DIM>& axom::ArrayBase< T, DIM, Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > >::shape ( ) const
inlineinherited

Returns the dimensions of the Array.

◆ mapping()

AXOM_HOST_DEVICE const MDMapping<DIM>& axom::ArrayBase< T, DIM, Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > >::mapping ( ) const
inlineinherited

Returns the multidimensional mapping for the Array.

◆ strides()

AXOM_HOST_DEVICE const StackArray<IndexType, DIM>& axom::ArrayBase< T, DIM, Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > >::strides ( ) const
inlineinherited

Returns the memory strides of the Array.

◆ minStride()

AXOM_HOST_DEVICE IndexType axom::ArrayBase< T, DIM, Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > >::minStride ( ) const
inlineinherited

Returns the minimum stride between adjacent items.

◆ setShape()

AXOM_HOST_DEVICE void axom::ArrayBase< T, DIM, Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > >::setShape ( const StackArray< IndexType, DIM > &  shape_)
inlineprotectedinherited

Set the shape.

◆ setShapeAndStride()

AXOM_SUPPRESS_HD_WARN AXOM_HOST_DEVICE void axom::ArrayBase< T, DIM, Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > >::setShapeAndStride ( const StackArray< IndexType, DIM > &  shape,
const StackArray< IndexType, DIM > &  stride 
)
inlineprotectedinherited

Set the shape and stride.

◆ blockSize()

IndexType axom::ArrayBase< T, DIM, Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > >::blockSize ( ) const
inlineprotectedinherited

Returns the minimum "chunk size" that should be allocated For example, 2 would be the chunk size of a 2D array whose second dimension is of size 2. This is used when resizing/reallocating; it wouldn't make sense to have a capacity of 3 in the array described above.

◆ updateStrides()

AXOM_HOST_DEVICE void axom::ArrayBase< T, DIM, Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > >::updateStrides ( int  min_stride = 1)
inlineprotectedinherited

Updates the internal striding information to a row-major format Intended to be called after shape is updated.

◆ updateShapeOnInsert()

void axom::ArrayBase< T, DIM, Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > >::updateShapeOnInsert ( const StackArray< IndexType, DIM > &  range_shape)
inlineprotectedinherited

Updates the internal dimensions and striding based on the insertion of a range of elements. Intended to be called after the insertion of a multidimensional subslice.

◆ onShapeUpdate()

template<typename T >
template<int Dims>
void axom::detail::DefaultStoragePolicy< T >::onShapeUpdate ( StackArray< IndexType, Dims >  )
inlineinherited

Callback to report changes in shape of data in Array.

Parameters
[in]shapethe current dimensions of the array

◆ reallocate()

template<typename T >
template<typename Func >
T* axom::detail::DefaultStoragePolicy< T >::reallocate ( T *  old_data,
int  ,
int  allocator_id,
int  new_capacity,
Func &&  nontrivial_move 
)
inlineinherited

Reallocates a buffer.

Parameters
[in]old_datapointer to the old buffer
[in]old_capacitythe capacity of the currently allocated buffer
[in]allocator_idthe allocator ID to use
[in]new_capacitythe capacity to allocate
[in]nontrivial_movea callback to move elements that aren't trivially copyable
Returns
a pointer to the new buffer with moved elements

References axom::deallocate().

◆ deallocate()

template<typename T >
void axom::detail::DefaultStoragePolicy< T >::deallocate ( T *  data)
inlineinherited

Frees a buffer.

References axom::deallocate().

Member Data Documentation

◆ DEFAULT_RESIZE_RATIO

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
constexpr double axom::Array< T, DIM, SPACE, StoragePolicy >::DEFAULT_RESIZE_RATIO = 2.0
staticconstexpr

◆ MIN_DEFAULT_CAPACITY

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
constexpr IndexType axom::Array< T, DIM, SPACE, StoragePolicy >::MIN_DEFAULT_CAPACITY = 32
staticconstexpr

◆ space

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
constexpr MemorySpace axom::Array< T, DIM, SPACE, StoragePolicy >::space = SPACE
staticconstexpr

◆ m_data

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
T* axom::Array< T, DIM, SPACE, StoragePolicy >::m_data = nullptr
protected

◆ m_num_elements

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
IndexType axom::Array< T, DIM, SPACE, StoragePolicy >::m_num_elements = 0
protected

The full number of elements in the array i.e., 3 for a 1D Array of size 3, 9 for a 3x3 2D array, etc.

◆ m_capacity

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
IndexType axom::Array< T, DIM, SPACE, StoragePolicy >::m_capacity = 0
protected

◆ m_resize_ratio

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
double axom::Array< T, DIM, SPACE, StoragePolicy >::m_resize_ratio = DEFAULT_RESIZE_RATIO
protected

◆ m_allocator_id

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
int axom::Array< T, DIM, SPACE, StoragePolicy >::m_allocator_id = INVALID_ALLOCATOR_ID
protected

◆ m_executeOnGPU

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
bool axom::Array< T, DIM, SPACE, StoragePolicy >::m_executeOnGPU = false
protected

◆ m_arrayOps

template<typename T , int DIM = 1, MemorySpace SPACE = MemorySpace::Dynamic, typename StoragePolicy = detail::DefaultStoragePolicy<T>>
OpHelper axom::Array< T, DIM, SPACE, StoragePolicy >::m_arrayOps
protected

◆ Dims

constexpr static int axom::ArrayBase< T, DIM, Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > >::Dims
staticconstexprinherited

◆ m_shape

StackArray<IndexType, DIM> axom::ArrayBase< T, DIM, Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > >::m_shape
protectedinherited

The extent in each direction.

◆ m_mapping

MDMapping<DIM> axom::ArrayBase< T, DIM, Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > >::m_mapping
protectedinherited

For converting between multidim indices and offset.

◆ m_minStride

IndexType axom::ArrayBase< T, DIM, Array< T, 1, MemorySpace::Dynamic, detail::DefaultStoragePolicy< T > > >::m_minStride
protectedinherited

Cached value for optimization.

See also
minStride()

For some reason, computing min stride in minStride() slows down flatIndex() for CUDA and HIP, even though it doesn't seem tricky to optimize. As a work around, we cache the value in m_minStrides and update it when m_mapping changes. BTNG, March 2024.


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