DDC 0.0.0

a discrete domain computation library

ddc::ChunkSpan< ElementType, DiscreteDomain< DDims... >, LayoutStridedPolicy, MemorySpace > Class Template Reference
Inheritance diagram for ddc::ChunkSpan< ElementType, DiscreteDomain< DDims... >, LayoutStridedPolicy, MemorySpace >:
Inheritance graph

Public Types

using span_type = ChunkSpan<ElementType, DiscreteDomain<DDims...>, LayoutStridedPolicy, MemorySpace>
 type of a span of this full chunk
 
using view_type
 type of a view of this full chunk
 
using mdomain_type = DiscreteDomain<DDims...>
 
using memory_space = MemorySpace
 
using allocation_mdspan_type = typename base_type::allocation_mdspan_type
 The dereferenceable part of the co-domain but with a different domain, starting at 0.
 
using const_allocation_mdspan_type = typename base_type::const_allocation_mdspan_type
 
using discrete_element_type = typename mdomain_type::discrete_element_type
 
using extents_type = typename base_type::extents_type
 
using layout_type = typename base_type::layout_type
 
using accessor_type = typename base_type::accessor_type
 
using mapping_type = typename base_type::mapping_type
 
using element_type = typename base_type::element_type
 
using value_type = typename base_type::value_type
 
using size_type = typename base_type::size_type
 
using data_handle_type = typename base_type::data_handle_type
 
using reference = typename base_type::reference
 
- Public Types inherited from ddc::ChunkCommon< ElementType, DiscreteDomain< DDims... >, LayoutStridedPolicy >
using mdomain_type = DiscreteDomain<DDims...>
 
using allocation_mdspan_type
 The dereferenceable part of the co-domain but with a different domain, starting at 0.
 
using const_allocation_mdspan_type
 
using discrete_element_type = typename mdomain_type::discrete_element_type
 
using extents_type = typename allocation_mdspan_type::extents_type
 
using layout_type = typename allocation_mdspan_type::layout_type
 
using accessor_type = typename allocation_mdspan_type::accessor_type
 
using mapping_type = typename allocation_mdspan_type::mapping_type
 
using element_type = typename allocation_mdspan_type::element_type
 
using value_type = typename allocation_mdspan_type::value_type
 
using size_type = typename allocation_mdspan_type::size_type
 
using data_handle_type = typename allocation_mdspan_type::data_handle_type
 
using reference = typename allocation_mdspan_type::reference
 

Public Member Functions

KOKKOS_DEFAULTED_FUNCTION constexpr ChunkSpan ()=default
 Empty ChunkSpan.
 
KOKKOS_DEFAULTED_FUNCTION constexpr ChunkSpan (ChunkSpan const &other)=default
 Constructs a new ChunkSpan by copy, yields a new view to the same data.
 
KOKKOS_DEFAULTED_FUNCTION constexpr ChunkSpan (ChunkSpan &&other)=default
 Constructs a new ChunkSpan by move.
 
template<class OElementType , class Allocator , class = std::enable_if_t<std::is_same_v<typename Allocator::memory_space, MemorySpace>>>
KOKKOS_FUNCTION constexpr ChunkSpan (Chunk< OElementType, mdomain_type, Allocator > &other) noexcept
 Constructs a new ChunkSpan from a Chunk, yields a new view to the same data.
 
template<class OElementType , class SFINAEElementType = ElementType, class = std::enable_if_t<std::is_const_v<SFINAEElementType>>, class Allocator , class = std::enable_if_t<std::is_same_v<typename Allocator::memory_space, MemorySpace>>>
KOKKOS_FUNCTION constexpr ChunkSpan (Chunk< OElementType, mdomain_type, Allocator > const &other) noexcept
 Constructs a new ChunkSpan from a Chunk, yields a new view to the same data.
 
template<class OElementType >
KOKKOS_FUNCTION constexpr ChunkSpan (ChunkSpan< OElementType, mdomain_type, layout_type, MemorySpace > const &other) noexcept
 Constructs a new ChunkSpan by copy of a chunk, yields a new view to the same data.
 
