25 template<std::
integral auto T_numDims, u
int32_t T_dim = 0u>
28 constexpr decltype(
auto)
operator()(
auto arrayPtr,
concepts::Vector auto const& idx)
const
34 template<u
int32_t T_dim>
37 constexpr decltype(
auto)
operator()(
auto arrayPtr,
concepts::Vector auto const& idx)
const
39 return arrayPtr[idx[T_dim]];
44 template<
typename T, concepts::CVector T_Extents, u
int32_t T_numDims = T_Extents::dim(), u
int32_t T_dim = 0u>
48 typename CArrayType<T[T_Extents{}[T_numDims - T_dim - 1u]], T_Extents, T_numDims - 1u, T_dim + 1u>
::type;
51 template<
typename T, concepts::CVector T_Extents, u
int32_t T_dim>
54 using type = T[T_Extents{}[0u]];
57 template<
typename T_ArrayType, std::
integral T_IndexType, concepts::Alignment T_MemAlignment = Alignment<>>
61 sizeof(T_ArrayType) &&
false,
62 "MdSpanArray can only be used if std::is_array_v<T> is true for the given type.");
65 template<alpaka::concepts::CStaticArray T_ArrayType, std::
integral T_IndexType, concepts::Alignment T_MemAlignment>
73 using value_type = std::remove_all_extents_t<T_ArrayType>;
80 static consteval uint32_t
dim()
82 return std::rank_v<T_ArrayType>;
120 constexpr auto end()
const
156 template<alpaka::concepts::CStaticArray T_OtherArrayType>
177 template<alpaka::concepts::CStaticArray T_OtherArrayType>
187 return T_MemAlignment{};
212 return (*
m_ptr)[idx];
217 return (*
m_ptr)[idx];
222 return m_ptr == other.m_ptr;
230 auto const createExtents = []<uint32_t... T_extent>(std::integer_sequence<uint32_t, T_extent...>)
232 return createExtents(std::make_integer_sequence<uint32_t,
dim()>{});
246 [[nodiscard]]
constexpr explicit operator bool() const noexcept
265 std::integral T_IndexType,
special implementation to define the end
#define ALPAKA_TYPEOF(...)
Get the type of instance.
Concept to check for an alignment object.
Concept to check if the given type is a C static array.
Check whether the specified type is a multidimensional index.
Concept to check if a type is a vector.
Concept to restrict copy or move constructor of a DataSource which creates a new object with a differ...
constexpr auto calculatePitchesFromExtents(T_Vec const &extent)
Calculate the pitches purely from the extents.
Vec< T, sizeof...(T_values), detail::CVec< T, T_values... > > CVec
A vector with compile-time known values.
build C array type with compile time extents from a scalar value based on the compile time extents ve...
typename CArrayType< T[T_Extents{}[T_numDims - T_dim - 1u]], T_Extents, T_numDims - 1u, T_dim+1u >::type type
std::add_const_t< MutArrayType > ConstArrayType
constexpr auto end() const
constexpr const_reference operator*() const
return value the origin pointer is pointing to
constexpr MdSpanArray(MdSpanArray< T_OtherArrayType, T_IndexType, T_MemAlignment > &&other)
constexpr MdSpanArray & operator=(MdSpanArray &)=default
constexpr auto cend() const
constexpr const_reference operator[](concepts::IndexVec< index_type, std::rank< T_ArrayType >::value > auto const &idx) const
get value at the given index
constexpr MdSpanArray()=default
constexpr reference operator[](concepts::IndexVec< index_type, std::rank< T_ArrayType >::value > auto const &idx)
get value at the given index
constexpr MdSpanArray & operator=(MdSpanArray &&)=default
constexpr const_reference operator[](index_type const &idx) const
get value at the given index
static consteval uint32_t dim()
constexpr MdSpanArray(MdSpanArray< T_OtherArrayType, T_IndexType, T_MemAlignment > const &other)
value_type const * const_pointer
constexpr auto begin() const
constexpr MdSpanArray(MdSpanArray const &)=default
constexpr auto cbegin() const
constexpr const_pointer data() const
get origin pointer
constexpr auto getPitches() const
constexpr MdSpanArray(T_ArrayType &staticSizedArray)
Constructor.
constexpr bool operator==(MdSpanArray const other) const
get value at the given index
static constexpr auto getAlignment()
constexpr MdSpanArray & operator=(MdSpanArray const &other)=default
Assignment operator keeping const-ness.
std::remove_all_extents_t< T_ArrayType > value_type
constexpr reference operator[](index_type const &idx)
get value at the given index
constexpr auto getExtents() const
std::remove_cv_t< T_ArrayType > MutArrayType
constexpr auto getConstMdSpan() const
constexpr reference operator*()
value_type const & const_reference
constexpr MdSpanArray(MdSpanArray &&)=default
access a C array with compile time extents via a runtime md index.
MdSpanArray< std::add_const_t< T_ArrayType >, T_IndexType, T_MemAlignment > InnerConst
MdSpanArray< std::remove_const_t< T_ArrayType >, T_IndexType, T_MemAlignment > InnerMutable
Specialize the trait for DataSource class if the object is copyable.