17 template<
typename T_Elem, alpaka::concepts::Vector T_Vec>
20 constexpr auto dim = T_Vec::dim();
21 using type =
typename T_Vec::type;
22 auto pitchBytes =
typename T_Vec::UniVec{};
24 pitchBytes.back() =
static_cast<type
>(
sizeof(T_Elem));
26 for(type i = dim - 1; i > 0; i--)
27 pitchBytes[i - 1] = extent[i] * pitchBytes[i];
32 template<
typename T_Elem, alpaka::concepts::Vector T_Vec>
33 requires(T_Vec::dim() >= 2)
34 constexpr auto calculatePitches(T_Vec
const& extent,
typename T_Vec::type
const& rowPitchBytes)
36 constexpr auto dim = T_Vec::dim();
37 using type =
typename T_Vec::type;
38 auto pitchBytes =
typename T_Vec::UniVec{};
39 pitchBytes.back() =
static_cast<type
>(
sizeof(T_Elem));
41 pitchBytes[dim - 2u] = rowPitchBytes;
43 for(type i = dim - 2; i > 0; i--)
44 pitchBytes[i - 1] = extent[i] * pitchBytes[i];
48 template<
typename T_Type, concepts::Vector T_Pitches>
54 static consteval uint32_t
dim()
56 return T_Pitches::dim();
59 constexpr DataPitches(T_Pitches
const& pitchBytes) : m_pitch(pitchBytes.eraseBack())
61 assert(pitchBytes.back() ==
sizeof(
value_type));
70 for(uint32_t d = 0u; d <
dim() - 1u; ++d)
72 result[d] = m_pitch[d];
84 decltype(std::declval<T_Pitches>().eraseBack()) m_pitch;
87 template<
typename T_Type,
typename T_IndexType,
typename T_Storage>
93 static consteval uint32_t
dim()
100 assert(pitchBytes.back() ==
sizeof(
value_type));
constexpr auto calculatePitchesFromExtents(T_Vec const &extent)
Calculate the pitches purely from the extents.
constexpr auto calculatePitches(T_Vec const &extent, typename T_Vec::type const &rowPitchBytes)
Calculate the pitches purely from the extents.
static consteval uint32_t dim()
constexpr auto getPitches() const
constexpr DataPitches()=default
constexpr DataPitches(Vec< T_IndexType, 1u > const &pitchBytes)
constexpr auto getPitches() const
constexpr index_type operator[](std::integral auto idx) const
constexpr DataPitches()=default
constexpr DataPitches(T_Pitches const &pitchBytes)
static consteval uint32_t dim()
typename T_Pitches::type index_type
constexpr decltype(auto) back()