This class provides a fixed dimensional resizeable array interface in addition to an interface similar to std::vector for a 1D array.
More...
|
using | Permutation = PERMUTATION |
| The permutation of the array.
|
|
using | ParentClass = ArrayView< T, NDIM, typeManipulation::getStrideOneDimension(Permutation {}), INDEX_TYPE, BUFFER_TYPE > |
| Alias for the parent class.
|
|
using | NestedViewType = ArrayView< std::remove_reference_t< typeManipulation::NestedViewType< T > >, NDIM, USD, INDEX_TYPE, BUFFER_TYPE > |
| The type when all inner array classes are converted to const views.
|
|
using | NestedViewTypeConst = ArrayView< std::remove_reference_t< typeManipulation::NestedViewTypeConst< T > >, NDIM, USD, INDEX_TYPE, BUFFER_TYPE > |
| The type when all inner array classes are converted to const views and the inner most view's values are also const.
|
|
using | ValueType = T |
| The type of the values in the ArrayView.
|
|
using | IndexType = INDEX_TYPE |
| The integer type used for indexing.
|
|
using | NestedViewType = ArrayView< std::remove_reference_t< typeManipulation::NestedViewType< T > >, NDIM, USD, INDEX_TYPE, BUFFER_TYPE > |
| The type when all inner array classes are converted to const views.
|
|
using | NestedViewTypeConst = ArrayView< std::remove_reference_t< typeManipulation::NestedViewTypeConst< T > >, NDIM, USD, INDEX_TYPE, BUFFER_TYPE > |
| The type when all inner array classes are converted to const views and the inner most view's values are also const.
|
|
using | SliceType = ArraySlice< T, NDIM, USD, INDEX_TYPE > const |
| The type of the ArrayView when converted to an ArraySlice.
|
|
using | SliceTypeConst = ArraySlice< T const, NDIM, USD, INDEX_TYPE > const |
| The type of the ArrayView when converted to an immutable ArraySlice.
|
|
using | value_type = T |
| The type of the values in the ArrayView, here for stl compatability.
|
|
using | size_type = INDEX_TYPE |
| The integer type used for indexing, here for stl compatability.
|
|
|
void | setName (std::string const &name) |
| Set the name to be displayed whenever the underlying Buffer's user call back is called. More...
|
|
|
| Array () |
| default constructor
|
|
template<typename ... DIMS, typename = std::enable_if_t< sizeof ... ( DIMS ) == NDIM && typeManipulation::all_of_t< std::is_integral< DIMS > ... >::value >> |
| Array (DIMS const ... dims) |
| Constructor that takes in the dimensions as a variadic parameter list. More...
|
|
| Array (Array const &source) |
| Copy constructor. More...
|
|
| Array (Array &&source) |
| Move constructor. More...
|
|
| ~Array () |
| Destructor, free's the data.
|
|
Array & | operator= (Array const &rhs) |
| Copy assignment operator, performs a deep copy of rhs. More...
|
|
Array & | operator= (Array &&rhs) |
| Move assignment operator, performs a shallow copy of rhs. More...
|
|
|
constexpr ArrayView< T, NDIM, USD, INDEX_TYPE, BUFFER_TYPE > | toView () const &&=delete |
| Overload for rvalues that is deleted. More...
|
|
constexpr ArrayView< T const, NDIM, USD, INDEX_TYPE, BUFFER_TYPE > | toViewConst () const &&=delete |
| Overload for rvalues that is deleted. More...
|
|
constexpr NestedViewType | toNestedView () const &&=delete |
| Overload for rvalues that is deleted. More...
|
|
constexpr NestedViewTypeConst | toNestedViewConst () const &&=delete |
| Overload for rvalues that is deleted. More...
|
|
constexpr | operator ArrayView< T const, NDIM, USD, INDEX_TYPE, BUFFER_TYPE > () const &noexcept |
| A user defined conversion operator (UDC) to an ArrayView< T const, ... >. More...
|
|
template<typename _T = T> |
constexpr | operator std::enable_if_t< !std::is_const< _T >::value, ArrayView< T const, NDIM, USD, INDEX_TYPE, BUFFER_TYPE > > () const &&noexcept=delete |
| Overload for rvalues that is deleted. More...
|
|
|
template<typename DIMS_TYPE > |
void | resize (int const numDims, DIMS_TYPE const *const dims) |
| Resize the dimensions of the Array to match the given dimensions. More...
|
|
template<typename ... DIMS> |
std::enable_if_t< sizeof ...(DIMS)==NDIM &&typeManipulation::all_of_t< std::is_integral< DIMS > ... >::value > | resize (DIMS const ... newDims) |
| function to resize the array. More...
|
|
template<typename ... DIMS> |
void | resizeWithoutInitializationOrDestruction (DIMS const ... newDims) |
| Resize the array without initializing any new values or destroying any old values. Only safe on POD data, however it is much faster for large allocations. More...
|
|
template<INDEX_TYPE... INDICES, typename ... DIMS> |
void | resizeDimension (DIMS const ... newDims) |
| Resize specific dimensions of the array. More...
|
|
void | resize (INDEX_TYPE const newdim) |
| Resize the default dimension of the Array. More...
|
|
void | resizeDefault (INDEX_TYPE const newdim, T const &defaultValue) |
| Resize the default dimension of the Array. More...
|
|
void | clear () |
| Sets the size of the Array to zero and destroys all the values. More...
|
|
void | setSingleParameterResizeIndex (int const index) |
| Set the default resize dimension. More...
|
|
|
void | reserve (INDEX_TYPE const newCapacity) |
| Reserve space in the Array to hold at least the given number of values. More...
|
|
|
- Note
- These methods are only enabled for one dimensional arrays (NDIM == 1).
|
template<typename ... ARGS, int _NDIM = NDIM> |
std::enable_if_t< _NDIM==1 > | emplace_back (ARGS &&... args) |
| Construct a value in place at the end of the array. More...
|
|
template<typename ... ARGS, int _NDIM = NDIM> |
std::enable_if_t< _NDIM==1 > | emplace (INDEX_TYPE const pos, ARGS &&... args) |
| Insert a value into the array constructing it in place. More...
|
|
template<typename ITER , int _NDIM = NDIM> |
std::enable_if_t< _NDIM==1 > | insert (INDEX_TYPE const pos, ITER const first, ITER const last) |
| Insert values into the array at the given position. More...
|
|
template<int _NDIM = NDIM> |
std::enable_if_t< _NDIM==1 > | pop_back () |
| Remove the last value in the array. More...
|
|
template<int _NDIM = NDIM> |
std::enable_if_t< _NDIM==1 > | erase (INDEX_TYPE const pos) |
| Remove the value at the given position. More...
|
|
| ArrayView ()=default |
| A constructor to create an uninitialized ArrayView. More...
|
|
constexpr | ArrayView (ArrayView const &source) noexcept |
| Copy Constructor. More...
|
|
| ArrayView (ArrayView &&source)=default |
| Move constructor, creates a shallow copy and invalidates the source. More...
|
|
constexpr | ArrayView (typeManipulation::CArray< INDEX_TYPE, NDIM > const &dims, typeManipulation::CArray< INDEX_TYPE, NDIM > const &strides, int const singleParameterResizeIndex, BUFFER_TYPE< T > const &buffer) |
| Construct a new ArrayView from existing components. More...
|
|
| ~ArrayView ()=default |
| The default destructor.
|
|
LVARRAY_INTEL_CONSTEXPR ArrayView & | operator= (ArrayView &&rhs) |
| Move assignment operator, creates a shallow copy and invalidates the source. More...
|
|
LVARRAY_INTEL_CONSTEXPR ArrayView & | operator= (ArrayView const &rhs) noexcept |
| Copy assignment operator, creates a shallow copy. More...
|
|
constexpr ArrayView | toView () const & |
|
constexpr ArrayView< T const, NDIM, USD, INDEX_TYPE, BUFFER_TYPE > | toViewConst () const & |
|
constexpr NestedViewType | toNestedView () const & |
|
constexpr NestedViewTypeConst | toNestedViewConst () const & |
|
constexpr ArraySlice< T, NDIM, USD, INDEX_TYPE > | toSlice () const &noexcept |
|
constexpr ArraySlice< T, NDIM, USD, INDEX_TYPE > | toSlice () const &&noexcept=delete |
| Overload for rvalues that is deleted. More...
|
|
constexpr ArraySlice< T const, NDIM, USD, INDEX_TYPE > | toSliceConst () const &noexcept |
|
constexpr ArraySlice< T const, NDIM, USD, INDEX_TYPE > | toSliceConst () const &&noexcept=delete |
| Overload for rvalues that is deleted. More...
|
|
constexpr | operator std::enable_if_t< !std::is_const< _T >::value, ArrayView< T const, NDIM, USD, INDEX_TYPE, BUFFER_TYPE > > () const noexcept |
| A user defined conversion operator (UDC) to an ArrayView< T const, ... >. More...
|
|
constexpr | operator ArraySlice< T, NDIM, USD, INDEX_TYPE > () const &noexcept |
|
constexpr | operator ArraySlice< T, NDIM, USD, INDEX_TYPE > () const &&noexcept=delete |
| Overload for rvalues that is deleted. More...
|
|
constexpr | operator std::enable_if_t< !std::is_const< _T >::value, ArraySlice< T const, NDIM, USD, INDEX_TYPE > const > () const &noexcept |
|
constexpr | operator std::enable_if_t< !std::is_const< _T >::value, ArraySlice< T const, NDIM, USD, INDEX_TYPE > const > () const &&noexcept=delete |
| Overload for rvalues that is deleted. More...
|
|
INDEX_TYPE | size () const noexcept |
|
INDEX_TYPE | size (int const dim) const noexcept |
|
constexpr bool | empty () const |
|
constexpr INDEX_TYPE | capacity () const |
|
constexpr int | getSingleParameterResizeIndex () const |
|
constexpr INDEX_TYPE | linearIndex (INDICES const ... indices) const |
|
constexpr INDEX_TYPE const * | dims () const noexcept |
|
constexpr INDEX_TYPE const * | strides () const noexcept |
|
constexpr std::enable_if_t<(_NDIM > 1), ArraySlice< T, NDIM - 1, USD - 1, INDEX_TYPE > > | operator[] (INDEX_TYPE const index) const &noexcept |
|
constexpr std::enable_if_t<(_NDIM > 1), ArraySlice< T, NDIM - 1, USD - 1, INDEX_TYPE > > | operator[] (INDEX_TYPE const index) const &&noexcept=delete |
| Overload for rvalues that is deleted. More...
|
|
constexpr std::enable_if_t< _NDIM==1, T & > | operator[] (INDEX_TYPE const index) const &noexcept |
|
constexpr T & | operator() (INDICES... indices) const |
|
constexpr T * | data () const |
|
constexpr T * | begin () const |
|
constexpr T * | end () const |
|
T & | front () const |
|
T & | back () const |
|
void | setValues (T const &value) const |
| Set all entries in the array to value . More...
|
|
void | setValues (ArrayView< T const, NDIM, USD, INDEX_TYPE, BUFFER_TYPE > const &rhs) const |
| Set entries to values from another compatible ArrayView. More...
|
|
void | registerTouch (MemorySpace const space) const |
| Touch the memory in space . More...
|
|
void | move (MemorySpace const space, bool const touch=true) const |
| Move the Array to the given execution space, optionally touching it. More...
|
|
template<typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
class LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >
This class provides a fixed dimensional resizeable array interface in addition to an interface similar to std::vector for a 1D array.
- Template Parameters
-
T | The type of data that is contained by the array. |
NDIM | The number of dimensions in array (e.g. NDIM=1->vector, NDIM=2->Matrix, etc. ). Some methods such as push_back are only available for a 1D array. |
PERMUTATION | A camp::idx_seq containing the values in [0, NDIM) which describes how the data is to be laid out in memory. Given an 3-dimensional array A of dimension (L, M, N) the standard layout is A( i, j, k ) = A.data()[ i * M * N + j * N + k ], this layout is the given by the identity permutation (0, 1, 2) which says that the first dimension in memory corresponds to the first index (i), and similarly for the other dimensions. The same array with a layout of A( i, j, k ) = A.data()[ L * N * j + L * k + i ] would have a permutation of (1, 2, 0) because the first dimension in memory corresponds to the second index (j), the second dimension in memory corresponds to the third index (k) and the last dimension in memory goes with the first index (i). |
- Note
- RAJA provides aliases for every valid permutations up to 5D, the two permutations mentioned above can be used via RAJA::PERM_IJK and RAJA::PERM_JKI.
-
The dimension with unit stride is the last dimension in the permutation.
- Template Parameters
-
INDEX_TYPE | the integer to use for indexing. |
BUFFER_TYPE | A class that defines how to actually allocate memory for the Array. Must take one template argument that describes the type of the data being stored (T). |
Definition at line 55 of file Array.hpp.