|
dune-common 2.12-git
|
Slicing utilities for Dune::Std::mdspan.
More...
#include <array>#include <tuple>#include <type_traits>#include <dune/common/indices.hh>#include <dune/common/std/extents.hh>#include <dune/common/std/impl/submdspan.hh>#include <dune/common/std/mdspan.hh>#include <dune/common/std/submdspan_slices.hh>Go to the source code of this file.
Namespaces | |
| namespace | Dune |
| Dune namespace | |
| namespace | Dune::Std |
| Namespace for features backported from new C++ standards. | |
Functions | |
| template<class IndexType , std::size_t... exts, class... SliceSpecifiers, std::enable_if_t<(sizeof...(SliceSpecifiers)==sizeof...(exts)), int > = 0> | |
| constexpr auto | Dune::Std::subextents (const extents< IndexType, exts... > &src, SliceSpecifiers... slices) |
| Return the extents produced by slicing a source extents object. | |
| template<class Mapping , class... SliceSpecifiers, std::enable_if_t<(sizeof...(SliceSpecifiers)==Mapping::extents_type::rank()), int > = 0> | |
| constexpr auto | Dune::Std::submdspan_mapping (const Mapping &mapping, SliceSpecifiers... slices) |
| Create the mapping and source-data offset produced by slicing a layout mapping. | |
| template<class ElementType , class Extents , class LayoutPolicy , class AccessorPolicy , class... SliceSpecifiers, std::enable_if_t<(sizeof...(SliceSpecifiers)==Extents::rank()), int > = 0> | |
| constexpr auto | Dune::Std::submdspan (const mdspan< ElementType, Extents, LayoutPolicy, AccessorPolicy > &src, SliceSpecifiers... slices) |
Create an mdspan view by slicing an existing mdspan. | |
Detailed Description
Slicing utilities for Dune::Std::mdspan.
submdspan creates a non-owning view into an existing Dune::Std::mdspan. It follows the interface of std::submdspan from P2630R4 and the C++ standard working draft [mdspan.sub].
A slice specifier is provided for every source dimension. Each slice either fixes a dimension and removes it from the result rank, or keeps a dimension with a full, contiguous, or strided index set.
Supported slice specifiers:
- An integral value or
std::integral_constantfixes one source index and removes that dimension. Dune::Std::full_extentkeeps the full source dimension.Dune::Std::range_slice{first,last}keeps the half-open range[first,last).Dune::Std::range_slice{first,last,stride}keeps the strided rangefirst, first+stride, ....Dune::Std::extent_slice{offset,extent,stride}keepsextententries starting atoffsetwith the given stride.- Pair-like objects such as
std::pair{first,last}are accepted as half-open ranges.
The returned mdspan aliases the source data. The implementation preserves layout_right for fixed leading indices followed by full dimensions, e.g. row slices of a row-major tensor, and preserves layout_left for the symmetric fixed trailing-index case. Following P2642R0, contiguous submatrix-like slices of layout_left, layout_right, and the corresponding padded layouts return layout_left_padded or layout_right_padded when the resulting strides can be represented by those layouts. Other regular slices use layout_stride.
Examples:
Legal Statements / Impressum | Hosted by TU Dresden & Uni Heidelberg | Generated by
1.9.8