LvArray
Public Types | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE > Class Template Reference

This class provides a view into an array of arrays like object. More...

#include <ArrayOfArraysView.hpp>

Public Types

using ValueType = T
 An alias for the type contained in the inner arrays.
 
using IndexType = INDEX_TYPE
 The integer type used for indexing.
 
using value_type = T
 An alias for the type contained in the inner arrays, here for stl compatability.
 
using size_type = INDEX_TYPE
 The integer type used for indexing, here for stl compatability.
 

Public Member Functions

Constructors, destructor and assignment operators
 ArrayOfArraysView ()=default
 A constructor to create an uninitialized ArrayOfArraysView. More...
 
 ArrayOfArraysView (ArrayOfArraysView const &)=default
 Default copy constructor. More...
 
LVARRAY_HOST_DEVICE constexpr ArrayOfArraysView (ArrayOfArraysView &&src)
 Default move constructor. More...
 
LVARRAY_HOST_DEVICE constexpr ArrayOfArraysView (INDEX_TYPE const numArrays, BUFFER_TYPE< INDEX_TYPE > const &offsets, BUFFER_TYPE< SIZE_TYPE > const &sizes, BUFFER_TYPE< T > const &values)
 Construct a new ArrayOfArraysView from the given buffers. More...
 
ArrayOfArraysViewoperator= (ArrayOfArraysView const &)=default
 Default copy assignment operator. More...
 
LVARRAY_HOST_DEVICE ArrayOfArraysViewoperator= (ArrayOfArraysView &&src)
 Move assignment operator.. More...
 
ArrayOfArraysView creation methods
LVARRAY_HOST_DEVICE constexpr ArrayOfArraysView< T, INDEX_TYPE const, CONST_SIZES, BUFFER_TYPE > toView () const
 
LVARRAY_HOST_DEVICE constexpr ArrayOfArraysView< T, INDEX_TYPE const, true, BUFFER_TYPE > toViewConstSizes () const
 
LVARRAY_HOST_DEVICE constexpr ArrayOfArraysView< T const, INDEX_TYPE const, true, BUFFER_TYPE > toViewConst () const
 
Attribute querying methods
LVARRAY_HOST_DEVICE constexpr INDEX_TYPE_NC size () const
 
LVARRAY_HOST_DEVICE CONSTEXPR_WITHOUT_BOUNDS_CHECK INDEX_TYPE_NC sizeOfArray (INDEX_TYPE const i) const
 
LVARRAY_HOST_DEVICE constexpr SIZE_TYPE const * getSizes () const
 
LVARRAY_HOST_DEVICE constexpr INDEX_TYPE const * getOffsets () const
 
LVARRAY_HOST_DEVICE constexpr T const * getValues () const
 
LVARRAY_HOST_DEVICE CONSTEXPR_WITH_NDEBUG INDEX_TYPE_NC capacity () const
 
LVARRAY_HOST_DEVICE CONSTEXPR_WITHOUT_BOUNDS_CHECK INDEX_TYPE_NC capacityOfArray (INDEX_TYPE const i) const
 
LVARRAY_HOST_DEVICE constexpr INDEX_TYPE_NC valueCapacity () const
 
Methods that provide access to the data
LVARRAY_HOST_DEVICE CONSTEXPR_WITHOUT_BOUNDS_CHECK ArraySlice< T, 1, 0, INDEX_TYPE_NCoperator[] (INDEX_TYPE const i) const
 
LVARRAY_HOST_DEVICE CONSTEXPR_WITHOUT_BOUNDS_CHECK T & operator() (INDEX_TYPE const i, INDEX_TYPE const j) const
 
Methods that modify the size of an inner array.
template<typename ... ARGS>
LVARRAY_HOST_DEVICE void emplaceBack (INDEX_TYPE const i, ARGS &&... args) const
 Append a value to an array. More...
 
template<typename POLICY , typename ... ARGS>
LVARRAY_HOST_DEVICE void emplaceBackAtomic (INDEX_TYPE const i, ARGS &&... args) const
 Append a value to an array in a thread safe manner. More...
 
template<typename ITER >
LVARRAY_HOST_DEVICE void appendToArray (INDEX_TYPE const i, ITER const first, ITER const last) const
 Append values to an array. More...
 
template<typename ... ARGS>
LVARRAY_HOST_DEVICE void emplace (INDEX_TYPE const i, INDEX_TYPE const j, ARGS &&... args) const
 Insert a value into an array. More...
 