template<class Mapping = mapping_type, std::enable_if_t< std::is_constructible_v< Mapping, extents_type >, int > = 0>
KOKKOS_FUNCTION constexpr ChunkSpan (ElementType *const ptr, mdomain_type const &domain)
 Constructs a new ChunkSpan from scratch.
 
KOKKOS_FUNCTION constexpr ChunkSpan (allocation_mdspan_type allocation_mdspan, mdomain_type const &domain)
 Constructs a new ChunkSpan from scratch.
 
template<class KokkosView , class = std::enable_if_t<Kokkos::is_view<KokkosView>::value>>
KOKKOS_FUNCTION constexpr ChunkSpan (KokkosView const &view, mdomain_type const &domain) noexcept
 Constructs a new ChunkSpan from scratch.
 
KOKKOS_DEFAULTED_FUNCTION ~ChunkSpan ()=default
 
KOKKOS_DEFAULTED_FUNCTION constexpr ChunkSpanoperator= (ChunkSpan const &other)=default
 Copy-assigns a new value to this ChunkSpan, yields a new view to the same data.
 
KOKKOS_DEFAULTED_FUNCTION constexpr ChunkSpanoperator= (ChunkSpan &&other)=default
 Move-assigns a new value to this ChunkSpan.
 
template<class... QueryDDims>
KOKKOS_FUNCTION constexpr auto operator[] (DiscreteElement< QueryDDims... > const &slice_spec) const
 Slice out some dimensions.
 
template<class... QueryDDims>
KOKKOS_FUNCTION constexpr auto operator[] (DiscreteDomain< QueryDDims... > const &odomain) const
 Restrict to a subdomain.
 
template<class... DElems>
KOKKOS_FUNCTION constexpr reference operator() (DElems const &... delems) const noexcept
 Element access using a list of DiscreteElement.
 
KOKKOS_FUNCTION constexpr ElementTypedata_handle () const
 Access to the underlying allocation pointer.
 
KOKKOS_FUNCTION constexpr allocation_mdspan_type allocation_mdspan () const
 Provide a mdspan on the memory allocation.
 
KOKKOS_FUNCTION constexpr auto allocation_kokkos_view () const
 Provide a mdspan on the memory allocation.
 
KOKKOS_FUNCTION constexpr view_type span_cview () const
 
KOKKOS_FUNCTION constexpr span_type span_view () const
 
- Public Member Functions inherited from ddc::ChunkCommon< ElementType, DiscreteDomain< DDims... >, LayoutStridedPolicy >
KOKKOS_FUNCTION constexpr accessor_type accessor () const
 
KOKKOS_FUNCTION constexpr DiscreteVector< DDims... > extents () const noexcept
 
template<class QueryDDim >
KOKKOS_FUNCTION constexpr size_type extent () const noexcept
 
KOKKOS_FUNCTION constexpr size_type size () const noexcept
 
KOKKOS_FUNCTION constexpr mapping_type mapping () const noexcept
 
KOKKOS_FUNCTION constexpr bool is_unique () const noexcept
 
KOKKOS_FUNCTION constexpr bool is_exhaustive () const noexcept
 
KOKKOS_FUNCTION constexpr bool is_strided () const noexcept
 
template<class QueryDDim >
KOKKOS_FUNCTION constexpr size_type stride () const
 
KOKKOS_FUNCTION constexpr mdomain_type domain () const noexcept
 Provide access to the domain on which this chunk is defined.
 
template<class... QueryDDims>
KOKKOS_FUNCTION constexpr DiscreteDomain< QueryDDims... > domain () const noexcept
 Provide access to the domain on which this chunk is defined.
 

Protected Types

using base_type = ChunkCommon<ElementType, DiscreteDomain<DDims...>, LayoutStridedPolicy>
 
using internal_mdspan_type
 the raw mdspan underlying this, with the same indexing (0 might no be dereferenceable)
 
- Protected Types inherited from ddc::ChunkCommon< ElementType, DiscreteDomain< DDims... >, LayoutStridedPolicy >
using internal_mdspan_type
 the raw mdspan underlying this, with the same indexing (0 might no be dereferenceable)
 

