|
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.
|
|
|
|
| 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...
|
|
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 |
| 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...
|
|
template<typename _T = T> |
constexpr | operator std::enable_if_t< !std::is_const< _T >::value, ArraySlice< T const, NDIM, USD, INDEX_TYPE > const > () const &noexcept |
|
template<typename _T = T> |
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 |
|
template<typename ... INDICES> |
constexpr INDEX_TYPE | linearIndex (INDICES const ... indices) const |
|
constexpr INDEX_TYPE const * | dims () const noexcept |
|
constexpr INDEX_TYPE const * | strides () const noexcept |
|
|
template<int _NDIM = NDIM> |
constexpr std::enable_if_t<(_NDIM > 1), ArraySlice< T, NDIM - 1, USD - 1, INDEX_TYPE > > | operator[] (INDEX_TYPE const index) const &noexcept |
|
template<int _NDIM = NDIM> |
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...
|
|
template<int _NDIM = NDIM> |
constexpr std::enable_if_t< _NDIM==1, T &> | operator[] (INDEX_TYPE const index) const &noexcept |
|
template<typename ... INDICES> |
constexpr T & | operator() (INDICES... indices) const |
|
constexpr T * | data () const |
|
constexpr T * | begin () const |
|
constexpr T * | end () const |
|
T & | front () const |
|
T & | back () const |
|
|
template<typename POLICY > |
void | setValues (T const &value) const |
| Set all entries in the array to value . More...
|
|
template<typename POLICY > |
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_TPARAM, int USD_TPARAM, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
class LvArray::ArrayView< T, NDIM_TPARAM, USD_TPARAM, INDEX_TYPE, BUFFER_TYPE >
This class serves to provide a "view" of a multidimensional array.
- Template Parameters
-
T | type of data that is contained by the array |
NDIM_TPARAM | number of dimensions in array (e.g. NDIM=1->vector, NDIM=2->Matrix, etc. ). |
USD | the dimension with a unit stride, in an Array with a standard layout this is the last dimension. |
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). |
When using the ChaiBuffer the copy copy constructor of this class calls the copy constructor for the ChaiBuffer which will move the data to the location of the touch (host or device). In general, the ArrayView should be what is passed by value into a lambda that is used to launch kernels as it copy will trigger the desired data motion onto the appropriate memory space.
Key features: 1) When using a ChaiBuffer as the BUFFER_TYPE the ArrayView copy constructor will move the data to the current execution space. 2) Defines a slicing operator[]. 3) Defines operator() array accessor. 3) operator[] and operator() are all const and may be called in non-mutable lambdas. 4) Conversion operators to go from ArrayView<T> to ArrayView<T const>. 5) Since the Array is derived from ArrayView, it may be upcasted: Array<T,NDIM> array; ArrayView<T,NDIM> const & arrView = array;
A good guideline is to upcast to an ArrayView when you don't need allocation capabilities that are only present in Array.
Definition at line 67 of file ArrayView.hpp.