template<typename ITER >
LVARRAY_HOST_DEVICE void insertIntoArray (INDEX_TYPE const i, INDEX_TYPE const j, ITER const first, ITER const last) const
 Insert values into an array. More...
 
LVARRAY_HOST_DEVICE void eraseFromArray (INDEX_TYPE const i, INDEX_TYPE const j, INDEX_TYPE const n=1) const
 Erase values from an array. More...
 
Methods dealing with memory spaces
void registerTouch (MemorySpace const space) const
 Touch the memory in space. More...
 
void move (MemorySpace const space, bool touch=true) const
 Move this ArrayOfArrays to the given memory space. More...
 

Protected Types

using INDEX_TYPE_NC = std::remove_const_t< INDEX_TYPE >
 Since INDEX_TYPE should always be const we need an alias for the non const version.
 
using SIZE_TYPE = std::conditional_t< CONST_SIZES, INDEX_TYPE const, INDEX_TYPE_NC >
 The type contained by the m_sizes buffer.
 
template<typename U >
using PairOfBuffers = std::pair< BUFFER_TYPE< U > &, BUFFER_TYPE< U > const &>
 Alias for a std::pair of buffers. More...
 

Protected Member Functions

 ArrayOfArraysView (bool)
 Protected constructor to be used by parent classes. More...
 
Methods intended to be publically aliased directly in a derived array class.
void resize (INDEX_TYPE const newSize, INDEX_TYPE const defaultArrayCapacity=0)
 Set the number of arrays. More...
 
void reserve (INDEX_TYPE const newCapacity)
 Reserve space for the given number of arrays. More...
 
template<class ... BUFFERS>
void reserveValues (INDEX_TYPE const newValueCapacity, BUFFERS &... buffers)
 Reserve space for the given number of values. More...
 
template<class ... BUFFERS>
void compress (BUFFERS &... buffers)
 Compress the arrays so that the values of each array are contiguous with no extra capacity in between. More...
 
template<typename ... BUFFERS>
void resizeFromOffsets (INDEX_TYPE const numSubArrays, INDEX_TYPE const *const offsets, BUFFERS &... buffers)
 Clears the array and creates a new array with the given number of sub-arrays. More...
 
template<typename POLICY , typename ... BUFFERS>
void resizeFromCapacities (INDEX_TYPE const numSubArrays, INDEX_TYPE const *const capacities, BUFFERS &... buffers)
 Clears the array and creates a new array with the given number of sub-arrays. More...
 
Methods to be used to help implement a derived classes
void assimilate (ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE > &&src)
 Steal the resources of src, clearing it in the process. More...
 
template<typename ... BUFFERS>
void resizeImpl (INDEX_TYPE const newSize, INDEX_TYPE const defaultArrayCapacity, BUFFERS &... buffers)
 Set the number of arrays. More...
 
template<class ... BUFFERS>
void free (BUFFERS &... buffers)
 Destroy all the objects held by this array and free all associated memory. More...
 
template<class ... PAIRS_OF_BUFFERS>
void setEqualTo (INDEX_TYPE const srcNumArrays, INDEX_TYPE const srcMaxOffset, BUFFER_TYPE< INDEX_TYPE > const &srcOffsets, BUFFER_TYPE< INDEX_TYPE > const &srcSizes, BUFFER_TYPE< T > const &srcValues, PAIRS_OF_BUFFERS &&... pairs)
 Set this ArrayOfArraysView equal to the provided arrays. More...
 
template<class ... BUFFERS>
void setCapacityOfArray (INDEX_TYPE const i, INDEX_TYPE const newCapacity, BUFFERS &... buffers)
 Set the capacity of the given array. More...
 
template<typename U >
void setName (std::string const &name)
 Set the name to be displayed whenever the underlying Buffer's user call back is called. More...
 

Protected Attributes

INDEX_TYPE_NC m_numArrays = 0
 The number of arrays contained.
 
BUFFER_TYPE< INDEX_TYPE > m_offsets
 
BUFFER_TYPE< SIZE_TYPEm_sizes
 Holds the size of each array.
 
BUFFER_TYPE< T > m_values
 

Private Member Functions

template<class ... BUFFERS>
void destroyValues (INDEX_TYPE const begin, INDEX_TYPE const end, BUFFERS &... buffers)
 Destroy the values in arrays in the range [begin, end). More...
 
