LvArray
Public Types | Public Member Functions | Private Member Functions | List of all members
LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE > Class Template Reference

This class provides a fixed dimensional resizeable array interface in addition to an interface similar to std::vector for a 1D array. More...

#include <Array.hpp>

Inheritance diagram for LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >:
Inheritance graph

Public Types

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.
 
- Public Types inherited from LvArray::ArrayView< T, NDIM, typeManipulation::getStrideOneDimension(PERMUTATION {}), INDEX_TYPE, BUFFER_TYPE >
using ValueType = T
 The type of the values in the ArrayView.
 
using IndexType = INDEX_TYPE
 The integer type used for indexing.
 
using ViewTypeConst = ArrayView< std::remove_const_t< T > const, NDIM, USD, INDEX_TYPE, BUFFER_TYPE >
 The type when the data type is const.
 
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.
 

Public Member Functions

void setName (std::string const &name)
 Set the name to be displayed whenever the underlying Buffer's user call back is called. More...
 
Constructors, destructor and assignment operators.
LVARRAY_HOST_DEVICE Array ()
 default constructor
 
template<typename ... DIMS, typename = std::enable_if_t< sizeof ... ( DIMS ) == NDIM && typeManipulation::all_of_t< std::is_integral< DIMS > ... >::value >>
LVARRAY_HOST_DEVICE Array (DIMS const ... dims)
 Constructor that takes in the dimensions as a variadic parameter list. More...
 
 Array (BUFFER_TYPE< T > &&buffer)
 Construct an Array from buffer, taking ownership of its contents. More...
 
LVARRAY_HOST_DEVICE Array (Array const &source)
 Copy constructor. More...
 
LVARRAY_HOST_DEVICE Array (Array &&source)
 Move constructor. More...
 
LVARRAY_HOST_DEVICE ~Array ()
 Destructor, free's the data.
 
LVARRAY_HOST_DEVICE Arrayoperator= (Array const &rhs)
 Copy assignment operator, performs a deep copy of rhs. More...
 
LVARRAY_HOST_DEVICE Arrayoperator= (typename ParentClass::ViewTypeConst const &rhs)
 Copy assignment operator, performs a deep copy of rhs. More...
 
LVARRAY_HOST_DEVICE Arrayoperator= (Array &&rhs)
 Move assignment operator, performs a shallow copy of rhs. More...
 
ArrayView and ArraySlice creation methods and user defined conversions.
LVARRAY_HOST_DEVICE constexpr ArrayView< T, NDIM, USD, INDEX_TYPE, BUFFER_TYPE > toView () const &&=delete
 Overload for rvalues that is deleted. More...
 
LVARRAY_HOST_DEVICE constexpr ArrayView< T const, NDIM, USD, INDEX_TYPE, BUFFER_TYPE > toViewConst () const &&=delete
 Overload for rvalues that is deleted. More...
 
LVARRAY_HOST_DEVICE constexpr NestedViewType toNestedView () const &&=delete
 Overload for rvalues that is deleted. More...
 
LVARRAY_HOST_DEVICE constexpr NestedViewTypeConst toNestedViewConst () const &&=delete
 Overload for rvalues that is deleted. More...
 
LVARRAY_HOST_DEVICE 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>
LVARRAY_HOST_DEVICE 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...
 
