|
AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
|
Provides a generic multi-component array, contained in Sidre. More...
#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/main/src/axom/sidre/core/Array.hpp>

Public Types | |
| using | value_type = T |
| using | ArrayIterator = ArrayIteratorBase< Array< T, DIM, SPACE, detail::SidreStoragePolicy< T > >, T > |
| using | ConstArrayIterator = ArrayIteratorBase< const Array< T, DIM, SPACE, detail::SidreStoragePolicy< T > >, 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 |
| 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 | |
| Array ()=delete | |
| Default constructor. Disabled. More... | |
| Array (const Array &)=delete | |
| Copy constructor. More... | |
| Array (Array &&other) | |
| Move constructor. More... | |
| virtual | ~Array () |
| Array & | operator= (const Array &)=delete |
| Copy assignment. More... | |
| Array & | operator= (Array &&other) |
| Move assignment. More... | |
| std::enable_if< TDIM==1, axom::StackArray< TT, LENGTH1D > >::type | to_stack_array () const |
| Convert 1D Array into a StackArray. More... | |
| Array< T, DIM, SPACE, detail::SidreStoragePolicy< T > >::ArrayIterator | emplace (Array< T, DIM, SPACE, detail::SidreStoragePolicy< T > >::ArrayIterator pos, Args &&... args) |
| void | emplace_back_device (Args &&... args) |
| Inserts new element at the end of the Array. More... | |
| void | swap (ArrayBase &other) |
| Swaps two ArrayBases. 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... | |
| 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... | |
Sidre Array constructors | |
| template<int SFINAE = DIM, typename std::enable_if< SFINAE==1 >::type * = nullptr> | |
| Array (View *view) | |
| Creates an Array instance from a View that already has data. More... | |
| template<int SFINAE = DIM, typename std::enable_if< SFINAE==2 >::type * = nullptr> | |
| Array (View *view) | |
| 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 SFINAE = DIM, typename std::enable_if< SFINAE==1 >::type * = nullptr> | |
| Array (View *view, axom::IndexType num_elements, axom::IndexType capacity=0) | |
Creates an Array instance of num_elements size and populates the associated View. More... | |
| template<int SFINAE = DIM, typename std::enable_if< SFINAE==2 >::type * = nullptr> | |
| Array (View *view, axom::IndexType num_tuples, axom::IndexType num_components=1, axom::IndexType capacity=0) | |
Creates an Array instance of num_tuples size, where each tuple consists of num_components values and populates the associated View. More... | |
Array methods to query and set attributes | |
| virtual bool | isExternal () const |
| Return true iff the external buffer constructor was called. More... | |
| const View * | getView () const |
| Return a pointer to the View that this Array wraps. 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... | |
| 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... | |
| void | insert (IndexType pos, ArrayView< const T, DIM, OtherSpace > other) |
| Inserts an Array to the end of the calling object. More... | |
| 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... | |
| void | append (ArrayView< const T, DIM, OtherSpace > other) |
| Appends an Array to the end of the calling object. More... | |
| 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... | |
| void | emplace (IndexType pos, Args &&... args) |
| Inserts new element into Array at the given position. More... | |
| 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... | |
| void | emplace_back (Args &&... args) |
| Inserts new element at the end of 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... | |
| void | resize (Args... args) |
| Update the number of elements stored in the data array. More... | |
| 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... | |
| 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 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 | |
| static constexpr double | DEFAULT_RESIZE_RATIO |
| static constexpr IndexType | MIN_DEFAULT_CAPACITY |
| static constexpr MemorySpace | space |
| constexpr static int | Dims = DIM |
Protected Types | |
| using | BaseArray = axom::Array< T, DIM, MemorySpace::Dynamic, detail::SidreStoragePolicy< T > > |
Protected Member Functions | |
| axom::IndexType | getViewShape (int dim) const |
| Given a non-empty View of dimension 2, returns the length of the given dimension. More... | |
| 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... | |
Static Protected Member Functions | |
| static constexpr TypeID | sidreTypeId () |
| Return the TypeID corresponding to T. More... | |
Protected Attributes | |
| T * | m_data |
| IndexType | m_num_elements |
| 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 |
| double | m_resize_ratio |
| int | m_allocator_id |
| bool | m_executeOnGPU |
| 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... | |
Provides a generic multi-component array, contained in Sidre.
This sidre::Array class extends axom::Array by storing data in a Sidre DataStore. This class provides a generic multi-component array container with dynamic re-allocation and insertion. Each element in the array is a tuple consisting of 1 or more components, which are stored contiguously.
Objects of the sidre::Array class may be constructed from a View. All array operations can be performed as with the base axom::Array class. The size of the Array can grow as needed, and all memory management is delegated to Sidre.
reserve() when the number of nodes is known a priori, or opt to use a constructor that takes an actual size and capacity when possible.| T | the type of the values to hold. |
|
protected |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
delete |
Default constructor. Disabled.
|
delete |
Copy constructor.
Deleted because copies would have to reference the same underlying Sidre buffer, which does not match the underlying axom::Array ownership model
| axom::sidre::Array< T, DIM >::Array | ( | Array< T, DIM > && | other | ) |
Move constructor.
| [in] | other | The array to move from |
| axom::sidre::Array< T, DIM >::Array | ( | View * | view | ) |
Creates an Array instance from a View that already has data.
References axom::sidre::View::getBuffer(), axom::sidre::Buffer::getNumElements(), axom::sidre::View::getTypeID(), axom::sidre::Array< T, DIM >::getView(), axom::sidre::Array< T, DIM >::getViewShape(), axom::sidre::View::getVoidPtr(), axom::Array< T, 1, MemorySpace::Dynamic, detail::SidreStoragePolicy< T > >::m_capacity, axom::Array< T, 1, MemorySpace::Dynamic, detail::SidreStoragePolicy< T > >::m_data, axom::Array< T, 1, MemorySpace::Dynamic, detail::SidreStoragePolicy< T > >::m_num_elements, axom::ArrayBase< T, DIM, ArrayType >::setShape(), axom::sidre::Array< T, DIM >::sidreTypeId(), SLIC_ERROR_IF, and axom::Array< T, 1, MemorySpace::Dynamic, detail::SidreStoragePolicy< T > >::view().
| axom::sidre::Array< T, DIM >::Array | ( | View * | view | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| axom::sidre::Array< T, DIM >::Array | ( | View * | view, |
| axom::IndexType | num_elements, | ||
| axom::IndexType | capacity = 0 |
||
| ) |
Creates an Array instance of num_elements size and populates the associated View.
| [in] | view | the View that will hold this Array's data. |
| [in] | num_elements | the number of values. |
| [in] | capacity | the number of values to allocate space for. |
References axom::Array< T, 1, MemorySpace::Dynamic, detail::SidreStoragePolicy< T > >::capacity(), axom::Array< T, 1, MemorySpace::Dynamic, detail::SidreStoragePolicy< T > >::m_capacity, axom::Array< T, 1, MemorySpace::Dynamic, detail::SidreStoragePolicy< T > >::m_data, axom::Array< T, 1, MemorySpace::Dynamic, detail::SidreStoragePolicy< T > >::m_num_elements, axom::Array< T, 1, MemorySpace::Dynamic, detail::SidreStoragePolicy< T > >::setCapacity(), SLIC_ASSERT, SLIC_ERROR_IF, and axom::Array< T, 1, MemorySpace::Dynamic, detail::SidreStoragePolicy< T > >::view().
| axom::sidre::Array< T, DIM >::Array | ( | View * | view, |
| axom::IndexType | num_tuples, | ||
| axom::IndexType | num_components = 1, |
||
| axom::IndexType | capacity = 0 |
||
| ) |
Creates an Array instance of num_tuples size, where each tuple consists of num_components values and populates the associated View.
| [in] | view | the View that will hold this Array's data. |
| [in] | num_tuples | the number of tuples accounted for in the Array. |
| [in] | num_components | the number of values per tuple. If not specified defaults to 1. |
| [in] | capacity | the number of tuples to allocate space for. |
References axom::Array< T, 1, MemorySpace::Dynamic, detail::SidreStoragePolicy< T > >::capacity(), axom::Array< T, 1, MemorySpace::Dynamic, detail::SidreStoragePolicy< T > >::m_capacity, axom::Array< T, 1, MemorySpace::Dynamic, detail::SidreStoragePolicy< T > >::m_data, axom::Array< T, 1, MemorySpace::Dynamic, detail::SidreStoragePolicy< T > >::m_num_elements, axom::Array< T, 1, MemorySpace::Dynamic, detail::SidreStoragePolicy< T > >::setCapacity(), SLIC_ASSERT, SLIC_ERROR_IF, axom::ArrayBase< T, DIM, ArrayType >::updateStrides(), and axom::Array< T, 1, MemorySpace::Dynamic, detail::SidreStoragePolicy< T > >::view().
|
virtual |
Destructor. Frees the associated buffer unless owned by Sidre.
|
delete |
Copy assignment.
Deleted because copies would have to reference the same underlying Sidre buffer, which does not match the underlying axom::Array ownership model
| Array< T, DIM > & axom::sidre::Array< T, DIM >::operator= | ( | Array< T, DIM > && | other | ) |
Move assignment.
| [in] | other | The Array to move from |
|
inlinevirtual |
Return true iff the external buffer constructor was called.
|
inline |
Return a pointer to the View that this Array wraps.
References axom::sidre::detail::SidreStoragePolicy< T >::getView().
|
inlinestaticconstexprprotected |
Return the TypeID corresponding to T.
References axom::sidre::detail::SidreStoragePolicy< T >::sidreTypeId().
|
inlineprotected |
|
inlineinherited |
Return a pointer to the array of data.
|
inlineinherited |
|
inlineinherited |
Convert 1D Array into a StackArray.
|
inlineinherited |
Set all the values of the array.
| [in] | value | the value to set to. |
|
inlineinherited |
Set a range of elements to a given value.
| [in] | value | the value to set to. |
| [in] | n | the number of elements to write. |
| [in] | pos | the position at which to begin writing. |
|
inlineinherited |
Modify the values of existing elements.
| [in] | elements | the new elements to write. |
| [in] | n | the number of elements to write. |
| [in] | pos | the position at which to begin writing. |
|
inlineinherited |
Set the array contents.
| [in] | count | The new number of elements. |
| [in] | value | The value to store in the elements. |
|
inlineinherited |
Replaces contents with copies of objects in [first, last).
| [in] | first | The iterator for the first value to use in a container. |
| [in] | last | The last iterator to use in a container. |
|
inlineinherited |
Set the array contents using an initializer list.
| [in] | elems | An initializer list containing the new array values. |
|
inlineinherited |
Clears the contents of the array.
|
inlineinherited |
Insert an element into the array at the given position.
| [in] | pos | the position at which to insert. |
| [in] | value | the element value to insert. |
|
inherited |
Insert an element into the array at the value before pos.
| [in] | pos | the ArrayIterator before which value will be inserted. |
| [in] | value | the element value to insert. |
|
inlineinherited |
Insert elements into the array at the given position.
| [in] | pos | the position at which to begin the insertion. |
| [in] | n | the number of elements to insert. |
| [in] | values | the element values to insert. |
|
inherited |
Insert elements into the array at the value before pos.
| [in] | pos | the ArrayIterator before which value will be inserted. |
| [in] | n | the number of elements to insert. |
| [in] | values | the element values to insert. |
|
inlineinherited |
Insert n copies of element into the array at the given position.
| [in] | pos | the position at which to begin the insertion. |
| [in] | n | the number of elements to insert. |
| [in] | value | the element value to insert. |
|
inherited |
Insert n copies of element into the array at the value before pos.
| [in] | pos | the ArrayIterator before which value will be inserted. |
| [in] | n | the number of elements to insert. |
| [in] | value | the element value to insert. |
|
inlineinherited |
|
inlineinherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inlineinherited |
|
inlineinherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inherited |
|
inherited |
Erases elements in the range [first, last) from the Array.
| [in] | first | the ArrayIterator to the beginning of the range. |
| [in] | last | the ArrayIterator to end of range. |
|
inlineinherited |
Inserts new element into Array at the given position.
| [in] | pos | the position to insert element at. |
| [in] | args | the arguments to forward to constructor of the element. |
|
inherited |
Inserts new element into Array before pos.
| [in] | pos | the ArrayIterator to insert element before. |
| [in] | args | the arguments to forward to constructor of the element. |
|
inlineinherited |
|
inlineinherited |
Push a value to the back of the array.
| [in] | value | the value to be added to the back. |
|
inlineinherited |
Push a value to the back of the array.
| [in] | value | the value to move to the back. |
|
inlineinherited |
Inserts new element at the end of the Array.
| [in] | args | the arguments to forward to constructor of the element. |
|
inlineinherited |
Push a value to the back of the array.
| [in] | value | the value to move to the back. |
|
inlineinherited |
|
inlineinherited |
Inserts new element at the end of the Array.
| [in] | args | the arguments to forward to constructor of the element. |
|
inlineinherited |
Return the number of elements allocated for the data array.
|
inlineinherited |
Increase the capacity. Does nothing if the new capacity is less than the current capacity.
| [in] | capacity | the new number of elements to allocate. |
|
inlineinherited |
Returns an ArrayIterator to the first element of the Array.
|
inlineinherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inlineinherited |
Returns an ArrayIterator to the element following the last element of the Array.
|
inlineinherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inlineinherited |
Returns a reference to the first element in the Array.
|
inlineinherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inlineinherited |
Returns a reference to the last element in the Array.
|
inlineinherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inlineinherited |
Shrink the capacity to be equal to the size.
|
inlineinherited |
|
inlineinherited |
Return the number of elements stored in the data array.
|
inlineinherited |
Update the number of elements stored in the data array.
|
inlineinherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Exchanges the contents of this Array with the other.
|
inlineinherited |
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().
|
inlineinherited |
Get the ratio by which the capacity increases upon dynamic resize.
|
inlineinherited |
Set the ratio by which the capacity increases upon dynamic resize.
| [in] | ratio | the new resize ratio. |
|
inlineinherited |
Get the ID for the umpire allocator.
|
inlineinherited |
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.
|
inlineinherited |
Returns a view of the array.
|
inlineinherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inlineprotectedinherited |
Initialize an Array instance with the given number of elements.
| [in] | num_elements | the number of elements the Array holds. |
| [in] | capacity | the number of elements to allocate space for. |
| [in] | should_default_construct | whether to create default-constructed objects in the region [0, num_elements). Defaults to true. |
|
inlineprotectedinherited |
Helper function for initializing an Array instance with an existing range of elements.
| [in] | data | pointer to the existing array of elements |
| [in] | num_elements | the number of elements in the existing array |
| [in] | data_space | the memory space in which data has been allocated |
| [in] | user_provided_allocator | true if the Array's allocator ID was provided by the user |
|
inlineprotectedinherited |
Updates the number of elements stored in the data array.
| [in] | dims | the number of elements to allocate in each dimension |
| [in] | construct_with_values | if true, sets new elements in the array to a specified value |
| [in] | value | pointer to the value to fill new elements in the array with. If null, will default-construct elements in place. |
|
inlineprotectedinherited |
Make space for a subsequent insertion into the array.
| [in] | n | the number of elements to insert. |
| [in] | pos | the position at which to begin the insertion. |
|
inlineprotectedinherited |
Make space for a subsequent insertion into the array.
|
inlineprotectedinherited |
Update the number of elements.
| [in] | new_num_elements | the new number of elements. |
|
inlineprotectedinherited |
Set the number of elements allocated for the data array.
| [in] | capacity | the new number of elements to allocate. |
|
inlineprotectedinherited |
Reallocates the data array when the size exceeds the capacity.
| [in] | new_num_elements | the number of elements which exceeds the current capacity. |
|
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.
| [in] | args | the parameter pack of indices in each dimension. |
|
inlineinherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inlineinherited |
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. |
|
inlineinherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
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.
| [in] | args | a stack array of indices in each dimension. |
|
inlineinherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inlineinherited |
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. |
|
inlineinherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inlineinherited |
Returns the dimensions of the Array.
References axom::ArrayBase< T, DIM, ArrayType >::m_shape.
|
inlineinherited |
Returns the multidimensional mapping for the Array.
References axom::ArrayBase< T, DIM, ArrayType >::m_mapping.
|
inlineinherited |
Returns the memory strides of the Array.
References axom::ArrayBase< T, DIM, ArrayType >::m_mapping.
|
inlineinherited |
Returns the minimum stride between adjacent items.
References axom::ArrayBase< T, DIM, ArrayType >::m_minStride.
|
inlineprotectedinherited |
Set the shape.
References axom::ArrayBase< T, DIM, ArrayType >::m_shape, and axom::ArrayBase< T, DIM, ArrayType >::updateStrides().
|
inlineprotectedinherited |
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().
|
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.
References axom::ArrayBase< T, DIM, ArrayType >::m_mapping.
|
inlineprotectedinherited |
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.
|
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.
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().
|
staticconstexprinherited |
|
staticconstexprinherited |
|
staticconstexprinherited |
|
protectedinherited |
|
protectedinherited |
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.
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
staticconstexprinherited |
|
protectedinherited |
The extent in each direction.
|
protectedinherited |
For converting between multidim indices and offset.
|
protectedinherited |
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.