alpaka
Abstraction Library for Parallel Kernel Acceleration
Loading...
Searching...
No Matches
alpaka::LinearizedIdxGenerator< T_IndexType, T_dim > Struct Template Reference

Generate a linearized scalar index. More...

#include <LinearizedIdxGenerator.hpp>

Public Types

using index_type = value_type
using value_type = T_IndexType

Public Member Functions

constexpr LinearizedIdxGenerator (alpaka::concepts::VectorOrScalar auto const &size)
constexpr auto getExtents () const
 supported index range
constexpr auto getPitches () const
constexpr operator bool () const noexcept
constexpr value_type operator[] (alpaka::concepts::IndexVec< T_IndexType, T_dim > auto const &idx)
 Get value at the given index.
constexpr value_type operator[] (alpaka::concepts::IndexVec< T_IndexType, T_dim > auto const &idx) const
 Get value at the given index.
constexpr value_type operator[] (std::integral auto const &idx)
 Get value at the given index.
constexpr value_type operator[] (std::integral auto const &idx) const
 Get value at the given index.

Static Public Member Functions

static consteval uint32_t dim ()
static constexpr auto getAlignment ()
 Get alignment of the generators value_type.

Detailed Description

template<typename T_IndexType, uint32_t T_dim>
struct alpaka::LinearizedIdxGenerator< T_IndexType, T_dim >

Generate a linearized scalar index.

The generator behaves like an n-dimensional data container, but it is not pointing to any memory. The index to access the generator is linearized based on the provided extents.

Definition at line 20 of file LinearizedIdxGenerator.hpp.

Member Typedef Documentation

◆ index_type

template<typename T_IndexType, uint32_t T_dim>
using alpaka::LinearizedIdxGenerator< T_IndexType, T_dim >::index_type = value_type

Definition at line 27 of file LinearizedIdxGenerator.hpp.

◆ value_type

template<typename T_IndexType, uint32_t T_dim>
using alpaka::LinearizedIdxGenerator< T_IndexType, T_dim >::value_type = T_IndexType

Definition at line 26 of file LinearizedIdxGenerator.hpp.

Constructor & Destructor Documentation

◆ LinearizedIdxGenerator()

template<typename T_IndexType, uint32_t T_dim>
alpaka::LinearizedIdxGenerator< T_IndexType, T_dim >::LinearizedIdxGenerator ( alpaka::concepts::VectorOrScalar auto const & size)
inlineconstexpr

Definition at line 22 of file LinearizedIdxGenerator.hpp.

Member Function Documentation

◆ dim()

template<typename T_IndexType, uint32_t T_dim>
consteval uint32_t alpaka::LinearizedIdxGenerator< T_IndexType, T_dim >::dim ( )
inlinestaticconsteval

Definition at line 29 of file LinearizedIdxGenerator.hpp.

◆ getAlignment()

template<typename T_IndexType, uint32_t T_dim>
constexpr auto alpaka::LinearizedIdxGenerator< T_IndexType, T_dim >::getAlignment ( )
inlinestaticconstexpr

Get alignment of the generators value_type.

Definition at line 35 of file LinearizedIdxGenerator.hpp.

◆ getExtents()

template<typename T_IndexType, uint32_t T_dim>
auto alpaka::LinearizedIdxGenerator< T_IndexType, T_dim >::getExtents ( ) const
inlineconstexpr

supported index range

Returns
virtual extents of the generator

Definition at line 84 of file LinearizedIdxGenerator.hpp.

◆ getPitches()

template<typename T_IndexType, uint32_t T_dim>
auto alpaka::LinearizedIdxGenerator< T_IndexType, T_dim >::getPitches ( ) const
inlineconstexpr

Definition at line 89 of file LinearizedIdxGenerator.hpp.

◆ operator bool()

template<typename T_IndexType, uint32_t T_dim>
alpaka::LinearizedIdxGenerator< T_IndexType, T_dim >::operator bool ( ) const
inlineexplicitnodiscardconstexprnoexcept

Definition at line 94 of file LinearizedIdxGenerator.hpp.

◆ operator[]() [1/4]

template<typename T_IndexType, uint32_t T_dim>
value_type alpaka::LinearizedIdxGenerator< T_IndexType, T_dim >::operator[] ( alpaka::concepts::IndexVec< T_IndexType, T_dim > auto const & idx)
inlineconstexpr

Get value at the given index.

Parameters
idxn-dimensional offset, range [0, extents)
Returns
linearized index

Definition at line 55 of file LinearizedIdxGenerator.hpp.

◆ operator[]() [2/4]

template<typename T_IndexType, uint32_t T_dim>
value_type alpaka::LinearizedIdxGenerator< T_IndexType, T_dim >::operator[] ( alpaka::concepts::IndexVec< T_IndexType, T_dim > auto const & idx) const
inlineconstexpr

Get value at the given index.

Parameters
idxn-dimensional offset, range [0, extents)
Returns
linearized index

Definition at line 45 of file LinearizedIdxGenerator.hpp.

◆ operator[]() [3/4]

template<typename T_IndexType, uint32_t T_dim>
value_type alpaka::LinearizedIdxGenerator< T_IndexType, T_dim >::operator[] ( std::integral auto const & idx)
inlineconstexpr

Get value at the given index.

Parameters
idxn-dimensional offset, range [0, extents)
Returns
linearized index

Definition at line 75 of file LinearizedIdxGenerator.hpp.

◆ operator[]() [4/4]

template<typename T_IndexType, uint32_t T_dim>
value_type alpaka::LinearizedIdxGenerator< T_IndexType, T_dim >::operator[] ( std::integral auto const & idx) const
inlineconstexpr

Get value at the given index.

Parameters
idxn-dimensional offset, range [0, extents)
Returns
linearized index

Definition at line 65 of file LinearizedIdxGenerator.hpp.


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