Resizing methods.
template<typename DIMS_TYPE >
LVARRAY_HOST_DEVICE 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>
LVARRAY_HOST_DEVICE 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>
LVARRAY_HOST_DEVICE 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<typename ... DIMS>
LVARRAY_HOST_DEVICE void resizeWithoutInitializationOrDestruction (MemorySpace const space, 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>
LVARRAY_HOST_DEVICE void resizeDimension (DIMS const ... newDims)
 Resize specific dimensions of the array. More...
 
LVARRAY_HOST_DEVICE void resize (INDEX_TYPE const newdim)
 Resize the default dimension of the Array. More...
 
LVARRAY_HOST_DEVICE 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...
 
LVARRAY_HOST_DEVICE void setSingleParameterResizeIndex (int const index)
 Set the default resize dimension. More...
 
Methods to modify the capacity.
void reserve (INDEX_TYPE const newCapacity)
 Reserve space in the Array to hold at least the given number of values. More...
 
One dimensional interface.
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...
 
- Public Member Functions inherited from LvArray::ArrayView< T, NDIM, typeManipulation::getStrideOneDimension(PERMUTATION {}), INDEX_TYPE, BUFFER_TYPE >
 ArrayView ()=default
 A constructor to create an uninitialized ArrayView. More...
 
DISABLE_HD_WARNING LVARRAY_HOST_DEVICE constexpr ArrayView (ArrayView const &source) noexcept
 Copy Constructor. More...
 
LVARRAY_HOST_DEVICE constexpr ArrayView (ArrayView< U, NDIM, USD, INDEX_TYPE, BUFFER_TYPE > const &source)
 Construct a new ArrayView from an ArrayView with a different type. More...
 
 ArrayView (ArrayView &&source)=default
 Move constructor, creates a shallow copy and invalidates the source. More...
 
LVARRAY_HOST_DEVICE 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_HOST_DEVICE LVARRAY_INTEL_CONSTEXPR ArrayViewoperator= (ArrayView &&rhs)
 Move assignment operator, creates a shallow copy and invalidates the source. More...
 
LVARRAY_INTEL_CONSTEXPR ArrayViewoperator= (ArrayView const &rhs) noexcept
 Copy assignment operator, creates a shallow copy. More...
 
LVARRAY_HOST_DEVICE constexpr ArrayView toView () const &
 
LVARRAY_HOST_DEVICE constexpr ViewTypeConst toViewConst () const &
 
LVARRAY_HOST_DEVICE constexpr NestedViewType toNestedView () const &
 
LVARRAY_HOST_DEVICE constexpr NestedViewTypeConst toNestedViewConst () const &
 
LVARRAY_HOST_DEVICE constexpr ArraySlice< T, NDIM, USD, INDEX_TYPE > toSlice () const &noexcept
 
LVARRAY_HOST_DEVICE constexpr ArraySlice< T, NDIM, USD, INDEX_TYPE > toSlice () const &&noexcept=delete
 Overload for rvalues that is deleted. More...
 
LVARRAY_HOST_DEVICE constexpr ArraySlice< T const, NDIM, USD, INDEX_TYPE > toSliceConst () const &noexcept
 
LVARRAY_HOST_DEVICE constexpr ArraySlice< T const, NDIM, USD, INDEX_TYPE > toSliceConst () const &&noexcept=delete
 Overload for rvalues that is deleted. More...
 
LVARRAY_HOST_DEVICE 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...
 
LVARRAY_HOST_DEVICE constexpr operator ArraySlice< T, NDIM, USD, INDEX_TYPE > () const &noexcept
 
LVARRAY_HOST_DEVICE constexpr operator ArraySlice< T, NDIM, USD, INDEX_TYPE > () const &&noexcept=delete
 Overload for rvalues that is deleted. More...
 
LVARRAY_HOST_DEVICE constexpr operator std::enable_if_t< !std::is_const< _T >::value, ArraySlice< T const, NDIM, USD, INDEX_TYPE > const > () const &noexcept
 
LVARRAY_HOST_DEVICE 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...
 
LVARRAY_HOST_DEVICE constexpr INDEX_TYPE size () const noexcept
 
LVARRAY_HOST_DEVICE CONSTEXPR_WITHOUT_BOUNDS_CHECK INDEX_TYPE size (int const dim) const noexcept
 
LVARRAY_HOST_DEVICE constexpr bool empty () const
 
LVARRAY_HOST_DEVICE constexpr INDEX_TYPE capacity () const
 
LVARRAY_HOST_DEVICE constexpr int getSingleParameterResizeIndex () const
 
LVARRAY_HOST_DEVICE CONSTEXPR_WITHOUT_BOUNDS_CHECK INDEX_TYPE linearIndex (INDICES const ... indices) const
 
LVARRAY_HOST_DEVICE constexpr INDEX_TYPE const * dims () const noexcept
 
LVARRAY_HOST_DEVICE constexpr typeManipulation::CArray< INDEX_TYPE, NDIM > const & dimsArray () const
 
LVARRAY_HOST_DEVICE constexpr INDEX_TYPE const * strides () const noexcept
 
LVARRAY_HOST_DEVICE constexpr typeManipulation::CArray< INDEX_TYPE, NDIM > const & stridesArray () const
 
LVARRAY_HOST_DEVICE constexpr BUFFER_TYPE< T > const & dataBuffer () const
 
LVARRAY_HOST_DEVICE CONSTEXPR_WITHOUT_BOUNDS_CHECK std::enable_if_t<(_NDIM > 1), ArraySlice< T, NDIM - 1, USD - 1, INDEX_TYPE > > operator[] (INDEX_TYPE const index) const &noexcept
 
LVARRAY_HOST_DEVICE CONSTEXPR_WITHOUT_BOUNDS_CHECK 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...
 
LVARRAY_HOST_DEVICE CONSTEXPR_WITHOUT_BOUNDS_CHECK std::enable_if_t< _NDIM==1, T & > operator[] (INDEX_TYPE const index) const &noexcept
 
LVARRAY_HOST_DEVICE constexpr T & operator() (INDICES... indices) const
 
LVARRAY_HOST_DEVICE constexpr T * data () const
 
LVARRAY_HOST_DEVICE constexpr T * begin () const
 
LVARRAY_HOST_DEVICE constexpr T * end () const
 
T & front () const
 
T & back () const
 
DISABLE_HD_WARNING 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 zero () const
 Use memset to set all the values in the array to 0. More...
 
MemorySpace getPreviousSpace () const
 
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...
 

Private Member Functions

template<typename ... ARGS>
DISABLE_HD_WARNING LVARRAY_HOST_DEVICE void resizeDefaultDimension (INDEX_TYPE const newDimLength, ARGS &&... args)
 Resize the default dimension of the Array. More...
 

Additional Inherited Members

- Static Public Attributes inherited from LvArray::ArrayView< T, NDIM, typeManipulation::getStrideOneDimension(PERMUTATION {}), INDEX_TYPE, BUFFER_TYPE >
static constexpr int NDIM
 The number of dimensions.
 
static constexpr int USD
 The unit stride dimension.
 
- Protected Member Functions inherited from LvArray::ArrayView< T, NDIM, typeManipulation::getStrideOneDimension(PERMUTATION {}), INDEX_TYPE, BUFFER_TYPE >
DISABLE_HD_WARNING LVARRAY_HOST_DEVICE CONSTEXPR_WITHOUT_BOUNDS_CHECK ArrayView (bool) noexcept
 Protected constructor to be used by the Array class. More...
 
DISABLE_HD_WARNING LVARRAY_HOST_DEVICE constexpr ArrayView (BUFFER_TYPE< T > &&buffer) noexcept
 Protected constructor to be used by the Array class. More...
 
- Protected Attributes inherited from LvArray::ArrayView< T, NDIM, typeManipulation::getStrideOneDimension(PERMUTATION {}), INDEX_TYPE, BUFFER_TYPE >
typeManipulation::CArray< INDEX_TYPE, NDIMm_dims
 the dimensions of the array.
 
typeManipulation::CArray< INDEX_TYPE, NDIMm_strides
 the strides of the array.
 
BUFFER_TYPE< T > m_dataBuffer
 this data member contains the actual data for the array.
 
int m_singleParameterResizeIndex
 

Detailed Description

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
TThe type of data that is contained by the array.
NDIMThe 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.
PERMUTATIONA 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_TYPEthe integer to use for indexing.
BUFFER_TYPEA 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).

