|
AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
|
#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/v0.10.1/src/axom/core/ArrayBase.hpp>

Public Types | |
| using | RealConstT = typename std::conditional< is_array_view, T, const T >::type |
| template<int IdxDim> | |
| using | SliceType = typename std::conditional< DIM==IdxDim, T &, typename detail::SubsliceProxy< T, DIM - IdxDim, ArrayType >::type >::type |
| template<int IdxDim> | |
| using | ConstSliceType = typename std::conditional< DIM==IdxDim, RealConstT &, typename detail::SubsliceProxy< T, DIM - IdxDim, const ArrayType >::type >::type |
Public Member Functions | |
| AXOM_SUPPRESS_HD_WARN AXOM_HOST_DEVICE | ArrayBase () |
| Construct row-major, unitnitialized array. More... | |
| AXOM_SUPPRESS_HD_WARN AXOM_HOST_DEVICE | ArrayBase (const StackArray< IndexType, DIM > &shape, int min_stride=1) |
| Parameterized constructor that sets up the array shape. More... | |
| AXOM_SUPPRESS_HD_WARN AXOM_HOST_DEVICE | ArrayBase (const StackArray< IndexType, DIM > &shape, const MDMapping< DIM > &mapping) |
| Parameterized constructor that sets up the array shape, with an MDMapping to specify data ordering. More... | |
| AXOM_HOST_DEVICE | ArrayBase (const StackArray< IndexType, DIM > &shape, const StackArray< IndexType, DIM > &stride) |
| Parameterized constructor that sets up the array shape and stride. More... | |
| template<typename OtherArrayType > | |
| AXOM_HOST_DEVICE | ArrayBase (const ArrayBase< typename std::remove_const< T >::type, DIM, OtherArrayType > &other) |
| Copy constructor for arrays of different type Because the element type (T) and dimension (DIM) are still locked down, this function is nominally used for copying ArrayBase metadata from Array <-> ArrayView and/or Array-like objects whose data are in different memory spaces. More... | |
| template<typename OtherArrayType > | |
| AXOM_HOST_DEVICE | ArrayBase (const ArrayBase< const typename std::remove_const< T >::type, 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... 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... | |
| template<typename... Args> | |
| 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... | |
| template<int UDim> | |
| 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... | |
| template<int UDim> | |
| 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... | |
| 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 RealConstT & | flatIndex (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 | |
| constexpr static int | Dims = DIM |
Protected Member Functions | |
| 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... | |
Protected Attributes | |
| 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... | |
| using axom::ArrayBase< T, DIM, ArrayType >::RealConstT = typename std::conditional<is_array_view, T, const T>::type |
| using axom::ArrayBase< T, DIM, ArrayType >::SliceType = typename std::conditional< DIM == IdxDim, T&, typename detail::SubsliceProxy<T, DIM - IdxDim, ArrayType>::type>::type |
| using axom::ArrayBase< T, DIM, ArrayType >::ConstSliceType = typename std::conditional< DIM == IdxDim, RealConstT&, typename detail::SubsliceProxy<T, DIM - IdxDim, const ArrayType>::type>::type |
|
inline |
Construct row-major, unitnitialized array.
References axom::ROW, and axom::ArrayBase< T, DIM, ArrayType >::updateStrides().
|
inline |
|
inline |
Parameterized constructor that sets up the array shape, with an MDMapping to specify data ordering.
| [in] | shape | Array size in each direction. |
| [in] | mapping | Model mapper, specifying the array stride order and minimum stride. |
The object is constructed with the given shape, not the partial shape information in mapping.
|
inline |
Parameterized constructor that sets up the array shape and stride.
References axom::ArrayBase< T, DIM, ArrayType >::m_mapping, axom::ArrayBase< T, DIM, ArrayType >::m_minStride, axom::ROW, and axom::ArrayBase< T, DIM, ArrayType >::shape().
|
inline |
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inline |
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.
| [in] | args | the parameter pack of indices in each dimension. |
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inline |
Scalar accessor; returns a sub-array referenced by the given sub- index, beginning at array(idx, 0...)
| [in] | idx | the index of the first dimension. |
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inline |
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.
| [in] | args | a stack array of indices in each dimension. |
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inline |
Accessor, returns a reference to the given value. For multidimensional arrays, indexes into the (flat) raw data.
| [in] | idx | the position of the value to return. |
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inline |
Swaps two ArrayBases.
References axom::ArrayBase< T, DIM, ArrayType >::m_mapping, axom::ArrayBase< T, DIM, ArrayType >::m_minStride, axom::ArrayBase< T, DIM, ArrayType >::m_shape, and axom::utilities::swap().
|
inline |
Returns the dimensions of the Array.
References axom::ArrayBase< T, DIM, ArrayType >::m_shape.
|
inline |
Returns the multidimensional mapping for the Array.
References axom::ArrayBase< T, DIM, ArrayType >::m_mapping.
|
inline |
Returns the memory strides of the Array.
References axom::ArrayBase< T, DIM, ArrayType >::m_mapping.
|
inline |
Returns the minimum stride between adjacent items.
References axom::ArrayBase< T, DIM, ArrayType >::m_minStride.
|
inlineprotected |
Set the shape.
References axom::ArrayBase< T, DIM, ArrayType >::m_shape, and axom::ArrayBase< T, DIM, ArrayType >::updateStrides().
|
inlineprotected |
Set the shape and stride.
References axom::ArrayBase< T, DIM, ArrayType >::m_mapping, axom::ArrayBase< T, DIM, ArrayType >::m_minStride, axom::ArrayBase< T, DIM, ArrayType >::m_shape, and axom::ArrayBase< T, DIM, ArrayType >::shape().
|
inlineprotected |
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.
References axom::ArrayBase< T, DIM, ArrayType >::m_mapping.
|
inlineprotected |
Updates the internal striding information to a row-major format Intended to be called after shape is updated.
References axom::ArrayBase< T, DIM, ArrayType >::m_mapping, axom::ArrayBase< T, DIM, ArrayType >::m_minStride, and axom::ArrayBase< T, DIM, ArrayType >::m_shape.
|
inlineprotected |
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.
References axom::StackArray< T, N >::begin(), axom::StackArray< T, N >::end(), axom::ArrayBase< T, DIM, ArrayType >::m_shape, axom::utilities::processAbort(), and axom::ArrayBase< T, DIM, ArrayType >::updateStrides().
|
staticconstexpr |
|
protected |
The extent in each direction.
|
protected |
For converting between multidim indices and offset.
|
protected |
Cached value for optimization.
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.