dune-common 2.12-git
Loading...
Searching...
No Matches
Dune::Std::layout_right_padded< PaddingValue >::mapping< Extents > Class Template Reference

A right layout mapping with optional padding of the next-to-last stride. More...

#include <dune/common/std/layout_right_padded.hh>

Public Types

using extents_type = Extents
 
using index_type = typename extents_type::index_type
 
using size_type = typename extents_type::size_type
 
using rank_type = typename extents_type::rank_type
 
using layout_type = layout_right_padded< PaddingValue >
 

Public Member Functions

constexpr mapping () noexcept=default
 
constexpr mapping (const mapping &) noexcept=default
 
constexpr mapping (const extents_type &e) noexcept
 
template<class OtherIndexType , std::enable_if_t< std::is_convertible_v< OtherIndexType, index_type >, int > = 0, std::enable_if_t< std::is_nothrow_constructible_v< index_type, OtherIndexType >, int > = 0>
constexpr mapping (const extents_type &e, OtherIndexType padding) noexcept
 
template<class OtherExtents , std::enable_if_t< std::is_constructible_v< extents_type, OtherExtents >, int > = 0>
constexpr mapping (const layout_right::mapping< OtherExtents > &m) noexcept
 
template<class OtherExtents , class E = extents_type, std::enable_if_t<(E::rank()<=1), int > = 0, std::enable_if_t< std::is_constructible_v< extents_type, OtherExtents >, int > = 0>
constexpr mapping (const layout_left::mapping< OtherExtents > &m) noexcept
 
template<class OtherExtents , std::enable_if_t< std::is_constructible_v< extents_type, OtherExtents >, int > = 0>
constexpr mapping (const layout_stride::mapping< OtherExtents > &m) noexcept
 
template<class OtherMapping , std::enable_if_t< Impl::is_layout_right_padded_v< typename OtherMapping::layout_type >, int > = 0, std::enable_if_t< std::is_constructible_v< extents_type, typename OtherMapping::extents_type >, int > = 0>
constexpr mapping (const OtherMapping &m) noexcept
 
constexpr mapping & operator= (const mapping &) noexcept=default
 
constexpr const extents_type & extents () const noexcept
 
constexpr index_type required_span_size () const noexcept
 
template<class... Indices, std::enable_if_t<(sizeof...(Indices)==Extents::rank()), int > = 0, std::enable_if_t<(... &&std::is_convertible_v< Indices, index_type >), int > = 0>
constexpr index_type operator() (Indices... indices) const noexcept
 
constexpr index_type operator() () const noexcept
 
constexpr bool is_unique () const noexcept
 
constexpr bool is_strided () const noexcept
 
constexpr bool is_exhaustive () const noexcept
 
template<class E = extents_type, std::enable_if_t<(E::rank() > 0), int > = 0>
constexpr index_type stride (rank_type r) const noexcept
 

Static Public Member Functions

static constexpr bool is_always_unique () noexcept
 
static constexpr bool is_always_exhaustive () noexcept
 
static constexpr bool is_always_strided () noexcept
 

Static Public Attributes

static constexpr std::size_t padding_value = PaddingValue
 

Friends

template<class OtherMapping , std::enable_if_t<(OtherMapping::extents_type::rank()==Extents::rank()), int > = 0, std::enable_if_t<(OtherMapping::is_always_strided()), int > = 0>
constexpr bool operator== (const mapping &a, const OtherMapping &b) noexcept
 

Detailed Description

template<std::size_t PaddingValue = std::dynamic_extent>
template<class Extents>
class Dune::Std::layout_right_padded< PaddingValue >::mapping< Extents >

A right layout mapping with optional padding of the next-to-last stride.

This layout follows the layout_right_padded mapping from P2642R0 and the C++ standard working draft [mdspan.layout.rightpad]. It is useful when the rightmost dimension should remain contiguous but the stride of the previous dimension should be supplied explicitly, for example to align rows for vectorized kernels, cache lines, GPU memory transactions, or external libraries that require pitched storage.

For rank two, stride(1) == 1 and stride(0) is either extent(1) or a padded value. The padding can leave unused memory between rows while still providing a regular strided mdspan mapping.

Member Typedef Documentation

◆ extents_type

template<std::size_t PaddingValue = std::dynamic_extent>
template<class Extents >
using Dune::Std::layout_right_padded< PaddingValue >::mapping< Extents >::extents_type = Extents

