19 #include <type_traits>
25 template<
typename TDev,
typename TElem,
typename TDim,
typename TIdx>
28 static_assert(!std::is_const_v<TIdx>,
"The idx type of the view can not be const!");
37 template<
typename TQualifiedView,
typename TOffsets,
typename TExtent>
40 TExtent
const& extentElements,
41 TOffsets
const& relativeOffsetsElements = TOffsets())
49 using View = std::remove_cv_t<TQualifiedView>;
53 "The dev type of TView and the Dev template parameter have to be identical!");
57 "The idx type of TView and the TIdx template parameter have to be identical!");
60 "The idx type of TExtent and the TIdx template parameter have to be identical!");
63 "The idx type of TOffsets and the TIdx template parameter have to be identical!");
67 "The dim type of TView and the TDim template parameter have to be identical!");
70 "The dim type of TExtent and the TDim template parameter have to be identical!");
73 "The dim type of TOffsets and the TDim template parameter have to be identical!");
79 template<
typename TView>
86 template<
typename TView>
96 # pragma GCC diagnostic push
98 # pragma GCC diagnostic ignored "-Wcast-align"
100 return reinterpret_cast<TElem*
>(
104 # pragma GCC diagnostic pop
118 template<
typename TElem,
typename TDim,
typename TDev,
typename TIdx>
125 template<
typename TElem,
typename TDim,
typename TDev,
typename TIdx>
135 template<
typename TElem,
typename TDim,
typename TDev,
typename TIdx>
142 template<
typename TElem,
typename TDim,
typename TDev,
typename TIdx>
149 template<
typename TElem,
typename TDim,
typename TDev,
typename TIdx>
159 template<
typename TElem,
typename TDim,
typename TDev,
typename TIdx>
164 return view.m_nativePtr;
169 return view.m_nativePtr;
174 template<
typename TDev,
typename TElem,
typename TDim,
typename TIdx>
184 template<
typename TElem,
typename TDim,
typename TDev,
typename TIdx>
189 return offset.m_offsetsElements;
194 template<
typename TElem,
typename TDim,
typename TDev,
typename TIdx>
201 template<
typename TDev,
typename TSfinae>
204 template<
typename TView,
typename TExtent,
typename TOffsets>
207 TExtent
const& extentElements,
208 TOffsets
const& relativeOffsetsElements)
#define ALPAKA_ASSERT(...)
The assert can be explicit disabled by defining NDEBUG.
#define ALPAKA_DEBUG_FULL_LOG_SCOPE
ViewPlainPtr< Dev, TElem, TDim, TIdx > m_viewParentView
Vec< TDim, TIdx > m_extentElements
ALPAKA_FN_HOST auto computeNativePtr()
ViewSubView(TQualifiedView &view, TExtent const &extentElements, TOffsets const &relativeOffsetsElements=TOffsets())
Constructor.
ViewSubView(TView const &view)
Vec< TDim, TIdx > m_offsetsElements
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_ACC auto all(TWarp const &warp, std::int32_t predicate) -> std::int32_t
Evaluates predicate for all active threads of the warp and returns non-zero if and only if predicate ...
The alpaka accelerator library.
typename trait::IdxType< T >::type Idx
typename trait::DevType< T >::type Dev
The device type trait alias template to remove the ::type.
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_HOST_ACC auto getExtents(T const &object) -> Vec< Dim< T >, Idx< T >>
ALPAKA_FN_HOST auto getPitchesInBytes(TView const &view) -> Vec< Dim< TView >, Idx< TView >>
ALPAKA_FN_HOST auto getPtrNative(TView const &view) -> Elem< TView > const *
Gets the native pointer of the memory view.
std::remove_volatile_t< typename trait::ElemType< TView >::type > Elem
The element type trait alias template to remove the ::type.
ALPAKA_FN_HOST auto getDev(T const &t)
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_HOST_ACC auto getOffsets(T const &object) -> Vec< Dim< T >, Idx< T >>
typename trait::DimType< T >::type Dim
The dimension type trait alias template to remove the ::type.
The sub view creation trait.
static auto createSubView(TView &view, TExtent const &extentElements, TOffsets const &relativeOffsetsElements)
The dimension getter type trait.
static ALPAKA_FN_HOST auto getDev(ViewSubView< TDev, TElem, TDim, TIdx > const &view) -> alpaka::Dev< TDev >
ALPAKA_FN_HOST auto operator()(ViewSubView< TDev, TElem, TDim, TIdx > const &view) const
The GetExtents trait for getting the extents of an object as an alpaka::Vec.
ALPAKA_FN_HOST auto operator()(ViewSubView< TDev, TElem, TDim, TIdx > const &offset)
The GetOffsets trait for getting the offsets of an object as an alpaka::Vec.
ALPAKA_FN_HOST auto operator()(ViewSubView< TDev, TElem, TDim, TIdx > const &view) const
Customization point for getPitchesInBytes. The default implementation uses the extent to calculate th...
static ALPAKA_FN_HOST auto getPtrNative(ViewSubView< TDev, TElem, TDim, TIdx > const &view) -> TElem const *
static ALPAKA_FN_HOST auto getPtrNative(ViewSubView< TDev, TElem, TDim, TIdx > &view) -> TElem *
The native pointer get trait.