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 std::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 mapping & | operator= (const mapping &) noexcept=default
| Copy-assignment for the mapping.
constexpr const extents_type & | extents () 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

## Friends

template<class>
class | mapping
template<class OtherMapping, std::enable_if_t<(OtherMapping::extents_type::rank()==extents_type::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<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 | ( |  | ) |

inline constexpr noexcept

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 > & |  | ) |

constexpr default noexcept

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 )

inline constexpr noexcept

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 std::span< OtherIndexType, rank_ > & | s )

inline constexpr noexcept

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 | ) |

inline constexpr noexcept

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

inline constexpr noexcept

## is_always_exhaustive()

template<class Extents>

constexpr bool Dune::Std::layout_stride::mapping< Extents >::is_always_exhaustive | ( |  | ) |

inline static constexpr noexcept

## is_always_strided()

template<class Extents>

constexpr bool Dune::Std::layout_stride::mapping< Extents >::is_always_strided | ( |  | ) |

inline static constexpr noexcept

## is_always_unique()

template<class Extents>

constexpr bool Dune::Std::layout_stride::mapping< Extents >::is_always_unique | ( |  | ) |

inline static constexpr noexcept

## is_exhaustive()

template<class Extents>

bool Dune::Std::layout_stride::mapping< Extents >::is_exhaustive | ( |  | ) | const

inline constexpr noexcept

## is_strided()

template<class Extents>

constexpr bool Dune::Std::layout_stride::mapping< Extents >::is_strided | ( |  | ) |

inline static constexpr noexcept

## is_unique()

template<class Extents>

constexpr bool Dune::Std::layout_stride::mapping< Extents >::is_unique | ( |  | ) |

inline static constexpr noexcept

## operator()() [1/2]

template<class Extents>

index_type Dune::Std::layout_stride::mapping< Extents >::operator() | ( |  | ) | const

inline constexpr noexcept

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

inline constexpr noexcept

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 > & |  | ) |

constexpr default noexcept

Copy-assignment for the mapping.

## required_span_size()

template<class Extents>

index_type Dune::Std::layout_stride::mapping< Extents >::required_span_size | ( |  | ) | const

inline constexpr noexcept

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

inline constexpr noexcept

Get the single stride i.

## strides()

template<class Extents>

const strides_type & Dune::Std::layout_stride::mapping< Extents >::strides | ( |  | ) | const

inline constexpr noexcept

Get the array of all strides.

## Friends And Related Symbol Documentation

## mapping

template<class Extents>
template<class>

friend class mapping

friend

## operator==

template<class Extents>
template<class OtherMapping, std::enable_if_t<(OtherMapping::extents_type::rank()==extents_type::rank()), int > = 0, std::enable_if_t<(OtherMapping::is_always_strided()), int > = 0>

bool operator== | ( | const mapping< Extents > & | a,
|  | const OtherMapping & | b )

friend

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

- fwd_layouts.hh
- layout_stride.hh