dune-common 2.10
Loading...
Searching...
No Matches
Dune::Std::layout_stride::mapping< Extents > Class Template Reference

A layout mapping where the strides are user-defined. More...

#include <dune/common/std/layout_stride.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_stride
 

Public Member Functions

constexpr mapping () noexcept
 The default construction initializes the strides from layout_right.
 
constexpr mapping (const mapping &) noexcept=default
 Copy constructor for the mapping.
 
template<class OtherIndexType , std::enable_if_t< std::is_convertible_v< const OtherIndexType &, index_type >, int > = 0, std::enable_if_t< std::is_nothrow_constructible_v< index_type, const OtherIndexType & >, int > = 0>
constexpr mapping (const extents_type &e, const std::array< OtherIndexType, rank_ > &s) noexcept
 Construct the mapping from given extents and strides.
 
template<class OtherIndexType , std::enable_if_t< std::is_convertible_v< const OtherIndexType &, index_type >, int > = 0, std::enable_if_t< std::is_nothrow_constructible_v< index_type, const OtherIndexType & >, int > = 0>
constexpr mapping (const extents_type &e, const span< OtherIndexType, rank_ > &s) noexcept
 Construct the mapping from given extents and strides.
 
template<class M , std::enable_if_t<(M::extents_type::rank()==extents_type::rank()), int > = 0, std::enable_if_t<(M::is_always_unique()), int > = 0, std::enable_if_t<(M::is_always_strided()), int > = 0, decltype(std::declval< M >().extents(), bool{}) = true, decltype(std::declval< M >().stride(std::declval< rank_type >()), bool{}) = true>
constexpr mapping (const M &m) noexcept
 Construct the mapping from another mapping with different extents and different strides.
 
constexpr mappingoperator= (const mapping &) noexcept=default
 Copy-assignment for the mapping.
 
constexpr const extents_typeextents () const noexcept
 
constexpr index_type required_span_size () const noexcept
 Return the sum 1 + (E(0)-1)*S(0) + (E(1)-1)*S(1) + ...
 
template<class... Indices, std::enable_if_t<(sizeof...(Indices)==rank_), int > = 0, std::enable_if_t<(std::is_convertible_v< Indices, index_type > &&...), int > = 0, std::enable_if_t<(std::is_nothrow_constructible_v< index_type, Indices > &&...), int > = 0>
constexpr index_type operator() (Indices... ii) const noexcept
 Compute the offset by folding with index-array with the strides array.
 
constexpr index_type operator() () const noexcept
 The default offset for rank-0 tensors is 0.
 
constexpr bool is_exhaustive () const noexcept
 
constexpr const strides_type & strides () const noexcept
 Get the array of all strides.
 
template<class E = extents_type, std::enable_if_t<(E::rank() > 0), int > = 0>
constexpr index_type stride (rank_type i) const noexcept
 Get the single stride i
 

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 constexpr bool is_unique () noexcept
 
static constexpr bool is_strided () noexcept
 

Detailed Description

template<class Extents>
class Dune::Std::layout_stride::mapping< Extents >

A layout mapping where the strides are user-defined.

Member Typedef Documentation

◆ extents_type

template<class Extents >
using Dune::Std::layout_stride::mapping< Extents >::extents_type = Extents

◆ index_type

template<class Extents >
using Dune::Std::layout_stride::mapping< Extents >::index_type = typename extents_type::index_type

◆ layout_type

template<class Extents >
using Dune::Std::layout_stride::mapping< Extents >::layout_type = layout_stride

◆ rank_type

template<class Extents >
using Dune::Std::layout_stride::mapping< Extents >::rank_type = typename extents_type::rank_type

◆ size_type

template<class Extents >
using Dune::Std::layout_stride::mapping< Extents >::size_type = typename extents_type::size_type

Constructor & Destructor Documentation

◆ mapping() [1/5]

template<class Extents >
Dune::Std::layout_stride::mapping< Extents >::mapping ( )
inlineconstexprnoexcept

The default construction initializes the strides from layout_right.

◆ mapping() [2/5]

template<class Extents >
Dune::Std::layout_stride::mapping< Extents >::mapping ( const mapping< Extents > & )
constexprdefaultnoexcept

Copy constructor for the mapping.

◆ mapping() [3/5]

