Gromacs  2024.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Friends
gmx::extents< StaticExtents > Class Template Reference

#include <gromacs/mdspan/extents.h>

Description

template<std::ptrdiff_t... StaticExtents>
class gmx::extents< StaticExtents >

Multidimensional extents with static and dynamic dimensions.

Describes a multidimensional index space of rank R. This is equivalent to the Cartesian product space of integer intervals [0, N_0) x [0, N_1) x ... x [0,N_{R-1} )

Confer to P0009r8 of the Library Evolution Working Group and mdspan.extents

Template Parameters
StaticExtentsrank number of extents, where the dynamic_extent constant for static extent is used to signal a dynamic extent.

Public Types

using index_type = std::ptrdiff_t
 Type used to index elements.
 

Public Member Functions

constexpr extents () noexcept
 Trivial constructor.
 
constexpr extents (extents &&) noexcept=default
 Move constructor.
 
constexpr extents (const extents &) noexcept=default
 Copy constructor.
 
template<class... IndexType>
constexpr extents (std::ptrdiff_t dn, IndexType...DynamicExtents) noexcept
 Construct with dynamic extents. More...
 
constexpr extents (const std::array< std::ptrdiff_t, extents_analyse_t::rank_dynamic()> dynamic_extents) noexcept
 Construct from array of dynamic extents. More...
 
template<std::ptrdiff_t... OtherStaticExtents>
 extents (const extents< OtherStaticExtents...> &other)
 Copy constructor.
 
extentsoperator= (extents &&) noexcept=default
 Default move assignment.
 
extentsoperator= (const extents &) noexcept=default
 Default copy assignment.
 
template<std::ptrdiff_t... OtherStaticExtents>
extentsoperator= (const extents< OtherStaticExtents...> &other)
 Copy assignment.
 
 ~extents ()=default
 Default destructor.
 
constexpr index_type extent (std::size_t k) const noexcept
 The extent along a specific dimension. More...
 
constexpr auto sliced_extents () const noexcept
 Returns the extent with the first dimension sliced off.
 

Static Public Member Functions

static constexpr std::size_t rank () noexcept
 The rank of the extent. More...
 
static constexpr std::size_t rank_dynamic () noexcept
 The rank of the dynamic extents. More...
 
static constexpr index_type static_extent (std::size_t k) noexcept
 The rank of the static extents. More...
 

Friends

template<std::ptrdiff_t... >
class extents
 For copy assignment, extents are friends of extents.
 

Constructor & Destructor Documentation

template<std::ptrdiff_t... StaticExtents>
template<class... IndexType>
constexpr gmx::extents< StaticExtents >::extents ( std::ptrdiff_t  dn,
IndexType...  DynamicExtents 
)
inlinenoexcept

Construct with dynamic extents.

Allows for extents(u,v,w..) syntax when setting dynamic extents

Template Parameters
IndexTypetype of index
Parameters
[in]dnfirst dynamic index
[in]DynamicExtentsparameter pack
template<std::ptrdiff_t... StaticExtents>
constexpr gmx::extents< StaticExtents >::extents ( const std::array< std::ptrdiff_t, extents_analyse_t::rank_dynamic()>  dynamic_extents)
inlinenoexcept

Construct from array of dynamic extents.

Allows for extents({{u,v,w..}}) syntax when setting dynamic extents

Parameters
[in]dynamic_extentsarray of dynamic rank size containing extents

Member Function Documentation

template<std::ptrdiff_t... StaticExtents>
constexpr index_type gmx::extents< StaticExtents >::extent ( std::size_t  k) const
inlinenoexcept

The extent along a specific dimension.

Parameters
[in]kthe dimension
Returns
the extent along that dimension
template<std::ptrdiff_t... StaticExtents>
static constexpr std::size_t gmx::extents< StaticExtents >::rank ( )
inlinestaticnoexcept

The rank of the extent.

Returns
the rank all extents together
template<std::ptrdiff_t... StaticExtents>
static constexpr std::size_t gmx::extents< StaticExtents >::rank_dynamic ( )
inlinestaticnoexcept

The rank of the dynamic extents.

Returns
Only the dynamic extents.
template<std::ptrdiff_t... StaticExtents>
static constexpr index_type gmx::extents< StaticExtents >::static_extent ( std::size_t  k)
inlinestaticnoexcept

The rank of the static extents.

Returns
Only the static extents.

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