dune-common  2.11
Public Types | Friends | List of all members
Dune::Std::extents< IndexType, exts > Class Template Reference

Multidimensional index space with dynamic and static extents.This class template represents a multidimensional index space of rank equal to sizeof...(exts). Each extent might be specified as a template parameter or as a dynamic parameter in the constructor. More...

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

Public Types

using rank_type = std::size_t
 
using index_type = IndexType
 
using size_type = std::make_unsigned_t< index_type >
 

Public Member Functions

extents constructors
constexpr extents () noexcept=default
 The default constructor requires that all exts are not std::dynamic_extent. More...
 
template<class... IndexTypes, std::enable_if_t<(... &&std::is_convertible_v< IndexTypes, index_type >), int > = 0, std::enable_if_t<(sizeof...(IndexTypes)==rank()||sizeof...(IndexTypes)==rank_dynamic()), int > = 0, std::enable_if_t<(... &&std::is_nothrow_constructible_v< index_type, IndexTypes >), int > = 0>
constexpr extents (IndexTypes... e) noexcept
 Set all extents by the given integral sequence [[pre: all static extents correspond to the given value e]]. More...
 
template<class I , std::size_t N, std::enable_if_t< std::is_convertible_v< I, index_type >, int > = 0, std::enable_if_t<(N==rank()||N==rank_dynamic()), int > = 0>
constexpr extents (const std::array< I, N > &e) noexcept
 Set all dynamic extents by the given integral array [[pre: all static extents correspond to the given values in e]]. More...
 
template<class I , std::size_t N, std::enable_if_t< std::is_convertible_v< I, index_type >, int > = 0, std::enable_if_t<(N==rank()||N==rank_dynamic()), int > = 0, std::enable_if_t< std::is_nothrow_constructible_v< index_type, const I &>, int > = 0>
constexpr extents (std::span< I, N > e) noexcept
 Set all dynamic extents by the given integral array [[pre: all static extents correspond to the given values in e]]. More...
 
template<class I , std::size_t... e, std::enable_if_t<(sizeof...(e)==rank()), int > = 0, std::enable_if_t<((e==std::dynamic_extent||exts==std::dynamic_extent||e==exts) &&...), int > = 0>
constexpr extents (const extents< I, e... > &other) noexcept
 

Friends

template<class , std::size_t... >
class extents
 
struct layout_left
 
struct layout_right
 
struct layout_stride
 
template<class OtherIndexType , std::size_t... otherExts>
constexpr bool operator== (const extents &a, const extents< OtherIndexType, otherExts... > &b) noexcept
 Compare two extents by their rank and all individual extents. More...
 

Observers

[mdspan.extents.obs], observers of the multidimensional index space

static constexpr rank_type rank () noexcept
 The total number of dimensions. More...
 
static constexpr rank_type rank_dynamic () noexcept
 The number of dimensions with dynamic extent. More...
 
static constexpr std::size_t static_extent (rank_type r) noexcept
 Return the static extent of dimension r or std::dynamic_extent More...
 
constexpr index_type extent (rank_type r) const noexcept
 Return the extent of dimension i More...
 

Detailed Description

template<class IndexType, std::size_t... exts>
class Dune::Std::extents< IndexType, exts >

Multidimensional index space with dynamic and static extents.

This class template represents a multidimensional index space of rank equal to sizeof...(exts). Each extent might be specified as a template parameter or as a dynamic parameter in the constructor.

Template Parameters
IndexTypeAn integral type other than bool
exts...Each element of exts is either std::dynamic_extent or a representable value of type IndexType.

Member Typedef Documentation

◆ index_type

template<class IndexType, std::size_t... exts>
using Dune::Std::extents< IndexType, exts >::index_type = IndexType

◆ rank_type

template<class IndexType, std::size_t... exts>
using Dune::Std::extents< IndexType, exts >::rank_type = std::size_t

◆ size_type

template<class IndexType, std::size_t... exts>
using Dune::Std::extents< IndexType, exts >::size_type = std::make_unsigned_t<index_type>

Constructor & Destructor Documentation

◆ extents() [1/5]