Protected Member Functions

template<class QueryDDim , class... ODDims>
KOKKOS_FUNCTION constexpr auto get_slicer_for (DiscreteElement< ODDims... > const &c) const
 
template<class QueryDDim , class... ODDims>
KOKKOS_FUNCTION constexpr auto get_slicer_for (DiscreteDomain< ODDims... > const &c) const
 
- Protected Member Functions inherited from ddc::ChunkCommon< ElementType, DiscreteDomain< DDims... >, LayoutStridedPolicy >
KOKKOS_DEFAULTED_FUNCTION constexpr ChunkCommon ()=default
 Empty ChunkCommon.
 
KOKKOS_FUNCTION constexpr ChunkCommon (internal_mdspan_type internal_mdspan, mdomain_type const &domain) noexcept
 Constructs a new ChunkCommon from scratch.
 
template<class Mapping = mapping_type, std::enable_if_t< std::is_constructible_v< Mapping, extents_type >, int > = 0>
KOKKOS_FUNCTION constexpr ChunkCommon (ElementType *ptr, mdomain_type const &domain)
 Constructs a new ChunkCommon from scratch.
 
KOKKOS_DEFAULTED_FUNCTION constexpr ChunkCommon (ChunkCommon const &other)=default
 Constructs a new ChunkCommon by copy, yields a new view to the same data.
 
KOKKOS_DEFAULTED_FUNCTION constexpr ChunkCommon (ChunkCommon &&other)=default
 Constructs a new ChunkCommon by move.
 
KOKKOS_DEFAULTED_FUNCTION ~ChunkCommon ()=default
 
KOKKOS_DEFAULTED_FUNCTION constexpr ChunkCommonoperator= (ChunkCommon const &other)=default
 Copy-assigns a new value to this ChunkCommon, yields a new view to the same data.
 
KOKKOS_DEFAULTED_FUNCTION constexpr ChunkCommonoperator= (ChunkCommon &&other)=default
 Move-assigns a new value to this ChunkCommon.
 
KOKKOS_FUNCTION constexpr ElementTypedata_handle () const
 Access to the underlying allocation pointer.
 
KOKKOS_FUNCTION constexpr internal_mdspan_type internal_mdspan () const
 Provide a modifiable view of the data.
 
KOKKOS_FUNCTION constexpr allocation_mdspan_type allocation_mdspan () const
 Provide a modifiable view of the data.
 

Friends

template<class , class , class , class >
class ChunkSpan
 

Additional Inherited Members

- Static Public Member Functions inherited from ddc::ChunkCommon< ElementType, DiscreteDomain< DDims... >, LayoutStridedPolicy >
static KOKKOS_FUNCTION constexpr int rank () noexcept
 
static KOKKOS_FUNCTION constexpr int rank_dynamic () noexcept
 
static KOKKOS_FUNCTION constexpr size_type static_extent (std::size_t r) noexcept
 
static KOKKOS_FUNCTION constexpr bool is_always_unique () noexcept
 
static KOKKOS_FUNCTION constexpr bool is_always_exhaustive () noexcept
 
static KOKKOS_FUNCTION constexpr bool is_always_strided () noexcept
 
- Protected Attributes inherited from ddc::ChunkCommon< ElementType, DiscreteDomain< DDims... >, LayoutStridedPolicy >
internal_mdspan_type m_internal_mdspan
 The raw view of the data.
 
mdomain_type m_domain
 The mesh on which this chunk is defined.
 

Member Typedef Documentation

◆ base_type

◆ span_type

◆ view_type

Initial value:
ElementType const,
DiscreteDomain<DDims...>,
constexpr bool enable_chunk
Definition chunk_traits.hpp:16

type of a view of this full chunk

◆ mdomain_type

◆ memory_space

◆ allocation_mdspan_type

The dereferenceable part of the co-domain but with a different domain, starting at 0.

◆ const_allocation_mdspan_type

◆ discrete_element_type