template<typename FUNC , typename ... BUFFERS>
void resizeFromOffsetsImpl (INDEX_TYPE const numSubArrays, FUNC &&fillOffsets, BUFFERS &... buffers)
 Clears the array and creates a new array with the given number of sub-arrays. More...
 

Detailed Description

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
class LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >

This class provides a view into an array of arrays like object.

Template Parameters
Tthe type stored in the arrays.
INDEX_TYPEthe integer to use for indexing.
CONST_SIZEStrue iff the size of each array is constant.

When INDEX_TYPE is const m_offsets is not copied between memory spaces. When accessing this class directly (not through an ArrayOfArrays object) INDEX_TYPE should always be const since ArrayOfArraysView is not allowed to modify the offsets.

When CONST_SIZES is true m_sizes is not copied between memory spaces.

Member Typedef Documentation

◆ PairOfBuffers

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
template<typename U >
using LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::PairOfBuffers = std::pair< BUFFER_TYPE< U > &, BUFFER_TYPE< U > const & >
protected

Alias for a std::pair of buffers.

Template Parameters
UThe type contained in the buffers.

Constructor & Destructor Documentation

◆ ArrayOfArraysView() [1/5]

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::ArrayOfArraysView ( )
default

A constructor to create an uninitialized ArrayOfArraysView.

Note
An uninitialized ArrayOfArraysView should not be used until it is assigned to.

◆ ArrayOfArraysView() [2/5]

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::ArrayOfArraysView ( ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE > const &  )
default

Default copy constructor.

Note
The copy constructor will trigger the copy constructor for
Template Parameters
BUFFER_TYPE

◆ ArrayOfArraysView() [3/5]

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE constexpr LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::ArrayOfArraysView ( ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE > &&  src)
inline

Default move constructor.

Parameters
srcthe ArrayOfArraysView to be moved from.

◆ ArrayOfArraysView() [4/5]

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE constexpr LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::ArrayOfArraysView ( INDEX_TYPE const  numArrays,
BUFFER_TYPE< INDEX_TYPE > const &  offsets,
BUFFER_TYPE< SIZE_TYPE > const &  sizes,
BUFFER_TYPE< T > const &  values 
)
inline

Construct a new ArrayOfArraysView from the given buffers.

Parameters
numArraysThe number of arrays.
offsetsThe offsets buffer, of size numArrays + 1.
sizesThe sizes buffer, of size numArrays.
valuesThe values buffer, of size offsets[ numArrays ].

◆ ArrayOfArraysView() [5/5]

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::ArrayOfArraysView ( bool  )
inlineprotected

Protected constructor to be used by parent classes.

Note
The unused boolean parameter is to distinguish this from the default constructor.

Member Function Documentation

◆ appendToArray()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
template<typename ITER >
LVARRAY_HOST_DEVICE void LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::appendToArray ( INDEX_TYPE const  i,
ITER const  first,
ITER const  last 
) const
inline

Append values to an array.

Template Parameters
ITERAn iterator, they type of first and last.
Parameters
ithe array to append to.
firstAn iterator to the first value to append.
lastAn iterator to the end of the values to append.
Precondition
Since the ArrayOfArraysView can't do reallocation or shift the offsets it is up to the user to ensure that the given array has enough space for the new values.

◆ assimilate()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
void LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::assimilate ( ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE > &&  src)
inlineprotected

Steal the resources of src, clearing it in the process.

Parameters
srcThe ArrayOfArraysView to steal from.

◆ capacity()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE CONSTEXPR_WITH_NDEBUG INDEX_TYPE_NC LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::capacity ( ) const
inline
Returns
Return the number of (zero length) arrays that can be stored before reallocation.

◆ capacityOfArray()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE CONSTEXPR_WITHOUT_BOUNDS_CHECK INDEX_TYPE_NC LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::capacityOfArray ( INDEX_TYPE const  i) const
inline
Returns
Return the capacity of the given array.
Parameters
ithe array to query.

◆ compress()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
template<class ... BUFFERS>
void LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::compress ( BUFFERS &...  buffers)
inlineprotected

Compress the arrays so that the values of each array are contiguous with no extra capacity in between.

Template Parameters
BUFFERSvariadic template where each type is a BUFFER_TYPE.
Parameters
buffersvariadic parameter pack where each argument is a BUFFER_TYPE that should be treated similarly to m_values.
Note
This method doesn't free any memory.