template<class IndexType, std::size_t... exts>
constexpr Dune::Std::extents< IndexType, exts >::extents ( )
defaultnoexcept

The default constructor requires that all exts are not std::dynamic_extent.

◆ extents() [2/5]

template<class IndexType, std::size_t... exts>
template<class... IndexTypes, std::enable_if_t<(... &&std::is_convertible_v< IndexTypes, index_type >), int > = 0, std::enable_if_t<(sizeof...(IndexTypes)==rank()||sizeof...(IndexTypes)==rank_dynamic()), int > = 0, std::enable_if_t<(... &&std::is_nothrow_constructible_v< index_type, IndexTypes >), int > = 0>
constexpr Dune::Std::extents< IndexType, exts >::extents ( IndexTypes...  e)
inlineexplicitnoexcept

Set all extents by the given integral sequence [[pre: all static extents correspond to the given value e]].

◆ extents() [3/5]

template<class IndexType, std::size_t... exts>
template<class I , std::size_t N, std::enable_if_t< std::is_convertible_v< I, index_type >, int > = 0, std::enable_if_t<(N==rank()||N==rank_dynamic()), int > = 0>
constexpr Dune::Std::extents< IndexType, exts >::extents ( const std::array< I, N > &  e)
inlinenoexcept

Set all dynamic extents by the given integral array [[pre: all static extents correspond to the given values in e]].

◆ extents() [4/5]

template<class IndexType, std::size_t... exts>
template<class I , std::size_t N, std::enable_if_t< std::is_convertible_v< I, index_type >, int > = 0, std::enable_if_t<(N==rank()||N==rank_dynamic()), int > = 0, std::enable_if_t< std::is_nothrow_constructible_v< index_type, const I &>, int > = 0>
constexpr Dune::Std::extents< IndexType, exts >::extents ( std::span< I, N >  e)
inlinenoexcept

Set all dynamic extents by the given integral array [[pre: all static extents correspond to the given values in e]].

◆ extents() [5/5]

template<class IndexType, std::size_t... exts>
template<class I , std::size_t... e, std::enable_if_t<(sizeof...(e)==rank()), int > = 0, std::enable_if_t<((e==std::dynamic_extent||exts==std::dynamic_extent||e==exts) &&...), int > = 0>
constexpr Dune::Std::extents< IndexType, exts >::extents ( const extents< I, e... > &  other)
inlinenoexcept

Member Function Documentation

◆ extent()

template<class IndexType, std::size_t... exts>
constexpr index_type Dune::Std::extents< IndexType, exts >::extent ( rank_type  r) const
inlinenoexcept

Return the extent of dimension i

◆ rank()

template<class IndexType, std::size_t... exts>
static constexpr rank_type Dune::Std::extents< IndexType, exts >::rank ( )
inlinestaticnoexcept

The total number of dimensions.

◆ rank_dynamic()

template<class IndexType, std::size_t... exts>
static constexpr rank_type Dune::Std::extents< IndexType, exts >::rank_dynamic ( )
inlinestaticnoexcept

The number of dimensions with dynamic extent.

◆ static_extent()

template<class IndexType, std::size_t... exts>
static constexpr std::size_t Dune::Std::extents< IndexType, exts >::static_extent ( rank_type  r)
inlinestaticnoexcept

Return the static extent of dimension r or std::dynamic_extent

Friends And Related Function Documentation

◆ extents

template<class IndexType, std::size_t... exts>
template<class , std::size_t... >
friend class extents
friend

◆ layout_left

template<class IndexType, std::size_t... exts>
friend struct layout_left
friend

◆ layout_right

template<class IndexType, std::size_t... exts>
friend struct layout_right
friend

◆ layout_stride

template<class IndexType, std::size_t... exts>
friend struct layout_stride
friend

◆ operator==

template<class IndexType, std::size_t... exts>
template<class OtherIndexType , std::size_t... otherExts>
constexpr bool operator== ( const extents< IndexType, exts > &  a,
const extents< OtherIndexType, otherExts... > &  b 
)
friend

Compare two extents by their rank and all individual extents.


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