Constructor & Destructor Documentation

◆ Array() [1/4]

template<typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
template<typename ... DIMS, typename = std::enable_if_t< sizeof ... ( DIMS ) == NDIM && typeManipulation::all_of_t< std::is_integral< DIMS > ... >::value >>
LVARRAY_HOST_DEVICE LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >::Array ( DIMS const ...  dims)
inlineexplicit

Constructor that takes in the dimensions as a variadic parameter list.

Parameters
dimsthe dimensions of the array in form ( n0, n1,..., n(NDIM-1) )

◆ Array() [2/4]

template<typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >::Array ( BUFFER_TYPE< T > &&  buffer)
inline

Construct an Array from buffer, taking ownership of its contents.

Parameters
bufferThe buffer to construct the Array from.
Note
The Array is empty and buffer is expected to be empty as well.

◆ Array() [3/4]

template<typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >::Array ( Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE > const &  source)
inline

Copy constructor.

Parameters
sourceobject to copy.
Note
Performs a deep copy of source

◆ Array() [4/4]

template<typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >::Array ( Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE > &&  source)
inline

Move constructor.

Parameters
sourceobject to move.
Note
Moves the source into *this. This calls BUFFER_TYPE( BUFFER_TYPE && ) which usually is a shallow copy that invalidates the contents of source. However this depends on the implementation of BUFFER_TYPE.