◆ extents_type

◆ layout_type

◆ accessor_type

◆ mapping_type

◆ element_type

◆ value_type

◆ size_type

◆ data_handle_type

◆ reference

◆ internal_mdspan_type

template<class ElementType , class... DDims, class LayoutStridedPolicy , class MemorySpace >
using ddc::ChunkCommon< ElementType, DiscreteDomain< DDims... >, LayoutStridedPolicy >::internal_mdspan_type
protected

the raw mdspan underlying this, with the same indexing (0 might no be dereferenceable)

Constructor & Destructor Documentation

◆ ChunkSpan() [1/9]

◆ ChunkSpan() [2/9]

Constructs a new ChunkSpan by copy, yields a new view to the same data.

Parameters
otherthe ChunkSpan to copy

◆ ChunkSpan() [3/9]

Constructs a new ChunkSpan by move.

Parameters
otherthe ChunkSpan to move

◆ ChunkSpan() [4/9]

template<class ElementType , class... DDims, class LayoutStridedPolicy , class MemorySpace >
template<class OElementType , class Allocator , class = std::enable_if_t<std::is_same_v<typename Allocator::memory_space, MemorySpace>>>
KOKKOS_FUNCTION constexpr ddc::ChunkSpan< ElementType, DiscreteDomain< DDims... >, LayoutStridedPolicy, MemorySpace >::ChunkSpan ( Chunk< OElementType, mdomain_type, Allocator > & other)
inlineconstexprnoexcept

Constructs a new ChunkSpan from a Chunk, yields a new view to the same data.

Parameters
otherthe Chunk to view

◆ ChunkSpan() [5/9]

template<class ElementType , class... DDims, class LayoutStridedPolicy , class MemorySpace >
template<class OElementType , class SFINAEElementType = ElementType, class = std::enable_if_t<std::is_const_v<SFINAEElementType>>, class Allocator , class = std::enable_if_t<std::is_same_v<typename Allocator::memory_space, MemorySpace>>>
KOKKOS_FUNCTION constexpr ddc::ChunkSpan< ElementType, DiscreteDomain< DDims... >, LayoutStridedPolicy, MemorySpace >::ChunkSpan ( Chunk< OElementType, mdomain_type, Allocator > const & other)
inlineconstexprnoexcept

Constructs a new ChunkSpan from a Chunk, yields a new view to the same data.

Parameters
otherthe Chunk to view

◆ ChunkSpan() [6/9]

Constructs a new ChunkSpan by copy of a chunk, yields a new view to the same data.

Parameters
otherthe ChunkSpan to move

◆ ChunkSpan() [7/9]

template<class ElementType , class... DDims, class LayoutStridedPolicy , class MemorySpace >
template<class Mapping = mapping_type, std::enable_if_t< std::is_constructible_v< Mapping, extents_type >, int > = 0>
KOKKOS_FUNCTION constexpr ddc::ChunkSpan< ElementType, DiscreteDomain< DDims... >, LayoutStridedPolicy, MemorySpace >::ChunkSpan ( ElementType *const ptr,
mdomain_type const & domain )
inlineconstexpr

Constructs a new ChunkSpan from scratch.

Parameters
ptrthe allocation pointer to the data
domainthe domain that sustains the view

◆ ChunkSpan() [8/9]

template<class ElementType , class... DDims, class LayoutStridedPolicy , class MemorySpace >
KOKKOS_FUNCTION constexpr ddc::ChunkSpan< ElementType, DiscreteDomain< DDims... >, LayoutStridedPolicy, MemorySpace >::ChunkSpan ( allocation_mdspan_type allocation_mdspan,
mdomain_type const & domain )
inlineconstexpr

Constructs a new ChunkSpan from scratch.

Parameters
allocation_mdspanthe allocation mdspan to the data
domainthe domain that sustains the view

◆ ChunkSpan() [9/9]