◆ destroyValues()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
template<class ... BUFFERS>
void LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::destroyValues ( INDEX_TYPE const  begin,
INDEX_TYPE const  end,
BUFFERS &...  buffers 
)
inlineprivate

Destroy the values in arrays in the range [begin, end).

Template Parameters
BUFFERSvariadic template where each type is a BUFFER_TYPE.
Parameters
beginthe array to start with.
endwhere to stop destroying values.
buffersvariadic parameter pack where each argument is a BUFFER_TYPE that should be treated similarly to m_values.
Note
This is to be use by the non-view derived classes.
This doesn't free any memory.

◆ emplace()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
template<typename ... ARGS>
LVARRAY_HOST_DEVICE void LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::emplace ( INDEX_TYPE const  i,
INDEX_TYPE const  j,
ARGS &&...  args 
) const
inline

Insert a value into an array.

Template Parameters
ARGSA variadic pack of types used to construct the new T, the types of args.
Parameters
ithe array to insert into.
jthe position at which to insert.
argsThe variadic pack of arguments forwared to construct the new value.
Precondition
Since the ArrayOfArraysView can't do reallocation or shift the offsets it is up to the user to ensure that the given array has enough space for the new values.

◆ emplaceBack()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
template<typename ... ARGS>
LVARRAY_HOST_DEVICE void LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::emplaceBack ( INDEX_TYPE const  i,
ARGS &&...  args 
) const
inline

Append a value to an array.

Template Parameters
ARGSA variadic pack of types used to construct the new T, the types of args.
Parameters
ithe array to append to.
argsThe variadic pack of arguments forwared to construct the new value.
Precondition
Since the ArrayOfArraysView can't do reallocation or shift the offsets it is up to the user to ensure that the given array has enough space for the new values.

◆ emplaceBackAtomic()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
template<typename POLICY , typename ... ARGS>
LVARRAY_HOST_DEVICE void LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::emplaceBackAtomic ( INDEX_TYPE const  i,
ARGS &&...  args 
) const
inline

Append a value to an array in a thread safe manner.

Template Parameters
POLICYThe RAJA atomic policy to use to increment the size of the array.
ARGSA variadic pack of types used to construct the new T, the types of args.
Parameters
ithe array to append to.
argsThe variadic pack of arguments forwared to construct the new value.
Precondition
Since the ArrayOfArraysView can't do reallocation or shift the offsets it is up to the user to ensure that the given array has enough space for the new values.

◆ eraseFromArray()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE void LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::eraseFromArray ( INDEX_TYPE const  i,
INDEX_TYPE const  j,
INDEX_TYPE const  n = 1 
) const
inline

Erase values from an array.

Parameters
ithe array to erase values from.
jthe position at which to begin erasing.
nthe number of values to erase.

◆ free()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
template<class ... BUFFERS>
void LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::free ( BUFFERS &...  buffers)
inlineprotected

Destroy all the objects held by this array and free all associated memory.

Template Parameters
BUFFERSvariadic template where each type is a BUFFER_TYPE.
Parameters
buffersvariadic parameter pack where each argument is a BUFFER_TYPE that should be treated similarly to m_values.

◆ getOffsets()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE constexpr INDEX_TYPE const* LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::getOffsets ( ) const
inline
Returns
Return a pointer to the value array offsets for each outer array with an entry for the end of the values.

◆ getSizes()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE constexpr SIZE_TYPE const* LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::getSizes ( ) const
inline
Returns
Return a pointer to the sizes of each outer array.

◆ getValues()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE constexpr T const* LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::getValues ( ) const
inline
Returns
Return a pointer to the values data.

◆ insertIntoArray()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
template<typename ITER >
LVARRAY_HOST_DEVICE void LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::insertIntoArray ( INDEX_TYPE const  i,
INDEX_TYPE const  j,
ITER const  first,
ITER const  last 
) const
inline

Insert values into an array.

Template Parameters
ITERAn iterator, they type of first and last.
Parameters
ithe array to insert into.
jthe position at which to insert.
firstAn iterator to the first value to insert.
lastAn iterator to the end of the values to insert.
Precondition
Since the ArrayOfArraysView can't do reallocation or shift the offsets it is up to the user to ensure that the given array has enough space for the new values.