Member Function Documentation

◆ clear()

template<typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
void LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >::clear ( )
inline

Sets the size of the Array to zero and destroys all the values.

Sets the size of m_singleParameterResizeIndex to 0 but leaves the size of the other dimensions untouched. Equivalent to resize( 0 ).

◆ emplace()

template<typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
template<typename ... ARGS, int _NDIM = NDIM>
std::enable_if_t< _NDIM == 1 > LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >::emplace ( INDEX_TYPE const  pos,
ARGS &&...  args 
)
inline

Insert a value into the array constructing it in place.

Template Parameters
ARGSA variadic pack of the types to construct the new value from.
Parameters
posthe position to insert at.
argsA variadic pack of values to construct the new value from.
Note
This method is only available on 1D arrays.
Returns
void.

◆ emplace_back()

template<typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
template<typename ... ARGS, int _NDIM = NDIM>
std::enable_if_t< _NDIM == 1 > LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >::emplace_back ( ARGS &&...  args)
inline

Construct a value in place at the end of the array.

Template Parameters
ARGSA variadic pack of the types to construct the new value from.
Parameters
argsA variadic pack of values to construct the new value from.
Note
This method is only available on 1D arrays.
Returns
void.

◆ erase()

template<typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
template<int _NDIM = NDIM>
std::enable_if_t< _NDIM == 1 > LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >::erase ( INDEX_TYPE const  pos)
inline

Remove the value at the given position.

Parameters
posthe position of the value to remove.
Note
This method is only available on 1D arrays.
Returns
void.

◆ insert()

template<typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
template<typename ITER , int _NDIM = NDIM>
std::enable_if_t< _NDIM == 1 > LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >::insert ( INDEX_TYPE const  pos,
ITER const  first,
ITER const  last 
)
inline

Insert values into the array at the given position.

Template Parameters
ITERAn iterator type, they type of first and last.
Parameters
posThe position to insert at.
firstAn iterator to the first value to insert.
lastAn iterator to the last value to insert.
Note
This method is only available on 1D arrays.
Returns
None.

◆ operator ArrayView< T const, NDIM, USD, INDEX_TYPE, BUFFER_TYPE >()

template<typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE constexpr LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >::operator ArrayView< T const, NDIM, USD, INDEX_TYPE, BUFFER_TYPE > ( ) const &
inlinenoexcept