template<class ElementType , class... DDims, class LayoutStridedPolicy , class MemorySpace >
template<class KokkosView , class = std::enable_if_t<Kokkos::is_view<KokkosView>::value>>
KOKKOS_FUNCTION constexpr ddc::ChunkSpan< ElementType, DiscreteDomain< DDims... >, LayoutStridedPolicy, MemorySpace >::ChunkSpan ( KokkosView const & view,
mdomain_type const & domain )
inlineconstexprnoexcept

Constructs a new ChunkSpan from scratch.

Parameters
viewthe Kokkos view
domainthe domain that sustains the view

◆ ~ChunkSpan()

Member Function Documentation

◆ get_slicer_for() [1/2]

template<class ElementType , class... DDims, class LayoutStridedPolicy , class MemorySpace >
template<class QueryDDim , class... ODDims>
KOKKOS_FUNCTION constexpr auto ddc::ChunkSpan< ElementType, DiscreteDomain< DDims... >, LayoutStridedPolicy, MemorySpace >::get_slicer_for ( DiscreteElement< ODDims... > const & c) const
inlineconstexprprotected

◆ get_slicer_for() [2/2]

template<class ElementType , class... DDims, class LayoutStridedPolicy , class MemorySpace >
template<class QueryDDim , class... ODDims>
KOKKOS_FUNCTION constexpr auto ddc::ChunkSpan< ElementType, DiscreteDomain< DDims... >, LayoutStridedPolicy, MemorySpace >::get_slicer_for ( DiscreteDomain< ODDims... > const & c) const
inlineconstexprprotected

◆ operator=() [1/2]

Copy-assigns a new value to this ChunkSpan, yields a new view to the same data.

Parameters
otherthe ChunkSpan to copy
Returns
*this

◆ operator=() [2/2]

Move-assigns a new value to this ChunkSpan.

Parameters
otherthe ChunkSpan to move
Returns
*this

◆ operator[]() [1/2]

template<class ElementType , class... DDims, class LayoutStridedPolicy , class MemorySpace >
template<class... QueryDDims>
KOKKOS_FUNCTION constexpr auto ddc::ChunkSpan< ElementType, DiscreteDomain< DDims... >, LayoutStridedPolicy, MemorySpace >::operator[] ( DiscreteElement< QueryDDims... > const & slice_spec) const
inlineconstexpr

Slice out some dimensions.

◆ operator[]() [2/2]

template<class ElementType , class... DDims, class LayoutStridedPolicy , class MemorySpace >
template<class... QueryDDims>
KOKKOS_FUNCTION constexpr auto ddc::ChunkSpan< ElementType, DiscreteDomain< DDims... >, LayoutStridedPolicy, MemorySpace >::operator[] ( DiscreteDomain< QueryDDims... > const & odomain) const
inlineconstexpr

Restrict to a subdomain.

◆ operator()()

template<class ElementType , class... DDims, class LayoutStridedPolicy , class MemorySpace >
template<class... DElems>
KOKKOS_FUNCTION constexpr reference ddc::ChunkSpan< ElementType, DiscreteDomain< DDims... >, LayoutStridedPolicy, MemorySpace >::operator() ( DElems const &... delems) const
inlineconstexprnoexcept

Element access using a list of DiscreteElement.

Parameters
delemsdiscrete elements
Returns
reference to this element

◆ data_handle()

Access to the underlying allocation pointer.

Returns
allocation pointer

◆ allocation_mdspan()

Provide a mdspan on the memory allocation.

Returns
allocation mdspan

◆ allocation_kokkos_view()

template<class ElementType , class... DDims, class LayoutStridedPolicy , class MemorySpace >
KOKKOS_FUNCTION constexpr auto ddc::ChunkSpan< ElementType, DiscreteDomain< DDims... >, LayoutStridedPolicy, MemorySpace >::allocation_kokkos_view ( ) const
inlineconstexpr

Provide a mdspan on the memory allocation.

Returns
allocation mdspan

◆ span_cview()

◆ span_view()

Friends And Related Symbol Documentation

◆ ChunkSpan

template<class ElementType , class... DDims, class LayoutStridedPolicy , class MemorySpace >
template<class , class , class , class >
friend class ChunkSpan
friend

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