◆ move()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
void LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::move ( MemorySpace const  space,
bool  touch = true 
) const
inline

Move this ArrayOfArrays to the given memory space.

Parameters
spaceThe memory space to move to.
touchIf true touch the values, sizes and offsets in the new space.
Note
When moving to the GPU since the offsets can't be modified on device they are not touched.

◆ operator()()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE CONSTEXPR_WITHOUT_BOUNDS_CHECK T& LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::operator() ( INDEX_TYPE const  i,
INDEX_TYPE const  j 
) const
inline
Returns
Return a reference to the value at the given position in the given array.
Parameters
ithe array to access.
jthe index within the array to access.

◆ operator=() [1/2]

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
ArrayOfArraysView& LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::operator= ( ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE > const &  )
inlinedefault

Default copy assignment operator.

Returns
*this.

◆ operator=() [2/2]

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE ArrayOfArraysView& LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::operator= ( ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE > &&  src)
inline

Move assignment operator..

Parameters
srcthe SparsityPatternView to be moved from.
Returns
*this.

◆ operator[]()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE CONSTEXPR_WITHOUT_BOUNDS_CHECK ArraySlice< T, 1, 0, INDEX_TYPE_NC > LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::operator[] ( INDEX_TYPE const  i) const
inline
Returns
Return an ArraySlice1d to the values of the given array.
Parameters
ithe array to access.

◆ registerTouch()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
void LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::registerTouch ( MemorySpace const  space) const
inline

Touch the memory in space.

Parameters
spaceThe memory space in which a touch will be recorded.

◆ reserve()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
void LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::reserve ( INDEX_TYPE const  newCapacity)
inlineprotected

Reserve space for the given number of arrays.

Parameters
newCapacitythe new minimum capacity for the number of arrays.

◆ reserveValues()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
template<class ... BUFFERS>
void LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::reserveValues ( INDEX_TYPE const  newValueCapacity,
BUFFERS &...  buffers 
)
inlineprotected

Reserve space for the given number of values.

Template Parameters
BUFFERSvariadic template where each type is a BUFFER_TYPE.
Parameters
newValueCapacitythe new minimum capacity for the number of values across all arrays.
buffersvariadic parameter pack where each argument is a BUFFER_TYPE that should be treated similarly to m_values.

◆ resize()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
void LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::resize ( INDEX_TYPE const  newSize,
INDEX_TYPE const  defaultArrayCapacity = 0 
)
inlineprotected

Set the number of arrays.

Parameters
newSizethe new number of arrays.
defaultArrayCapacitythe default capacity for each new array.

◆ resizeFromCapacities()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
template<typename POLICY , typename ... BUFFERS>
void LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::resizeFromCapacities ( INDEX_TYPE const  numSubArrays,
INDEX_TYPE const *const  capacities,
BUFFERS &...  buffers 
)
inlineprotected

Clears the array and creates a new array with the given number of sub-arrays.

Template Parameters
POLICYThe RAJA policy used to convert capacities into the offsets array. Should NOT be a device policy.
Parameters
numSubArraysThe new number of arrays.
capacitiesA pointer to an array of length numSubArrays containing the capacity of each new sub array.
buffersA variadic pack of buffers to treat similarly to m_values.

◆ resizeFromOffsets()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
template<typename ... BUFFERS>
void LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::resizeFromOffsets ( INDEX_TYPE const  numSubArrays,
INDEX_TYPE const *const  offsets,
BUFFERS &...  buffers 
)
inlineprotected

Clears the array and creates a new array with the given number of sub-arrays.

Parameters
numSubArraysThe new number of arrays.
offsetsA pointer to an array of length numSubArrays+1 containing the offset of each new sub array. Offsets are precomputed by the caller.
buffersA variadic pack of buffers to treat similarly to m_values.

◆ resizeFromOffsetsImpl()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
template<typename FUNC , typename ... BUFFERS>
void LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::resizeFromOffsetsImpl ( INDEX_TYPE const  numSubArrays,
FUNC &&  fillOffsets,
BUFFERS &...  buffers 
)
inlineprivate

Clears the array and creates a new array with the given number of sub-arrays.

Parameters
numSubArraysThe new number of arrays.
fillOffsetsA function that will be called to populate sub-array offsets.
buffersA variadic pack of buffers to treat similarly to m_values.
Note
This is to be called by other resizeFrom functions.

