DDC 0.5.0
Loading...
Searching...
No Matches
ddc::ChunkSpan< ElementType, SupportType, LayoutStridedPolicy, MemorySpace > Class Template Reference

#include <chunk_span.hpp>

Inheritance diagram for ddc::ChunkSpan< ElementType, SupportType, LayoutStridedPolicy, MemorySpace >:
Inheritance graph
Collaboration diagram for ddc::ChunkSpan< ElementType, SupportType, LayoutStridedPolicy, MemorySpace >:
Collaboration graph

Classes

struct  slicer
 
struct  slicer< detail::TypeSeq< DDims... > >
 

Public Types

using span_type = ChunkSpan< ElementType, SupportType, LayoutStridedPolicy, MemorySpace >
 type of a span of this full chunk
 
using view_type = ChunkSpan< ElementType const, SupportType, LayoutStridedPolicy, MemorySpace >
 type of a view of this full chunk
 
using discrete_domain_type = typename base_type::discrete_domain_type
 
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 discrete_domain_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, SupportType, LayoutStridedPolicy >
using discrete_domain_type = SupportType
 
using allocation_mdspan_type = Kokkos::mdspan< ElementType, Kokkos::dextents< std::size_t, SupportType::rank()>, LayoutStridedPolicy >
 The dereferenceable part of the co-domain but with a different domain, starting at 0.
 
using const_allocation_mdspan_type = Kokkos::mdspan< const ElementType, Kokkos::dextents< std::size_t, SupportType::rank()>, LayoutStridedPolicy >
 
using discrete_element_type = typename discrete_domain_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) noexcept=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>>>
 ChunkSpan (Chunk< OElementType, SupportType, Allocator > &&other) noexcept=delete
 Forbids to construct a ChunkSpan from a rvalue of type Chunk.
 
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, SupportType, 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, SupportType, 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, SupportType, 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, SupportType const &domain)
 Constructs a new ChunkSpan from scratch.
 
KOKKOS_FUNCTION constexpr ChunkSpan (allocation_mdspan_type allocation_mdspan, SupportType const &domain)
 Constructs a new ChunkSpan from scratch.
 
template<class KokkosView , class = std::enable_if_t<Kokkos::is_view_v<KokkosView>>>
KOKKOS_FUNCTION constexpr ChunkSpan (KokkosView const &view, SupportType const &domain) noexcept
 Constructs a new ChunkSpan from scratch.
 
KOKKOS_DEFAULTED_FUNCTION ~ChunkSpan () noexcept=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) noexcept=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... 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, SupportType, LayoutStridedPolicy >
KOKKOS_FUNCTION constexpr accessor_type accessor () const
 
KOKKOS_FUNCTION constexpr SupportType::discrete_vector_type 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 SupportType 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, SupportType, LayoutStridedPolicy >
 

Static Protected Member Functions

template<class QueryDDim , class... ODDims>
static KOKKOS_FUNCTION constexpr auto get_slicer_for (DiscreteVector< ODDims... > const &c)
 

Friends

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

Additional Inherited Members

- Static Public Member Functions inherited from ddc::ChunkCommon< ElementType, SupportType, 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 Member Functions inherited from ddc::ChunkCommon< ElementType, SupportType, LayoutStridedPolicy >
KOKKOS_DEFAULTED_FUNCTION constexpr ChunkCommon ()=default
 Empty ChunkCommon.
 
KOKKOS_FUNCTION constexpr ChunkCommon (allocation_mdspan_type allocation_mdspan, SupportType 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, SupportType 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) noexcept=default
 Constructs a new ChunkCommon by move.
 
KOKKOS_DEFAULTED_FUNCTION ~ChunkCommon () noexcept=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) noexcept=default
 Move-assigns a new value to this ChunkCommon.
 
KOKKOS_FUNCTION constexpr ElementTypedata_handle () const
 Access to the underlying allocation pointer.
 
KOKKOS_FUNCTION constexpr allocation_mdspan_type allocation_mdspan () const
 Provide a modifiable view of the data.
 
- Protected Attributes inherited from ddc::ChunkCommon< ElementType, SupportType, LayoutStridedPolicy >
allocation_mdspan_type m_allocation_mdspan
 The raw view of the data.
 
SupportType m_domain
 The mesh on which this chunk is defined.
 

Detailed Description

template<class ElementType, class SupportType, class LayoutStridedPolicy, class MemorySpace>
class ddc::ChunkSpan< ElementType, SupportType, LayoutStridedPolicy, MemorySpace >

Definition at line 386 of file chunk_span.hpp.


Class Documentation

◆ ddc::ChunkSpan::slicer

struct ddc::ChunkSpan::slicer
template<class ElementType, class SupportType, class LayoutStridedPolicy, class MemorySpace>
template<class TypeSeq>
struct ddc::ChunkSpan< ElementType, SupportType, LayoutStridedPolicy, MemorySpace >::slicer< TypeSeq >

