12#include <Kokkos_Core.hpp>
14#include "detail/kokkos.hpp"
15#include "detail/macros.hpp"
27template <
class,
class,
class>
33 class LayoutStridedPolicy = Kokkos::layout_right,
34 class MemorySpace = Kokkos::DefaultHostExecutionSpace::memory_space>
47template <
class ElementType,
class SupportType,
class LayoutStridedPolicy,
class MemorySpace>
51 std::is_same_v<LayoutStridedPolicy, Kokkos::layout_left>
52 || std::is_same_v<LayoutStridedPolicy, Kokkos::layout_right>
53 || std::is_same_v<LayoutStridedPolicy, Kokkos::layout_stride>,
54 "ChunkSpan only supports layout_left, layout_right or layout_stride");
56 Kokkos::is_memory_space_v<MemorySpace>,
57 "ChunkSpan requires a valid Kokkos memory space");
60 using base_type =
ChunkCommon<ElementType, SupportType, LayoutStridedPolicy>;
64 using span_type =
ChunkSpan<ElementType, SupportType, LayoutStridedPolicy, MemorySpace>;
67 using view_type =
ChunkSpan<ElementType
const, SupportType, LayoutStridedPolicy, MemorySpace>;
69 using discrete_domain_type = base_type::discrete_domain_type;
71 using memory_space = MemorySpace;
74 using allocation_mdspan_type = base_type::allocation_mdspan_type;
76 using const_allocation_mdspan_type = base_type::const_allocation_mdspan_type;
78 using discrete_element_type = discrete_domain_type::discrete_element_type;
80 using discrete_vector_type = discrete_domain_type::discrete_vector_type;
82 using extents_type = base_type::extents_type;
84 using layout_type = base_type::layout_type;
86 using accessor_type = base_type::accessor_type;
88 using mapping_type = base_type::mapping_type;
90 using element_type = base_type::element_type;
92 using value_type = base_type::value_type;
94 using size_type = base_type::size_type;
96 using data_handle_type = base_type::data_handle_type;
98 using reference = base_type::reference;
100 template <
class,
class,
class,
class>
104 template <
concepts::discrete_dimension QueryDDim,
concepts::discrete_dimension... ODDims>
107 DDC_IF_NVCC_THEN_PUSH_AND_SUPPRESS(implicit_return_from_non_void_function)
108 if constexpr (in_tags_v<QueryDDim,
TypeSeq<ODDims...>>) {
109 return c.
template get<QueryDDim>();
111 return Kokkos::full_extent;
117 concepts::discrete_dimension QueryDDim,
118 concepts::discrete_dimension... ODDims,
119 concepts::discrete_dimension... OODDims>
124 DDC_IF_NVCC_THEN_PUSH_AND_SUPPRESS(implicit_return_from_non_void_function)
125 if constexpr (in_tags_v<QueryDDim,
TypeSeq<ODDims...>>) {
128 return std::pair<std::size_t, std::size_t>(
129 c_slice.front() - origin_slice.front(),
130 c_slice.back() + 1 - origin_slice.front());
132 return Kokkos::full_extent;
137 template <
class TypeSeq>
142 template <
concepts::discrete_dimension... DDims>
145 template <
concepts::discrete_dimension... ODDims>
146 KOKKOS_FUNCTION
constexpr auto operator()(
147 allocation_mdspan_type
const& span,
150 return Kokkos::submdspan(span, get_slicer_for<DDims>(c)...);
153 template <
concepts::discrete_dimension... ODDims,
concepts::discrete_dimension... OODDims>
154 KOKKOS_FUNCTION
constexpr auto operator()(
155 allocation_mdspan_type
const& span,
159 return Kokkos::submdspan(span, get_slicer_for<DDims>(c, origin)...);
165 KOKKOS_DEFAULTED_FUNCTION
constexpr ChunkSpan() =
default;
168
169
173
174
178
179 template <
class OElementType,
class Allocator>
180 ChunkSpan(
Chunk<OElementType, SupportType, Allocator>&& other)
noexcept
181 requires(std::is_same_v<
typename Allocator::memory_space, MemorySpace>)
185
186
187 template <
class OElementType,
class Allocator>
188 KOKKOS_FUNCTION
constexpr explicit ChunkSpan(
189 Chunk<OElementType, SupportType, Allocator>& other)
noexcept
190 requires(std::is_same_v<
typename Allocator::memory_space, MemorySpace>)
191 : base_type(other.m_allocation_mdspan, other.m_domain)
196
197
199 template <
class OElementType,
class Allocator>
200 KOKKOS_FUNCTION
constexpr explicit ChunkSpan(
201 Chunk<OElementType, SupportType, Allocator>
const& other)
noexcept
203 std::is_const_v<ElementType>
204 && std::is_same_v<
typename Allocator::memory_space, MemorySpace>)
205 : base_type(other.m_allocation_mdspan, other.m_domain)
210
211
212 template <
class OElementType,
class OLayout>
213 KOKKOS_FUNCTION
constexpr explicit ChunkSpan(
214 ChunkSpan<OElementType, SupportType, OLayout, MemorySpace>
const& other)
noexcept
215 requires(std::constructible_from<
216 allocation_mdspan_type,
217 Kokkos::mdspan<OElementType, extents_type, OLayout>>)
218 : base_type(other.m_allocation_mdspan, other.m_domain)
223
224
225
226 KOKKOS_FUNCTION
constexpr ChunkSpan(ElementType*
const ptr, SupportType
const& domain)
227 requires(std::is_constructible_v<mapping_type, extents_type>)
228 : base_type(ptr, domain)
233
234
235
237 allocation_mdspan_type allocation_mdspan,
238 SupportType
const& domain)
239 : base_type(allocation_mdspan, domain)
241 if constexpr (SupportType::rank() > 0) {
242 for (std::size_t i = 0; i < SupportType::rank(); ++i) {
244 allocation_mdspan.extent(i)
245 ==
static_cast<std::size_t>(detail::array(domain.extents())[i]))
251
252
253
254 template <
class KokkosView>
255 KOKKOS_FUNCTION
constexpr ChunkSpan(KokkosView
const& view, SupportType
const& domain)
noexcept
256 requires(Kokkos::is_view_v<KokkosView>)
258 detail::build_mdspan(view, std::make_index_sequence<SupportType::rank()> {}),
263 KOKKOS_DEFAULTED_FUNCTION ~
ChunkSpan()
noexcept =
default;
266
267
268
272
273
274
278
279 template <
concepts::discrete_dimension... QueryDDims>
286 Slicer<to_type_seq_t<SupportType>>
const slicer;
287 auto subview = slicer(
this->allocation_mdspan(), slice_spec);
288 using layout_type =
decltype(subview)::layout_type;
289 using mapping_type =
decltype(subview)::mapping_type;
290 using extents_type =
decltype(subview)::extents_type;
291 using OutTypeSeqDDims
292 = type_seq_remove_t<to_type_seq_t<SupportType>,
TypeSeq<QueryDDims...>>;
293 using OutDDom = detail::Rebind<SupportType, OutTypeSeqDDims>::type;
295 std::is_same_v<layout_type, Kokkos::layout_left>
296 || std::is_same_v<layout_type, Kokkos::layout_right>
297 || std::is_same_v<layout_type, Kokkos::layout_stride>) {
302 memory_space>(subview, OutDDom(
this->m_domain));
304 static_assert(mapping_type::is_always_strided() && mapping_type::is_always_unique());
305 Kokkos::layout_stride::mapping<extents_type>
const mapping_stride(subview.mapping());
306 Kokkos::mdspan<ElementType, extents_type, Kokkos::layout_stride>
const
307 a(subview.data_handle(), mapping_stride);
311 Kokkos::layout_stride,
312 memory_space>(a, OutDDom(
this->m_domain));
317
318 template <
concepts::discrete_dimension... QueryDDims>
319 KOKKOS_FUNCTION
constexpr auto operator[](
320 DiscreteElement<QueryDDims...>
const& slice_spec)
const
322 using QueryDDom = detail::Rebind<SupportType,
TypeSeq<QueryDDims...>>::type;
323 KOKKOS_ASSERT(QueryDDom(
this->m_domain).contains(slice_spec))
324 return (*
this)[QueryDDom(
this->m_domain).distance_from_front(slice_spec)];
328
329 template <
concepts::discrete_dimension... QueryDDims>
331 requires(is_discrete_domain_v<SupportType>)
335 || (
DiscreteDomain<QueryDDims...>(
this->m_domain).contains(odomain.front())
336 &&
DiscreteDomain<QueryDDims...>(
this->m_domain).contains(odomain.back())))
337 Slicer<to_type_seq_t<SupportType>>
const slicer;
338 auto subview = slicer(
this->allocation_mdspan(), odomain,
this->m_domain);
339 using layout_type =
decltype(subview)::layout_type;
340 using mapping_type =
decltype(subview)::mapping_type;
341 using extents_type =
decltype(subview)::extents_type;
343 std::is_same_v<layout_type, Kokkos::layout_left>
344 || std::is_same_v<layout_type, Kokkos::layout_right>
345 || std::is_same_v<layout_type, Kokkos::layout_stride>) {
348 decltype(
this->m_domain.restrict_with(odomain)),
350 memory_space>(subview,
this->m_domain.restrict_with(odomain));
352 static_assert(mapping_type::is_always_strided() && mapping_type::is_always_unique());
353 Kokkos::layout_stride::mapping<extents_type>
const mapping_stride(subview.mapping());
354 Kokkos::mdspan<ElementType, extents_type, Kokkos::layout_stride>
const
355 a(subview.data_handle(), mapping_stride);
358 decltype(
this->m_domain.restrict_with(odomain)),
359 Kokkos::layout_stride,
360 memory_space>(a,
this->m_domain.restrict_with(odomain));
365
366
367
368 template <
concepts::discrete_element... DElems>
369 KOKKOS_FUNCTION
constexpr reference
operator()(DElems
const&... delems)
const noexcept
372 SupportType::rank() == (0 + ... + DElems::size()),
373 "Invalid number of dimensions");
374 KOKKOS_ASSERT(
this->m_domain.contains(delems...))
375 return DDC_MDSPAN_ACCESS_OP(
376 this->m_allocation_mdspan,
377 detail::array(
this->m_domain.distance_from_front(delems...)));
381
382
383
384 template <
concepts::discrete_vector... DVects>
385 KOKKOS_FUNCTION
constexpr reference
operator()(DVects
const&... dvects)
const noexcept
386 requires(
sizeof...(DVects) != 0)
389 SupportType::rank() == (0 + ... + DVects::size()),
390 "Invalid number of dimensions");
391 return DDC_MDSPAN_ACCESS_OP(
392 this->m_allocation_mdspan,
393 detail::array(discrete_vector_type(dvects...)));
397
398
399 KOKKOS_FUNCTION
constexpr ElementType*
data_handle()
const
401 return base_type::data_handle();
405
406
409 return base_type::allocation_mdspan();
413
414
417 auto s =
this->allocation_mdspan();
418 auto kokkos_layout = detail::build_kokkos_layout(
421 std::make_index_sequence<SupportType::rank()> {});
423 detail::mdspan_to_kokkos_element_t<ElementType, SupportType::rank()>,
424 decltype(kokkos_layout),
425 MemorySpace>(s.data_handle(), kokkos_layout);
428 KOKKOS_FUNCTION
constexpr view_type
span_cview()
const
430 return view_type(*
this);
433 KOKKOS_FUNCTION
constexpr span_type
span_view()
const
439template <
class DataType,
class... Properties,
class SupportType>
441 Kokkos::View<DataType, Properties...>
const& view,
444 detail::kokkos_to_mdspan_element_t<
445 typename Kokkos::View<DataType, Properties...>::
data_type>,
447 detail::kokkos_to_mdspan_layout_t<
448 typename Kokkos::View<DataType, Properties...>::
array_layout>,
449 typename Kokkos::View<DataType, Properties...>::
memory_space>;
451template <
class ElementType,
class SupportType,
class Allocator>
455 Kokkos::layout_right,
458template <
class ElementType,
class SupportType,
class Allocator>
462 Kokkos::layout_right,
468 class LayoutStridedPolicy = Kokkos::layout_right,
469 class MemorySpace = Kokkos::HostSpace>
470using ChunkView =
ChunkSpan<ElementType
const, SupportType, LayoutStridedPolicy, MemorySpace>;
KOKKOS_FUNCTION constexpr ChunkCommon(ElementType *ptr, SupportType const &domain)
Constructs a new ChunkCommon from scratch.
KOKKOS_FUNCTION constexpr bool is_strided() const noexcept
KOKKOS_DEFAULTED_FUNCTION ~ChunkCommon() noexcept=default
KOKKOS_FUNCTION constexpr ElementType * data_handle() const
Access to the underlying allocation pointer.
KOKKOS_DEFAULTED_FUNCTION constexpr ChunkCommon()=default
Empty ChunkCommon.
allocation_mdspan_type m_allocation_mdspan
The raw view of the data.
KOKKOS_FUNCTION constexpr SupportType domain() const noexcept
Provide access to the domain on which this chunk is defined.
static KOKKOS_FUNCTION constexpr bool is_always_strided() noexcept
KOKKOS_FUNCTION constexpr allocation_mdspan_type allocation_mdspan() const
Provide a modifiable view of the data.
KOKKOS_FUNCTION constexpr ChunkCommon(allocation_mdspan_type allocation_mdspan, SupportType const &domain) noexcept
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.
static KOKKOS_FUNCTION constexpr bool is_always_unique() noexcept
KOKKOS_FUNCTION constexpr DiscreteDomain< QueryDDims... > domain() const noexcept
Provide access to the domain on which this chunk is defined.
KOKKOS_DEFAULTED_FUNCTION constexpr ChunkCommon & operator=(ChunkCommon const &other)=default
Copy-assigns a new value to this ChunkCommon, 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 constexpr ChunkCommon & operator=(ChunkCommon &&other) noexcept=default
Move-assigns a new value to this ChunkCommon.
KOKKOS_FUNCTION constexpr size_type extent() const noexcept
KOKKOS_FUNCTION constexpr size_type stride() const
KOKKOS_FUNCTION constexpr bool is_exhaustive() const noexcept
KOKKOS_FUNCTION constexpr mapping_type mapping() const noexcept
static KOKKOS_FUNCTION constexpr int rank() noexcept
KOKKOS_FUNCTION constexpr bool is_unique() const noexcept
KOKKOS_FUNCTION constexpr accessor_type accessor() const
KOKKOS_FUNCTION constexpr SupportType::discrete_vector_type extents() const noexcept
KOKKOS_FUNCTION constexpr size_type size() const noexcept
SupportType m_domain
The mesh on which this chunk is defined.
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_exhaustive() noexcept
KOKKOS_DEFAULTED_FUNCTION constexpr ChunkSpan(ChunkSpan &&other) noexcept=default
Constructs a new ChunkSpan by move.
KOKKOS_FUNCTION constexpr view_type span_cview() const
KOKKOS_FUNCTION constexpr ChunkSpan(allocation_mdspan_type allocation_mdspan, SupportType const &domain)
Constructs a new ChunkSpan from scratch.
KOKKOS_FUNCTION constexpr auto operator[](DiscreteElement< QueryDDims... > const &slice_spec) const
Slice out some dimensions.
ChunkSpan(Chunk< OElementType, SupportType, Allocator > &&other) noexcept=delete
Forbids to construct a ChunkSpan from a rvalue of type Chunk.
KOKKOS_FUNCTION constexpr ChunkSpan(ChunkSpan< OElementType, SupportType, OLayout, MemorySpace > const &other) noexcept
Constructs a new ChunkSpan by copy of a chunk, yields a new view to the same data.
KOKKOS_DEFAULTED_FUNCTION constexpr ChunkSpan(ChunkSpan const &other)=default
Constructs a new ChunkSpan by copy, yields a new view to the same data.
static KOKKOS_FUNCTION constexpr auto get_slicer_for(DiscreteDomain< ODDims... > const &c, DiscreteDomain< OODDims... > const &origin)
static KOKKOS_FUNCTION constexpr auto get_slicer_for(DiscreteVector< ODDims... > const &c)
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.
KOKKOS_FUNCTION constexpr reference operator()(DElems const &... delems) const noexcept
Element access using a list of DiscreteElement.
KOKKOS_DEFAULTED_FUNCTION constexpr ChunkSpan()=default
Empty ChunkSpan.
KOKKOS_FUNCTION constexpr allocation_mdspan_type allocation_mdspan() const
Provide a mdspan on the memory allocation.
KOKKOS_FUNCTION constexpr ElementType * data_handle() const
Access to the underlying allocation pointer.
KOKKOS_FUNCTION constexpr auto allocation_kokkos_view() const
Provide a mdspan on the memory allocation.
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.
KOKKOS_DEFAULTED_FUNCTION constexpr ChunkSpan & operator=(ChunkSpan const &other)=default
Copy-assigns a new value to this ChunkSpan, yields a new view to the same data.
KOKKOS_FUNCTION constexpr ChunkSpan(KokkosView const &view, SupportType const &domain) noexcept
Constructs a new ChunkSpan from scratch.
KOKKOS_FUNCTION constexpr auto operator[](DiscreteVector< QueryDDims... > const &slice_spec) const
Slice out some dimensions.
KOKKOS_DEFAULTED_FUNCTION ~ChunkSpan() noexcept=default
KOKKOS_FUNCTION constexpr auto operator[](DiscreteDomain< QueryDDims... > const &odomain) const
Restrict to a subdomain, only valid when SupportType is a DiscreteDomain.
KOKKOS_FUNCTION constexpr span_type span_view() const
KOKKOS_FUNCTION constexpr ChunkSpan(ElementType *const ptr, SupportType const &domain)
Constructs a new ChunkSpan from scratch.
KOKKOS_DEFAULTED_FUNCTION constexpr ChunkSpan & operator=(ChunkSpan &&other) noexcept=default
Move-assigns a new value to this ChunkSpan.
auto operator[](DiscreteElement< QueryDDims... > const &slice_spec) const
Slice out some dimensions.
auto operator[](DiscreteVector< QueryDDims... > const &slice_spec) const
Slice out some dimensions.
char const * label() const
Returns the label of the Chunk.
const_allocation_mdspan_type allocation_mdspan() const
Provide a mdspan on the memory allocation.
ElementType const * data_handle() const
Access to the underlying allocation pointer.
auto allocation_kokkos_view()
Provide an unmanaged Kokkos::View on the memory allocation.
auto operator[](DiscreteDomain< QueryDDims... > const &odomain)
Slice out some dimensions.
auto allocation_kokkos_view() const
Provide an unmanaged Kokkos::View on the memory allocation.
Chunk(SupportType const &domain, Allocator allocator=Allocator())
Construct a Chunk on a domain with uninitialized values.
Chunk & operator=(Chunk const &other)=delete
Deleted: use deepcopy instead.
allocation_mdspan_type allocation_mdspan()
Provide a mdspan on the memory allocation.
ElementType * data_handle()
Access to the underlying allocation pointer.
view_type span_cview() const
Chunk(Chunk const &other)=delete
Deleted: use deepcopy instead.
Chunk(std::string const &label, SupportType const &domain, Allocator allocator=Allocator())
Construct a labeled Chunk on a domain with uninitialized values.
element_type & operator()(DElems const &... delems) noexcept
Element access using a list of DiscreteElement.
Chunk()=default
Empty Chunk.
Chunk & operator=(Chunk &&other) noexcept
Move-assigns a new value to this field.
Chunk(Chunk &&other) noexcept
Constructs a new Chunk by move.
view_type span_view() const
auto operator[](DiscreteDomain< QueryDDims... > const &odomain) const
Slice out some dimensions.
element_type const & operator()(DElems const &... delems) const noexcept
Element access using a list of DiscreteElement.
auto operator[](DiscreteVector< QueryDDims... > const &slice_spec)
Slice out some dimensions.
auto operator[](DiscreteElement< QueryDDims... > const &slice_spec)
Slice out some dimensions.
static KOKKOS_FUNCTION constexpr discrete_vector_type extents() noexcept
KOKKOS_DEFAULTED_FUNCTION ~DiscreteDomain()=default
KOKKOS_FUNCTION constexpr DiscreteDomain(discrete_element_type const &element_begin, discrete_vector_type const &size)
Construct a DiscreteDomain starting from element_begin with size points.
KOKKOS_FUNCTION constexpr DiscreteDomain(DDoms const &...)
Construct a DiscreteDomain by copies and merge of domains.
KOKKOS_FUNCTION constexpr DiscreteDomain take_last(discrete_vector_type) const
KOKKOS_FUNCTION constexpr bool operator==(DiscreteDomain const &) const
KOKKOS_FUNCTION constexpr DiscreteDomain remove(discrete_vector_type, discrete_vector_type) const
static KOKKOS_FUNCTION constexpr std::size_t rank()
KOKKOS_FUNCTION constexpr DiscreteDomain remove_last(discrete_vector_type) const
KOKKOS_DEFAULTED_FUNCTION DiscreteDomain(DiscreteDomain const &x)=default
static KOKKOS_FUNCTION bool contains() noexcept
KOKKOS_DEFAULTED_FUNCTION constexpr DiscreteDomain()=default
KOKKOS_DEFAULTED_FUNCTION DiscreteDomain & operator=(DiscreteDomain &&x)=default
KOKKOS_FUNCTION constexpr operator bool()
static KOKKOS_FUNCTION constexpr std::size_t size()
static KOKKOS_FUNCTION constexpr bool empty() noexcept
static KOKKOS_FUNCTION bool contains(DiscreteElement<>) noexcept
static KOKKOS_FUNCTION constexpr discrete_element_type back() noexcept
KOKKOS_FUNCTION constexpr DiscreteDomain restrict_with(DiscreteDomain< ODDims... > const &) const
static KOKKOS_FUNCTION DiscreteVector distance_from_front(DiscreteElement<>) noexcept
KOKKOS_FUNCTION constexpr DiscreteDomain remove_first(discrete_vector_type) const
static KOKKOS_FUNCTION constexpr discrete_element_type front() noexcept
KOKKOS_DEFAULTED_FUNCTION DiscreteDomain & operator=(DiscreteDomain const &x)=default
KOKKOS_FUNCTION constexpr DiscreteDomain take_first(discrete_vector_type) const
KOKKOS_FUNCTION constexpr DiscreteElement operator()(DiscreteVector<> const &) const noexcept
KOKKOS_DEFAULTED_FUNCTION DiscreteDomain(DiscreteDomain &&x)=default
static KOKKOS_FUNCTION DiscreteVector distance_from_front() noexcept
KOKKOS_DEFAULTED_FUNCTION DiscreteDomain(DiscreteDomain const &x)=default
KOKKOS_DEFAULTED_FUNCTION DiscreteDomain(DiscreteDomain &&x)=default
KOKKOS_FUNCTION constexpr DiscreteDomain remove_last(discrete_vector_type n) const
KOKKOS_FUNCTION bool contains(DElems const &... delems) const noexcept
KOKKOS_FUNCTION constexpr DiscreteDomain take_last(discrete_vector_type n) const
KOKKOS_FUNCTION constexpr DiscreteDomain(DDoms const &... domains)
Construct a DiscreteDomain by copies and merge of domains.
KOKKOS_FUNCTION constexpr decltype(auto) operator[](std::size_t n)
KOKKOS_FUNCTION constexpr DiscreteDomain remove(discrete_vector_type n1, discrete_vector_type n2) const
KOKKOS_FUNCTION constexpr decltype(auto) operator[](std::size_t n) const
KOKKOS_FUNCTION constexpr auto restrict_with(DiscreteDomain< ODDims... > const &odomain) const
static KOKKOS_FUNCTION constexpr std::size_t rank()
KOKKOS_FUNCTION constexpr bool empty() const noexcept
KOKKOS_FUNCTION constexpr std::size_t size() const
friend class DiscreteDomain
KOKKOS_FUNCTION constexpr discrete_vector_type extents() const noexcept
KOKKOS_FUNCTION constexpr DiscreteVector< QueryDDim > extent() const noexcept
KOKKOS_FUNCTION constexpr discrete_element_type front() const noexcept
KOKKOS_DEFAULTED_FUNCTION DiscreteDomain & operator=(DiscreteDomain &&x)=default
KOKKOS_FUNCTION constexpr DiscreteDomain remove_first(discrete_vector_type n) const
KOKKOS_FUNCTION constexpr DiscreteDomain take_first(discrete_vector_type n) const
KOKKOS_DEFAULTED_FUNCTION ~DiscreteDomain()=default
KOKKOS_FUNCTION DiscreteVector< DDims... > distance_from_front(DElems const &... delems) const noexcept
KOKKOS_FUNCTION constexpr discrete_element_type back() const noexcept
KOKKOS_DEFAULTED_FUNCTION DiscreteDomain & operator=(DiscreteDomain const &x)=default
KOKKOS_FUNCTION constexpr DiscreteElement< DDims... > operator()(DiscreteVector< DDims... > const &dvect) const noexcept
KOKKOS_FUNCTION constexpr bool operator==(DiscreteDomain< ODDims... > const &other) const
KOKKOS_DEFAULTED_FUNCTION DiscreteDomain()=default
KOKKOS_FUNCTION constexpr operator bool()
KOKKOS_FUNCTION constexpr DiscreteDomain(discrete_element_type const &element_begin, discrete_vector_type const &size)
Construct a DiscreteDomain starting from element_begin with size points.
KOKKOS_FUNCTION constexpr DiscreteElement & operator+=(DiscreteVector< OTags... > const &rhs)
KOKKOS_FUNCTION constexpr value_type const & uid() const noexcept
KOKKOS_FUNCTION constexpr value_type & uid() noexcept
KOKKOS_DEFAULTED_FUNCTION ~DiscreteElement()=default
KOKKOS_FUNCTION constexpr DiscreteElement(DElems const &... delems) noexcept
KOKKOS_FUNCTION constexpr DiscreteElement & operator+=(IntegralType const &rhs)
KOKKOS_DEFAULTED_FUNCTION constexpr DiscreteElement(DiscreteElement const &)=default
KOKKOS_FUNCTION constexpr DiscreteElement operator--(int)
KOKKOS_FUNCTION constexpr DiscreteElement & operator-=(IntegralType const &rhs)
KOKKOS_FUNCTION constexpr DiscreteElement & operator-=(DiscreteVector< OTags... > const &rhs)
KOKKOS_DEFAULTED_FUNCTION constexpr DiscreteElement()=default
KOKKOS_FUNCTION constexpr DiscreteElement operator++(int)
KOKKOS_DEFAULTED_FUNCTION DiscreteElement & operator=(DiscreteElement const &other)=default
static KOKKOS_FUNCTION constexpr std::size_t size() noexcept
KOKKOS_FUNCTION constexpr DiscreteElement(std::array< IntegerType, sizeof...(Tags)> const &values) noexcept
KOKKOS_DEFAULTED_FUNCTION DiscreteElement & operator=(DiscreteElement &&other)=default
KOKKOS_DEFAULTED_FUNCTION constexpr DiscreteElement(DiscreteElement &&)=default
KOKKOS_FUNCTION constexpr DiscreteVectorElement const & get_or(DiscreteVectorElement const &default_value) const &
KOKKOS_FUNCTION constexpr DiscreteVector operator--(int)
KOKKOS_DEFAULTED_FUNCTION ~DiscreteVector()=default
KOKKOS_FUNCTION constexpr DiscreteVectorElement const & get() const noexcept
KOKKOS_FUNCTION constexpr DiscreteVector & operator+=(IntegralType const &rhs)
KOKKOS_FUNCTION constexpr DiscreteVector & operator-=(DiscreteVector< OTags... > const &rhs)
KOKKOS_FUNCTION constexpr DiscreteVector & operator-=(IntegralType const &rhs)
KOKKOS_FUNCTION constexpr DiscreteVector(DVects const &... delems) noexcept
KOKKOS_FUNCTION constexpr bool operator!=(DiscreteVector< OTags... > const &rhs) const noexcept
KOKKOS_DEFAULTED_FUNCTION constexpr DiscreteVector & operator=(DiscreteVector &&other)=default
static KOKKOS_FUNCTION constexpr std::size_t size() noexcept
KOKKOS_DEFAULTED_FUNCTION constexpr DiscreteVector()=default
KOKKOS_DEFAULTED_FUNCTION constexpr DiscreteVector(DiscreteVector const &)=default
KOKKOS_FUNCTION constexpr DiscreteVectorElement & get() noexcept
KOKKOS_FUNCTION constexpr bool operator==(DiscreteVector< OTags... > const &rhs) const noexcept
KOKKOS_FUNCTION constexpr DiscreteVector(std::array< IntegerType, sizeof...(Tags)> const &values) noexcept
KOKKOS_FUNCTION constexpr DiscreteVector & operator*=(DiscreteVector< OTags... > const &rhs)
KOKKOS_DEFAULTED_FUNCTION constexpr DiscreteVector(DiscreteVector &&)=default
KOKKOS_DEFAULTED_FUNCTION constexpr DiscreteVector & operator=(DiscreteVector const &other)=default
KOKKOS_FUNCTION constexpr DiscreteVector operator++(int)
KOKKOS_FUNCTION constexpr DiscreteVector & operator+=(DiscreteVector< OTags... > const &rhs)
#define DDC_BUILD_DEPRECATED_CODE
#define DDC_BUILD_DOUBLE_PRECISION
The top-level namespace of DDC.
constexpr bool is_borrowed_chunk_v
constexpr bool type_seq_contains_v
KOKKOS_FUNCTION constexpr bool operator<(DiscreteElement< Tag > const &lhs, DiscreteElement< Tag > const &rhs)
KOKKOS_FUNCTION auto get_domain(ChunkType const &chunk) noexcept
Access the domain (or subdomain) of a view.
constexpr bool enable_chunk< Chunk< ElementType, SupportType, Allocator > >
constexpr bool type_seq_contains_v< TypeSeq< Tags... >, OTypeSeq >
KOKKOS_FUNCTION constexpr DiscreteElement< Tag > operator+(DiscreteElement< Tag > const &lhs, IntegralType const &rhs)
constexpr bool type_seq_is_unique_v
constexpr std::size_t type_seq_size_v
KOKKOS_FUNCTION constexpr DiscreteElement< QueryDDims... > back(DiscreteDomain< DDims... > const &domain) noexcept
constexpr bool enable_borrowed_chunk
constexpr bool enable_chunk
KOKKOS_FUNCTION constexpr bool operator==(DiscreteElement< Tags... > const &lhs, DiscreteElement< OTags... > const &rhs) noexcept
constexpr bool enable_borrowed_chunk< ChunkSpan< ElementType, SupportType, LayoutStridedPolicy, MemorySpace > >
KOKKOS_FUNCTION constexpr DiscreteVector< Tags... > operator+(DiscreteVector< Tags... > const &x)
Unary operators: +, -.
KOKKOS_FUNCTION constexpr DiscreteElement< QueryTags... > select(DiscreteElement< Tags... > &&arr) noexcept
constexpr DiscreteElement< DDim > create_reference_discrete_element() noexcept
constexpr bool is_chunk_v
KOKKOS_FUNCTION constexpr DiscreteElement< QueryTags... > select(DiscreteElement< Tags... > const &arr) noexcept
KOKKOS_FUNCTION constexpr auto const & take(HeadDElem const &head, TailDElems const &... tail)
Returns a reference towards the DiscreteElement that contains the QueryTag.
constexpr bool in_tags_v< QueryTag, TypeSeq< Tags... > >
KOKKOS_FUNCTION constexpr DiscreteVector< Tag > operator-(IntegralType const &lhs, DiscreteVector< Tag > const &rhs)
KOKKOS_FUNCTION constexpr auto remove_dims_of(DiscreteDomain< DDimsA... > const &DDom_a, DiscreteDomain< DDimsB... > const &) noexcept
KOKKOS_FUNCTION constexpr bool operator<(DiscreteVector< Tag > const &lhs, IntegralType const &rhs)
KOKKOS_FUNCTION constexpr DiscreteVectorElement const & get_or(DiscreteVector< Tags... > const &tuple, DiscreteVectorElement const &default_value) noexcept
KOKKOS_FUNCTION constexpr auto operator-(DiscreteVector< Tags... > const &lhs, DiscreteVector< OTags... > const &rhs)
KOKKOS_FUNCTION constexpr auto remove_dims_of(DiscreteDomain< DDimsA... > const &DDom_a) noexcept
Remove the dimensions DDimsB from DDom_a.
constexpr bool type_seq_is_unique_v< TypeSeq< Tags... > >
KOKKOS_FUNCTION constexpr DiscreteVector< Tags... > operator-(DiscreteElement< Tags... > const &lhs, DiscreteElement< OTags... > const &rhs)
binary operator: -
KOKKOS_FUNCTION constexpr DiscreteElement< QueryDDims... > front(DiscreteDomain< DDims... > const &domain) noexcept
KOKKOS_FUNCTION constexpr DiscreteVectorElement & get(DiscreteVector< Tags... > &tuple) noexcept
KOKKOS_FUNCTION constexpr DiscreteElement< QueryTag > select_or(DiscreteElement< Tags... > const &arr, DiscreteElement< QueryTag > const &default_value) noexcept
constexpr bool is_writable_chunk_v
KOKKOS_FUNCTION constexpr DiscreteVector< Tag > operator+(IntegralType const &lhs, DiscreteVector< Tag > const &rhs)
constexpr bool is_discrete_vector_v
KOKKOS_FUNCTION constexpr DiscreteElementType const & uid(DiscreteElement< Tag > const &tuple) noexcept
KOKKOS_FUNCTION constexpr DiscreteElement< Tags... > operator+(DiscreteElement< Tags... > const &lhs, DiscreteVector< OTags... > const &rhs)
right external binary operators: +, -
ChunkSpan(Chunk< ElementType, SupportType, Allocator > const &other) -> ChunkSpan< ElementType const, SupportType, Kokkos::layout_right, typename Allocator::memory_space >
KOKKOS_FUNCTION constexpr DiscreteVectorElement const & get(DiscreteVector< Tags... > const &tuple) noexcept
KOKKOS_FUNCTION constexpr DiscreteVector< Tags... > operator-(DiscreteVector< Tags... > const &x)
constexpr bool is_discrete_element_v
KOKKOS_FUNCTION constexpr DiscreteVector< QueryTags... > select(DiscreteVector< Tags... > const &arr) noexcept
KOKKOS_FUNCTION constexpr DiscreteVector< QueryDDims... > extents(DiscreteDomain< DDims... > const &domain) noexcept
Chunk(SupportType const &, Allocator) -> Chunk< typename Allocator::value_type, SupportType, Allocator >
KOKKOS_FUNCTION constexpr bool operator>=(DiscreteElement< Tag > const &lhs, DiscreteElement< Tag > const &rhs)
KOKKOS_FUNCTION constexpr auto operator+(DiscreteVector< Tags... > const &lhs, DiscreteVector< OTags... > const &rhs)
Internal binary operators: +, -.
KOKKOS_FUNCTION constexpr auto replace_dim_of(DiscreteDomain< DDimsA... > const &DDom_a, DiscreteDomain< DDimsB... > const &DDom_b) noexcept
ChunkSpan(Chunk< ElementType, SupportType, Allocator > &other) -> ChunkSpan< ElementType, SupportType, Kokkos::layout_right, typename Allocator::memory_space >
constexpr bool enable_chunk< ChunkSpan< ElementType, SupportType, LayoutStridedPolicy, MemorySpace > >
KOKKOS_FUNCTION constexpr bool operator<=(DiscreteElement< Tag > const &lhs, DiscreteElement< Tag > const &rhs)
KOKKOS_FUNCTION constexpr bool operator<(DiscreteVector< Tag > const &lhs, DiscreteVector< Tag > const &rhs)
KOKKOS_FUNCTION constexpr DiscreteElementType & uid(DiscreteElement< Tags... > &tuple) noexcept
Chunk(std::string const &, SupportType const &, Allocator) -> Chunk< typename Allocator::value_type, SupportType, Allocator >
KOKKOS_FUNCTION constexpr DiscreteVector< QueryTag > select_or(DiscreteVector< Tags... > const &arr, DiscreteVector< QueryTag > const &default_value) noexcept
KOKKOS_FUNCTION constexpr bool operator>(DiscreteElement< Tag > const &lhs, DiscreteElement< Tag > const &rhs)
KOKKOS_FUNCTION constexpr DiscreteElementType & uid(DiscreteElement< Tag > &tuple) noexcept
constexpr bool is_discrete_domain_v
KOKKOS_FUNCTION constexpr DiscreteVector< QueryTags... > select(DiscreteVector< Tags... > &&arr) noexcept
KOKKOS_FUNCTION constexpr DiscreteElement< Tag > operator-(DiscreteElement< Tag > const &lhs, IntegralType const &rhs)
KOKKOS_FUNCTION constexpr DiscreteElement< Tags... > operator-(DiscreteElement< Tags... > const &lhs, DiscreteVector< OTags... > const &rhs)
KOKKOS_FUNCTION constexpr DiscreteElementType const & uid(DiscreteElement< Tags... > const &tuple) noexcept
KOKKOS_FUNCTION constexpr auto operator*(IntegralType const &lhs, DiscreteVector< Tags... > const &rhs)
external left binary operator: *
KOKKOS_FUNCTION constexpr DiscreteDomain< QueryDDims... > select(DiscreteDomain< DDims... > const &domain)
KOKKOS_FUNCTION constexpr DiscreteVector< Tag > operator-(DiscreteVector< Tag > const &lhs, IntegralType const &rhs)
constexpr bool type_seq_same_v
constexpr std::size_t type_seq_rank_v
KOKKOS_DEDUCTION_GUIDE ChunkSpan(Kokkos::View< DataType, Properties... > const &view, SupportType domain) -> ChunkSpan< detail::kokkos_to_mdspan_element_t< typename Kokkos::View< DataType, Properties... >::data_type >, SupportType, detail::kokkos_to_mdspan_layout_t< typename Kokkos::View< DataType, Properties... >::array_layout >, typename Kokkos::View< DataType, Properties... >::memory_space >
KOKKOS_FUNCTION constexpr DiscreteVector< Tag > operator+(DiscreteVector< Tag > const &lhs, IntegralType const &rhs)
A compile-time sequence of types.
KOKKOS_FUNCTION constexpr auto operator()(allocation_mdspan_type const &span, DiscreteVector< ODDims... > const &c) const
KOKKOS_FUNCTION constexpr auto operator()(allocation_mdspan_type const &span, DiscreteDomain< ODDims... > const &c, DiscreteDomain< OODDims... > const &origin) const
KOKKOS_FUNCTION constexpr DiscreteDomainIterator operator--(int)
friend KOKKOS_FUNCTION constexpr bool operator<=(DiscreteDomainIterator const &xx, DiscreteDomainIterator const &yy)
KOKKOS_FUNCTION constexpr DiscreteElement< DDim > operator*() const noexcept
friend KOKKOS_FUNCTION constexpr bool operator>=(DiscreteDomainIterator const &xx, DiscreteDomainIterator const &yy)
KOKKOS_DEFAULTED_FUNCTION DiscreteDomainIterator()=default
KOKKOS_FUNCTION constexpr DiscreteElement< DDim > operator[](difference_type n) const
KOKKOS_FUNCTION constexpr DiscreteDomainIterator & operator--()
KOKKOS_FUNCTION constexpr DiscreteDomainIterator operator++(int)
friend KOKKOS_FUNCTION constexpr DiscreteDomainIterator operator-(DiscreteDomainIterator i, difference_type n)
friend KOKKOS_FUNCTION constexpr DiscreteDomainIterator operator+(DiscreteDomainIterator i, difference_type n)
friend KOKKOS_FUNCTION constexpr bool operator>(DiscreteDomainIterator const &xx, DiscreteDomainIterator const &yy)
friend KOKKOS_FUNCTION constexpr bool operator!=(DiscreteDomainIterator const &xx, DiscreteDomainIterator const &yy)
friend KOKKOS_FUNCTION constexpr bool operator<(DiscreteDomainIterator const &xx, DiscreteDomainIterator const &yy)
KOKKOS_FUNCTION constexpr DiscreteDomainIterator & operator+=(difference_type n)
KOKKOS_FUNCTION constexpr DiscreteDomainIterator & operator++()
friend KOKKOS_FUNCTION constexpr DiscreteDomainIterator operator+(difference_type n, DiscreteDomainIterator i)
friend KOKKOS_FUNCTION constexpr bool operator==(DiscreteDomainIterator const &xx, DiscreteDomainIterator const &yy)
KOKKOS_FUNCTION constexpr DiscreteDomainIterator(DiscreteElement< DDim > value)
KOKKOS_FUNCTION constexpr DiscreteDomainIterator & operator-=(difference_type n)
friend KOKKOS_FUNCTION constexpr difference_type operator-(DiscreteDomainIterator const &xx, DiscreteDomainIterator const &yy)