A user defined conversion operator (UDC) to an ArrayView< T const, ... >.

Returns
A new ArrayView where T is const.

◆ operator std::enable_if_t< !std::is_const< _T >::value, ArrayView< T const, NDIM, USD, INDEX_TYPE, BUFFER_TYPE > >()

template<typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
template<typename _T = T>
LVARRAY_HOST_DEVICE constexpr LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >::operator std::enable_if_t< !std::is_const< _T >::value, ArrayView< T const, NDIM, USD, INDEX_TYPE, BUFFER_TYPE > > ( ) const &&
inlinedeletenoexcept

Overload for rvalues that is deleted.

Returns
None.
Note
This cannot be called on a rvalue since the ArrayView would contain the buffer of the current Array that is about to be destroyed. This overload prevents that from happening.

◆ operator=() [1/3]

template<typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE Array& LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >::operator= ( Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE > const &  rhs)
inline

Copy assignment operator, performs a deep copy of rhs.

Parameters
rhsSource for the assignment.
Returns
*this.

◆ operator=() [2/3]

template<typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE Array& LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >::operator= ( typename ParentClass::ViewTypeConst const &  rhs)
inline

Copy assignment operator, performs a deep copy of rhs.

Parameters
rhsSource for the assignment.
Returns
*this.

◆ operator=() [3/3]

template<typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE Array& LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >::operator= ( Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE > &&  rhs)
inline

Move assignment operator, performs a shallow copy of rhs.

Parameters
rhsSource for the assignment.
Returns
*this.

◆ pop_back()

template<typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
template<int _NDIM = NDIM>
std::enable_if_t< _NDIM == 1 > LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >::pop_back ( )
inline

Remove the last value in the array.

Note
This method is only available on 1D arrays.
Returns
void.

◆ reserve()

template<typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
void LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >::reserve ( INDEX_TYPE const  newCapacity)
inline

Reserve space in the Array to hold at least the given number of values.

Parameters
newCapacitythe number of values to reserve space for. After this call capacity() >= newCapacity.

◆ resize() [1/3]

template<typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
template<typename DIMS_TYPE >
LVARRAY_HOST_DEVICE void LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >::resize ( int const  numDims,
DIMS_TYPE const *const  dims 
)
inline

Resize the dimensions of the Array to match the given dimensions.

Parameters
numDimsmust equal NDIMS.
dimsthe new size of the dimensions, must be of length NDIM.
Note
This does not preserve the values in the Array NDIM == 1.

◆ resize() [2/3]

template<typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
template<typename ... DIMS>
LVARRAY_HOST_DEVICE std::enable_if_t< sizeof ... ( DIMS ) == NDIM && typeManipulation::all_of_t< std::is_integral< DIMS > ... >::value > LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >::resize ( DIMS const ...  newDims)
inline

function to resize the array.

Template Parameters
DIMSVariadic list of integral types.
Parameters
newDimsThe new dimensions, must be of length NDIM.
Note
This does not preserve the values in the Array unless NDIM == 1.
Returns
void.

◆ resize() [3/3]

template<typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE void LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >::resize ( INDEX_TYPE const  newdim)
inline

Resize the default dimension of the Array.

Parameters
newdimthe new size of the default dimension.
Note
This preserves the values in the Array.
The default dimension is given by m_singleParameterResizeIndex.

◆ resizeDefault()

template<typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE void LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >::resizeDefault ( INDEX_TYPE const  newdim,
T const &  defaultValue 
)
inline

Resize the default dimension of the Array.

Parameters
newdimthe new size of the default dimension.
defaultValuethe value to initialize the new values with.
Note
This preserves the values in the Array.
The default dimension is given by m_singleParameterResizeIndex.

◆ resizeDefaultDimension()