template<class Extents >
template<class OtherIndexType , std::enable_if_t< std::is_convertible_v< const OtherIndexType &, index_type >, int > = 0, std::enable_if_t< std::is_nothrow_constructible_v< index_type, const OtherIndexType & >, int > = 0>
Dune::Std::layout_stride::mapping< Extents >::mapping ( const extents_type & e,
const std::array< OtherIndexType, rank_ > & s )
inlineconstexprnoexcept

Construct the mapping from given extents and strides.

◆ mapping() [4/5]

template<class Extents >
template<class OtherIndexType , std::enable_if_t< std::is_convertible_v< const OtherIndexType &, index_type >, int > = 0, std::enable_if_t< std::is_nothrow_constructible_v< index_type, const OtherIndexType & >, int > = 0>
Dune::Std::layout_stride::mapping< Extents >::mapping ( const extents_type & e,
const span< OtherIndexType, rank_ > & s )
inlineconstexprnoexcept

Construct the mapping from given extents and strides.

◆ mapping() [5/5]

template<class Extents >
template<class M , std::enable_if_t<(M::extents_type::rank()==extents_type::rank()), int > = 0, std::enable_if_t<(M::is_always_unique()), int > = 0, std::enable_if_t<(M::is_always_strided()), int > = 0, decltype(std::declval< M >().extents(), bool{}) = true, decltype(std::declval< M >().stride(std::declval< rank_type >()), bool{}) = true>
Dune::Std::layout_stride::mapping< Extents >::mapping ( const M & m)
inlineconstexprnoexcept

Construct the mapping from another mapping with different extents and different strides.

Member Function Documentation

◆ extents()

template<class Extents >
const extents_type & Dune::Std::layout_stride::mapping< Extents >::extents ( ) const
inlineconstexprnoexcept

◆ is_always_exhaustive()

template<class Extents >
static constexpr bool Dune::Std::layout_stride::mapping< Extents >::is_always_exhaustive ( )
inlinestaticconstexprnoexcept

◆ is_always_strided()

template<class Extents >
static constexpr bool Dune::Std::layout_stride::mapping< Extents >::is_always_strided ( )
inlinestaticconstexprnoexcept

◆ is_always_unique()

template<class Extents >
static constexpr bool Dune::Std::layout_stride::mapping< Extents >::is_always_unique ( )
inlinestaticconstexprnoexcept

◆ is_exhaustive()

template<class Extents >
bool Dune::Std::layout_stride::mapping< Extents >::is_exhaustive ( ) const
inlineconstexprnoexcept

◆ is_strided()

template<class Extents >
static constexpr bool Dune::Std::layout_stride::mapping< Extents >::is_strided ( )
inlinestaticconstexprnoexcept

◆ is_unique()

template<class Extents >
static constexpr bool Dune::Std::layout_stride::mapping< Extents >::is_unique ( )
inlinestaticconstexprnoexcept

◆ operator()() [1/2]

template<class Extents >
index_type Dune::Std::layout_stride::mapping< Extents >::operator() ( ) const
inlineconstexprnoexcept

The default offset for rank-0 tensors is 0.

◆ operator()() [2/2]

template<class Extents >
template<class... Indices, std::enable_if_t<(sizeof...(Indices)==rank_), int > = 0, std::enable_if_t<(std::is_convertible_v< Indices, index_type > &&...), int > = 0, std::enable_if_t<(std::is_nothrow_constructible_v< index_type, Indices > &&...), int > = 0>
index_type Dune::Std::layout_stride::mapping< Extents >::operator() ( Indices... ii) const
inlineconstexprnoexcept

Compute the offset by folding with index-array with the strides array.

◆ operator=()

template<class Extents >
mapping & Dune::Std::layout_stride::mapping< Extents >::operator= ( const mapping< Extents > & )
constexprdefaultnoexcept

Copy-assignment for the mapping.

◆ required_span_size()

template<class Extents >
index_type Dune::Std::layout_stride::mapping< Extents >::required_span_size ( ) const
inlineconstexprnoexcept

Return the sum 1 + (E(0)-1)*S(0) + (E(1)-1)*S(1) + ...

◆ stride()

template<class Extents >
template<class E = extents_type, std::enable_if_t<(E::rank() > 0), int > = 0>
index_type Dune::Std::layout_stride::mapping< Extents >::stride ( rank_type i) const
inlineconstexprnoexcept

Get the single stride i

◆ strides()

template<class Extents >
const strides_type & Dune::Std::layout_stride::mapping< Extents >::strides ( ) const
inlineconstexprnoexcept

Get the array of all strides.


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