◆ resizeImpl()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
template<typename ... BUFFERS>
void LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::resizeImpl ( INDEX_TYPE const  newSize,
INDEX_TYPE const  defaultArrayCapacity,
BUFFERS &...  buffers 
)
inlineprotected

Set the number of arrays.

Parameters
newSizethe new number of arrays.
defaultArrayCapacitythe default capacity for each new array.
Template Parameters
BUFFERSvariadic template where each type is BUFFER_TYPE.
Parameters
buffersvariadic parameter pack where each argument is a BUFFER_TYPE that should be treated similarly to m_values.

◆ setCapacityOfArray()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
template<class ... BUFFERS>
void LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::setCapacityOfArray ( INDEX_TYPE const  i,
INDEX_TYPE const  newCapacity,
BUFFERS &...  buffers 
)
inlineprotected

Set the capacity of the given array.

Template Parameters
BUFFERSvariadic template where each type is a BUFFER_TYPE.
Parameters
ithe array to set the capacity of.
newCapacitythe value to set the capacity of the given array to.
buffersvariadic parameter pack where each argument is a BUFFER_TYPE that should be treated similarly to m_values.

◆ setEqualTo()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
template<class ... PAIRS_OF_BUFFERS>
void LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::setEqualTo ( INDEX_TYPE const  srcNumArrays,
INDEX_TYPE const  srcMaxOffset,
BUFFER_TYPE< INDEX_TYPE > const &  srcOffsets,
BUFFER_TYPE< INDEX_TYPE > const &  srcSizes,
BUFFER_TYPE< T > const &  srcValues,
PAIRS_OF_BUFFERS &&...  pairs 
)
inlineprotected

Set this ArrayOfArraysView equal to the provided arrays.

Template Parameters
PAIRS_OF_BUFFERSvariadic template where each type is an PairOfBuffers.
Parameters
srcNumArraysThe number of arrays in source.
srcMaxOffsetThe maximum offset in the source.
srcOffsetsthe source offsets array.
srcSizesthe source sizes array.
srcValuesthe source values array.
pairsvariadic parameter pack where each argument is an PairOfBuffers where each pair should be treated similarly to {m_values, srcValues}.

◆ setName()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
template<typename U >
void LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::setName ( std::string const &  name)
inlineprotected

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

Template Parameters
UThey type of the owning object.
Parameters
namethe name to display.

◆ size()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE constexpr INDEX_TYPE_NC LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::size ( ) const
inline
Returns
Return the number of arrays.

◆ sizeOfArray()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE CONSTEXPR_WITHOUT_BOUNDS_CHECK INDEX_TYPE_NC LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::sizeOfArray ( INDEX_TYPE const  i) const
inline
Returns
Return the size of the given array.
Parameters
ithe array to query.

◆ toView()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE constexpr ArrayOfArraysView< T, INDEX_TYPE const, CONST_SIZES, BUFFER_TYPE > LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::toView ( ) const
inline
Returns
Return a new ArrayOfArraysView<T, INDEX_TYPE const, CONST_SIZES>.

◆ toViewConst()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE constexpr ArrayOfArraysView< T const, INDEX_TYPE const, true, BUFFER_TYPE > LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::toViewConst ( ) const
inline
Returns
Return a new ArrayOfArraysView<T const, INDEX_TYPE const, true>.

◆ toViewConstSizes()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE constexpr ArrayOfArraysView< T, INDEX_TYPE const, true, BUFFER_TYPE > LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::toViewConstSizes ( ) const
inline
Returns
Return a new ArrayOfArraysView<T, INDEX_TYPE const, true>.

◆ valueCapacity()

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE constexpr INDEX_TYPE_NC LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::valueCapacity ( ) const
inline
Returns
Return the total number values that can be stored before reallocation.

Member Data Documentation

◆ m_offsets

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
BUFFER_TYPE< INDEX_TYPE > LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::m_offsets
protected

Holds the offset of each array, of length m_numArrays + 1. Array i begins at m_offsets[ i ] and has capacity m_offsets[i+1] - m_offsets[ i ].

◆ m_values

template<typename T, typename INDEX_TYPE, bool CONST_SIZES, template< typename > class BUFFER_TYPE>
BUFFER_TYPE< T > LvArray::ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE >::m_values
protected

Holds the values of each array. Values in the range [m_offsets[ i ], m_offsets[ i ] + m_sizes[ i ]) are valid. All other entries contain uninitialized values.


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