◆ index_type

template<std::size_t PaddingValue = std::dynamic_extent>
template<class Extents >
using Dune::Std::layout_right_padded< PaddingValue >::mapping< Extents >::index_type = typename extents_type::index_type

◆ layout_type

template<std::size_t PaddingValue = std::dynamic_extent>
template<class Extents >
using Dune::Std::layout_right_padded< PaddingValue >::mapping< Extents >::layout_type = layout_right_padded<PaddingValue>

◆ rank_type

template<std::size_t PaddingValue = std::dynamic_extent>
template<class Extents >
using Dune::Std::layout_right_padded< PaddingValue >::mapping< Extents >::rank_type = typename extents_type::rank_type

◆ size_type

template<std::size_t PaddingValue = std::dynamic_extent>
template<class Extents >
using Dune::Std::layout_right_padded< PaddingValue >::mapping< Extents >::size_type = typename extents_type::size_type

Constructor & Destructor Documentation

◆ mapping() [1/8]

template<std::size_t PaddingValue = std::dynamic_extent>
template<class Extents >
constexpr Dune::Std::layout_right_padded< PaddingValue >::mapping< Extents >::mapping ( )
constexprdefaultnoexcept

◆ mapping() [2/8]

template<std::size_t PaddingValue = std::dynamic_extent>
template<class Extents >
constexpr Dune::Std::layout_right_padded< PaddingValue >::mapping< Extents >::mapping ( const mapping< Extents > &  )
constexprdefaultnoexcept

◆ mapping() [3/8]

template<std::size_t PaddingValue = std::dynamic_extent>
template<class Extents >
constexpr Dune::Std::layout_right_padded< PaddingValue >::mapping< Extents >::mapping ( const extents_type &  e)
inlineconstexprnoexcept

◆ mapping() [4/8]

template<std::size_t PaddingValue = std::dynamic_extent>
template<class Extents >
template<class OtherIndexType , std::enable_if_t< std::is_convertible_v< OtherIndexType, index_type >, int > = 0, std::enable_if_t< std::is_nothrow_constructible_v< index_type, OtherIndexType >, int > = 0>
constexpr Dune::Std::layout_right_padded< PaddingValue >::mapping< Extents >::mapping ( const extents_type &  e,
OtherIndexType  padding 
)
inlineconstexprnoexcept

◆ mapping() [5/8]

template<std::size_t PaddingValue = std::dynamic_extent>
template<class Extents >
template<class OtherExtents , std::enable_if_t< std::is_constructible_v< extents_type, OtherExtents >, int > = 0>
constexpr Dune::Std::layout_right_padded< PaddingValue >::mapping< Extents >::mapping ( const layout_right::mapping< OtherExtents > &  m)
inlineconstexprnoexcept

◆ mapping() [6/8]

template<std::size_t PaddingValue = std::dynamic_extent>
template<class Extents >
template<class OtherExtents , class E = extents_type, std::enable_if_t<(E::rank()<=1), int > = 0, std::enable_if_t< std::is_constructible_v< extents_type, OtherExtents >, int > = 0>
constexpr Dune::Std::layout_right_padded< PaddingValue >::mapping< Extents >::mapping ( const layout_left::mapping< OtherExtents > &  m)
inlineconstexprnoexcept

◆ mapping() [7/8]

template<std::size_t PaddingValue = std::dynamic_extent>
template<class Extents >
template<class OtherExtents , std::enable_if_t< std::is_constructible_v< extents_type, OtherExtents >, int > = 0>
constexpr Dune::Std::layout_right_padded< PaddingValue >::mapping< Extents >::mapping ( const layout_stride::mapping< OtherExtents > &  m)
inlineconstexprnoexcept

◆ mapping() [8/8]

template<std::size_t PaddingValue = std::dynamic_extent>
template<class Extents >
template<class OtherMapping , std::enable_if_t< Impl::is_layout_right_padded_v< typename OtherMapping::layout_type >, int > = 0, std::enable_if_t< std::is_constructible_v< extents_type, typename OtherMapping::extents_type >, int > = 0>
constexpr Dune::Std::layout_right_padded< PaddingValue >::mapping< Extents >::mapping ( const OtherMapping &  m)
inlineconstexprnoexcept

Member Function Documentation