template<typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
template<typename ... ARGS>
DISABLE_HD_WARNING LVARRAY_HOST_DEVICE void LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >::resizeDefaultDimension ( INDEX_TYPE const  newDimLength,
ARGS &&...  args 
)
inlineprivate

Resize the default dimension of the Array.

Template Parameters
ARGSvariadic pack containing the types to initialize the new values with.
Parameters
newDimLengththe new size of the default dimension.
argsarguments to initialize the new values with.
Note
This preserves the values in the Array.
The default dimension is given by m_singleParameterResizeIndex.

◆ resizeDimension()

template<typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
template<INDEX_TYPE... INDICES, typename ... DIMS>
LVARRAY_HOST_DEVICE void LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >::resizeDimension ( DIMS const ...  newDims)
inline

Resize specific dimensions of the array.

Template Parameters
INDICESthe indices of the dimensions to resize, should be sorted an unique.
DIMSvariadic pack containing the dimension types
Parameters
newDimsthe new dimensions. newDims[ 0 ] will be the new size of dimensions INDICES[ 0 ].
Note
This does not preserve the values in the Array unless NDIM == 1.

◆ resizeWithoutInitializationOrDestruction() [1/2]

template<typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
template<typename ... DIMS>
LVARRAY_HOST_DEVICE void LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >::resizeWithoutInitializationOrDestruction ( DIMS const ...  newDims)
inline

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.

Template Parameters
DIMSVariadic list of integral types.
Parameters
newDimsThe new dimensions, must be of length NDIM.
Note
This does not preserve the values in the Array unless NDIM == 1.

◆ resizeWithoutInitializationOrDestruction() [2/2]

template<typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
template<typename ... DIMS>
LVARRAY_HOST_DEVICE void LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >::resizeWithoutInitializationOrDestruction ( MemorySpace const  space,
DIMS const ...  newDims 
)
inline

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.

Template Parameters
DIMSVariadic list of integral types.
Parameters
spaceThe space to perform the resize in.
newDimsThe new dimensions, must be of length NDIM.
Note
This does not preserve the values in the Array unless NDIM == 1.

◆ setName()

template<typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
void LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >::setName ( std::string const &  name)
inline

Set the name to be displayed whenever the underlying Buffer's user call back is called.

Parameters
namethe name of the Array.

◆ setSingleParameterResizeIndex()

template<typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE void LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >::setSingleParameterResizeIndex ( int const  index)
inline

Set the default resize dimension.

Parameters
indexThe new default dimension.

◆ toNestedView()

template<typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE constexpr NestedViewType LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >::toNestedView ( ) const &&
inlinedelete

Overload for rvalues that is deleted.

Returns
None.
Note
This cannot be called on a rvalue since the ArrayView would contain the buffer of the current Array that is about to be destroyed. This overload prevents that from happening.

◆ toNestedViewConst()

template<typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE constexpr NestedViewTypeConst LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >::toNestedViewConst ( ) const &&
inlinedelete

Overload for rvalues that is deleted.

Returns
None.
Note
This cannot be called on a rvalue since the ArrayView would contain the buffer of the current Array that is about to be destroyed. This overload prevents that from happening.

◆ toView()

template<typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE constexpr ArrayView< T, NDIM, USD, INDEX_TYPE, BUFFER_TYPE > LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >::toView ( ) const &&
inlinedelete

Overload for rvalues that is deleted.

Returns
None.
Note
This cannot be called on a rvalue since the ArrayView would contain the buffer of the current Array that is about to be destroyed. This overload prevents that from happening.

◆ toViewConst()

template<typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE constexpr ArrayView< T const, NDIM, USD, INDEX_TYPE, BUFFER_TYPE > LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE, BUFFER_TYPE >::toViewConst ( ) const &&
inlinedelete

Overload for rvalues that is deleted.

Returns
None.
Note
This cannot be called on a rvalue since the ArrayView would contain the buffer of the current Array that is about to be destroyed. This overload prevents that from happening.

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