Definition at line 450 of file chunk_span.hpp.

Collaboration diagram for ddc::ChunkSpan< ElementType, SupportType, LayoutStridedPolicy, MemorySpace >::slicer< TypeSeq >:
Collaboration graph

Member Typedef Documentation

◆ base_type

◆ span_type

◆ view_type

◆ discrete_domain_type

◆ memory_space

◆ allocation_mdspan_type

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

Definition at line 409 of file chunk_span.hpp.

◆ const_allocation_mdspan_type

◆ discrete_element_type

using ddc::ChunkSpan< ElementType, SupportType, LayoutStridedPolicy, MemorySpace >::discrete_element_type = typename discrete_domain_type::discrete_element_type

Definition at line 413 of file chunk_span.hpp.

◆ extents_type

◆ layout_type

◆ accessor_type

◆ mapping_type

◆ element_type

◆ value_type

◆ size_type

◆ data_handle_type

◆ reference

Constructor & Destructor Documentation

◆ ChunkSpan() [1/10]

◆ ChunkSpan() [2/10]

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

Parameters
otherthe ChunkSpan to copy

◆ ChunkSpan() [3/10]

◆ ChunkSpan() [4/10]

template<class OElementType , class Allocator , class = std::enable_if_t<std::is_same_v<typename Allocator::memory_space, MemorySpace>>>
ddc::ChunkSpan< ElementType, SupportType, LayoutStridedPolicy, MemorySpace >::ChunkSpan ( Chunk< OElementType, SupportType, Allocator > &&  other)
deletenoexcept

Forbids to construct a ChunkSpan from a rvalue of type Chunk.

◆ ChunkSpan() [5/10]

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, SupportType, LayoutStridedPolicy, MemorySpace >::ChunkSpan ( Chunk< OElementType, SupportType, Allocator > &  other)
inlineexplicitconstexprnoexcept

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

Parameters
otherthe Chunk to view

Definition at line 493 of file chunk_span.hpp.

◆ ChunkSpan() [6/10]

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, SupportType, LayoutStridedPolicy, MemorySpace >::ChunkSpan ( Chunk< OElementType, SupportType, Allocator > const other)
inlineexplicitconstexprnoexcept

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

Parameters
otherthe Chunk to view

Definition at line 509 of file chunk_span.hpp.

◆ ChunkSpan() [7/10]

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

Parameters
otherthe ChunkSpan to move

Definition at line 519 of file chunk_span.hpp.

◆ ChunkSpan() [8/10]

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

Constructs a new ChunkSpan from scratch.

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

Definition at line 532 of file chunk_span.hpp.

◆ ChunkSpan() [9/10]

Constructs a new ChunkSpan from scratch.

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

Definition at line 541 of file chunk_span.hpp.

◆ ChunkSpan() [10/10]

template<class KokkosView , class = std::enable_if_t<Kokkos::is_view_v<KokkosView>>>
KOKKOS_FUNCTION constexpr ddc::ChunkSpan< ElementType, SupportType, LayoutStridedPolicy, MemorySpace >::ChunkSpan ( KokkosView const view,
SupportType const domain 
)
inlineconstexprnoexcept

Constructs a new ChunkSpan from scratch.

Parameters
viewthe Kokkos view
domainthe domain that sustains the view

Definition at line 557 of file chunk_span.hpp.

◆ ~ChunkSpan()

Member Function Documentation

◆ get_slicer_for()

template<class QueryDDim , class... ODDims>
static KOKKOS_FUNCTION constexpr auto ddc::ChunkSpan< ElementType, SupportType, LayoutStridedPolicy, MemorySpace >::get_slicer_for ( DiscreteVector< ODDims... > const c)
inlinestaticconstexprprotected

Definition at line 438 of file chunk_span.hpp.

◆ 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]

◆ operator[]()

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

Slice out some dimensions.

Definition at line 581 of file chunk_span.hpp.

◆ operator()()

Element access using a list of DiscreteElement.

Parameters
delemsdiscrete elements
Returns
reference to this element

Definition at line 618 of file chunk_span.hpp.

◆ data_handle()

Access to the underlying allocation pointer.

Returns
allocation pointer

Definition at line 633 of file chunk_span.hpp.

◆ allocation_mdspan()

Provide a mdspan on the memory allocation.

Returns
allocation mdspan

Definition at line 641 of file chunk_span.hpp.

◆ allocation_kokkos_view()

Provide a mdspan on the memory allocation.

Returns
allocation mdspan

Definition at line 649 of file chunk_span.hpp.

◆ span_cview()

◆ span_view()

Friends And Related Symbol Documentation

◆ ChunkSpan

Definition at line 434 of file chunk_span.hpp.


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