◆ extents()

template<std::size_t PaddingValue = std::dynamic_extent>
template<class Extents >
constexpr const extents_type & Dune::Std::layout_right_padded< PaddingValue >::mapping< Extents >::extents ( ) const
inlineconstexprnoexcept

◆ is_always_exhaustive()

template<std::size_t PaddingValue = std::dynamic_extent>
template<class Extents >
static constexpr bool Dune::Std::layout_right_padded< PaddingValue >::mapping< Extents >::is_always_exhaustive ( )
inlinestaticconstexprnoexcept

◆ is_always_strided()

template<std::size_t PaddingValue = std::dynamic_extent>
template<class Extents >
static constexpr bool Dune::Std::layout_right_padded< PaddingValue >::mapping< Extents >::is_always_strided ( )
inlinestaticconstexprnoexcept

◆ is_always_unique()

template<std::size_t PaddingValue = std::dynamic_extent>
template<class Extents >
static constexpr bool Dune::Std::layout_right_padded< PaddingValue >::mapping< Extents >::is_always_unique ( )
inlinestaticconstexprnoexcept

◆ is_exhaustive()

template<std::size_t PaddingValue = std::dynamic_extent>
template<class Extents >
constexpr bool Dune::Std::layout_right_padded< PaddingValue >::mapping< Extents >::is_exhaustive ( ) const
inlineconstexprnoexcept

◆ is_strided()

template<std::size_t PaddingValue = std::dynamic_extent>
template<class Extents >
constexpr bool Dune::Std::layout_right_padded< PaddingValue >::mapping< Extents >::is_strided ( ) const
inlineconstexprnoexcept

◆ is_unique()

template<std::size_t PaddingValue = std::dynamic_extent>
template<class Extents >
constexpr bool Dune::Std::layout_right_padded< PaddingValue >::mapping< Extents >::is_unique ( ) const
inlineconstexprnoexcept

◆ operator()() [1/2]

template<std::size_t PaddingValue = std::dynamic_extent>
template<class Extents >
constexpr index_type Dune::Std::layout_right_padded< PaddingValue >::mapping< Extents >::operator() ( ) const
inlineconstexprnoexcept

◆ operator()() [2/2]

template<std::size_t PaddingValue = std::dynamic_extent>
template<class Extents >
template<class... Indices, std::enable_if_t<(sizeof...(Indices)==Extents::rank()), int > = 0, std::enable_if_t<(... &&std::is_convertible_v< Indices, index_type >), int > = 0>
constexpr index_type Dune::Std::layout_right_padded< PaddingValue >::mapping< Extents >::operator() ( Indices...  indices) const
inlineconstexprnoexcept

◆ operator=()

template<std::size_t PaddingValue = std::dynamic_extent>
template<class Extents >
constexpr mapping & Dune::Std::layout_right_padded< PaddingValue >::mapping< Extents >::operator= ( const mapping< Extents > &  )
constexprdefaultnoexcept

◆ required_span_size()

template<std::size_t PaddingValue = std::dynamic_extent>
template<class Extents >
constexpr index_type Dune::Std::layout_right_padded< PaddingValue >::mapping< Extents >::required_span_size ( ) const
inlineconstexprnoexcept

◆ stride()

template<std::size_t PaddingValue = std::dynamic_extent>
template<class Extents >
template<class E = extents_type, std::enable_if_t<(E::rank() > 0), int > = 0>
constexpr index_type Dune::Std::layout_right_padded< PaddingValue >::mapping< Extents >::stride ( rank_type  r) const
inlineconstexprnoexcept

Friends And Related Symbol Documentation

◆ operator==

template<std::size_t PaddingValue = std::dynamic_extent>
template<class Extents >
template<class OtherMapping , std::enable_if_t<(OtherMapping::extents_type::rank()==Extents::rank()), int > = 0, std::enable_if_t<(OtherMapping::is_always_strided()), int > = 0>
constexpr bool operator== ( const mapping< Extents > &  a,
const OtherMapping &  b 
)
friend

Member Data Documentation

◆ padding_value

template<std::size_t PaddingValue = std::dynamic_extent>
template<class Extents >
constexpr std::size_t Dune::Std::layout_right_padded< PaddingValue >::mapping< Extents >::padding_value = PaddingValue
staticconstexpr

The documentation for this class was generated from the following files: