DDC 0.16.0
Loading...
Searching...
No Matches
discrete_element.hpp
1// Copyright (C) The DDC development team, see COPYRIGHT.md file
2//
3// SPDX-License-Identifier: MIT
4
5#pragma once
6
7#include <array>
8#include <concepts>
9#include <cstddef>
10#include <iosfwd>
11#include <span>
12#include <type_traits>
13#include <utility>
14
15#include <Kokkos_Macros.hpp>
16
17#include "detail/macros.hpp"
18#include "detail/utils.hpp"
19
22#include "type_seq.hpp"
23
24namespace ddc {
25
26template <concepts::discrete_dimension...>
27class DiscreteElement;
28
29template <class T>
30struct is_discrete_element : std::false_type
31{
32};
33
34template <concepts::discrete_dimension... Tags>
35struct is_discrete_element<DiscreteElement<Tags...>> : std::true_type
36{
37};
38
39template <class T>
40inline constexpr bool is_discrete_element_v = is_discrete_element<T>::value;
41
42namespace concepts {
43
44template <class T>
45concept discrete_element = is_discrete_element_v<T>;
46
47}
48
49namespace detail {
50
51template <ddc::concepts::discrete_dimension... Tags>
52struct ToTypeSeq<DiscreteElement<Tags...>>
53{
54 using type = ddc::TypeSeq<Tags...>;
55};
56
57} // namespace detail
58
59/** A DiscreteCoordElement is a scalar that identifies an element of the discrete dimension
60 */
61using DiscreteElementType = std::size_t;
62
63template <concepts::discrete_dimension Tag>
64KOKKOS_FUNCTION constexpr DiscreteElementType const& uid(DiscreteElement<Tag> const& tuple) noexcept
65{
66 return tuple.uid();
67}
68
69template <concepts::discrete_dimension Tag>
70KOKKOS_FUNCTION constexpr DiscreteElementType& uid(DiscreteElement<Tag>& tuple) noexcept
71{
72 return tuple.uid();
73}
74
75template <concepts::discrete_dimension QueryTag, concepts::discrete_dimension... Tags>
76KOKKOS_FUNCTION constexpr DiscreteElementType const& uid(
77 DiscreteElement<Tags...> const& tuple) noexcept
78{
79 return tuple.template uid<QueryTag>();
80}
81
82template <concepts::discrete_dimension QueryTag, concepts::discrete_dimension... Tags>
83KOKKOS_FUNCTION constexpr DiscreteElementType& uid(DiscreteElement<Tags...>& tuple) noexcept
84{
85 return tuple.template uid<QueryTag>();
86}
87
88template <concepts::discrete_dimension QueryTag, concepts::discrete_dimension... Tags>
89KOKKOS_FUNCTION constexpr DiscreteElement<QueryTag> select_or(
90 DiscreteElement<Tags...> const& arr,
91 DiscreteElement<QueryTag> const& default_value) noexcept
92{
93 if constexpr (in_tags_v<QueryTag, TypeSeq<Tags...>>) {
94 return DiscreteElement<QueryTag>(arr);
95 } else {
96 return default_value;
97 }
98}
99
100template <concepts::discrete_dimension... QueryTags, concepts::discrete_dimension... Tags>
101KOKKOS_FUNCTION constexpr DiscreteElement<QueryTags...> select(
102 DiscreteElement<Tags...> const& arr) noexcept
103{
104 return DiscreteElement<QueryTags...>(arr);
105}
106
107template <concepts::discrete_dimension... QueryTags, concepts::discrete_dimension... Tags>
108KOKKOS_FUNCTION constexpr DiscreteElement<QueryTags...> select(
109 DiscreteElement<Tags...>&& arr) noexcept
110{
111 return DiscreteElement<QueryTags...>(std::move(arr));
112}
113
114/// Returns a reference towards the DiscreteElement that contains the QueryTag
115template <
116 concepts::discrete_dimension QueryTag,
117 concepts::discrete_element HeadDElem,
118 concepts::discrete_element... TailDElems>
119KOKKOS_FUNCTION constexpr auto const& take(HeadDElem const& head, TailDElems const&... tail)
120{
121 DDC_IF_NVCC_THEN_PUSH_AND_SUPPRESS(implicit_return_from_non_void_function)
122 if constexpr (type_seq_contains_v<TypeSeq<QueryTag>, to_type_seq_t<HeadDElem>>) {
123 static_assert(
124 (!type_seq_contains_v<TypeSeq<QueryTag>, to_type_seq_t<TailDElems>> && ...),
125 "ERROR: tag redundant");
126 return head;
127 } else {
128 static_assert(sizeof...(TailDElems) > 0, "ERROR: tag not found");
129 return take<QueryTag>(tail...);
130 }
131 DDC_IF_NVCC_THEN_POP
132}
133
134namespace detail {
135
136/// Returns a reference to the underlying `std::array`
137template <ddc::concepts::discrete_dimension... Tags>
138KOKKOS_FUNCTION constexpr std::array<DiscreteElementType, sizeof...(Tags)>& array(
139 DiscreteElement<Tags...>& v) noexcept
140{
141 return v.m_values;
142}
143
144/// Returns a reference to the underlying `std::array`
145template <ddc::concepts::discrete_dimension... Tags>
146KOKKOS_FUNCTION constexpr std::array<DiscreteElementType, sizeof...(Tags)> const& array(
147 DiscreteElement<Tags...> const& v) noexcept
148{
149 return v.m_values;
150}
151
152} // namespace detail
153
154template <concepts::discrete_dimension DDim>
155constexpr DiscreteElement<DDim> create_reference_discrete_element() noexcept
156{
157 return DiscreteElement<DDim>(0);
158}
159
160/** A DiscreteElement identifies an element of the discrete dimension
161 *
162 * Each one is tagged by its associated dimensions.
163 */
164template <concepts::discrete_dimension... Tags>
165class DiscreteElement
166{
167 using tags_seq = TypeSeq<Tags...>;
168
169 static_assert(
170 type_seq_is_unique_v<tags_seq>,
171 "The dimensions of a DiscreteElement must be unique");
172
173 friend KOKKOS_FUNCTION constexpr std::array<DiscreteElementType, sizeof...(Tags)>& detail::
174 array<Tags...>(DiscreteElement<Tags...>& v) noexcept;
175
176 friend KOKKOS_FUNCTION constexpr std::array<DiscreteElementType, sizeof...(Tags)> const&
177 detail::array<Tags...>(DiscreteElement<Tags...> const& v) noexcept;
178
179private:
180 std::array<DiscreteElementType, sizeof...(Tags)> m_values;
181
182public:
183 using value_type = DiscreteElementType;
184
185 static KOKKOS_FUNCTION constexpr std::size_t size() noexcept
186 {
187 return sizeof...(Tags);
188 }
189
190public:
191 KOKKOS_DEFAULTED_FUNCTION constexpr DiscreteElement() = default;
192
193 KOKKOS_DEFAULTED_FUNCTION constexpr DiscreteElement(DiscreteElement const&) = default;
194
195 KOKKOS_DEFAULTED_FUNCTION constexpr DiscreteElement(DiscreteElement&&) = default;
196
197 template <concepts::discrete_element... DElems>
198 KOKKOS_FUNCTION constexpr explicit DiscreteElement(DElems const&... delems) noexcept
199 : m_values {take<Tags>(delems...).template uid<Tags>()...}
200 {
201 }
202
203 template <std::convertible_to<DiscreteElementType> IntegerType>
204 KOKKOS_FUNCTION constexpr explicit DiscreteElement(
205 std::array<IntegerType, sizeof...(Tags)> const& values) noexcept
206 : m_values(
207 detail::convert_array_to<
208 DiscreteElementType>(values, std::make_index_sequence<sizeof...(Tags)>()))
209 {
210 }
211
212 template <std::convertible_to<DiscreteElementType>... Params>
213 KOKKOS_FUNCTION constexpr explicit DiscreteElement(Params const&... params) noexcept
214 requires((!is_discrete_element_v<Params> && ...) && sizeof...(Params) == sizeof...(Tags))
215 : m_values {static_cast<DiscreteElementType>(params)...}
216 {
217 }
218
219 KOKKOS_DEFAULTED_FUNCTION ~DiscreteElement() = default;
220
221 KOKKOS_DEFAULTED_FUNCTION DiscreteElement& operator=(DiscreteElement const& other) = default;
222
223 KOKKOS_DEFAULTED_FUNCTION DiscreteElement& operator=(DiscreteElement&& other) = default;
224
225 template <concepts::discrete_dimension QueryTag>
226 KOKKOS_FUNCTION constexpr value_type& uid() noexcept
227 {
228 static_assert(in_tags_v<QueryTag, tags_seq>, "requested Tag absent from DiscreteElement");
229 return m_values[type_seq_rank_v<QueryTag, tags_seq>];
230 }
231
232 template <concepts::discrete_dimension QueryTag>
233 KOKKOS_FUNCTION constexpr value_type const& uid() const noexcept
234 {
235 static_assert(in_tags_v<QueryTag, tags_seq>, "requested Tag absent from DiscreteElement");
236 return m_values[type_seq_rank_v<QueryTag, tags_seq>];
237 }
238
239 KOKKOS_FUNCTION constexpr value_type& uid() noexcept
240 requires(sizeof...(Tags) == 1)
241 {
242 return m_values[0];
243 }
244
245 KOKKOS_FUNCTION constexpr value_type const& uid() const noexcept
246 requires(sizeof...(Tags) == 1)
247 {
248 return m_values[0];
249 }
250
251 KOKKOS_FUNCTION constexpr DiscreteElement& operator++()
252 requires(sizeof...(Tags) == 1)
253 {
254 ++m_values[0];
255 return *this;
256 }
257
258 KOKKOS_FUNCTION constexpr DiscreteElement operator++(int)
259 requires(sizeof...(Tags) == 1)
260 {
261 DiscreteElement const tmp = *this;
262 ++m_values[0];
263 return tmp;
264 }
265
266 KOKKOS_FUNCTION constexpr DiscreteElement& operator--()
267 requires(sizeof...(Tags) == 1)
268 {
269 --m_values[0];
270 return *this;
271 }
272
273 KOKKOS_FUNCTION constexpr DiscreteElement operator--(int)
274 requires(sizeof...(Tags) == 1)
275 {
276 DiscreteElement const tmp = *this;
277 --m_values[0];
278 return tmp;
279 }
280
281 template <concepts::discrete_dimension... OTags>
282 KOKKOS_FUNCTION constexpr DiscreteElement& operator+=(DiscreteVector<OTags...> const& rhs)
283 {
284 static_assert((type_seq_contains_v<TypeSeq<OTags>, tags_seq> && ...));
285 ((m_values[type_seq_rank_v<OTags, tags_seq>] += rhs.template get<OTags>()), ...);
286 return *this;
287 }
288
289 template <std::integral IntegralType>
290 KOKKOS_FUNCTION constexpr DiscreteElement& operator+=(IntegralType const& rhs)
291 requires(sizeof...(Tags) == 1)
292 {
293 m_values[0] += rhs;
294 return *this;
295 }
296
297 template <concepts::discrete_dimension... OTags>
298 KOKKOS_FUNCTION constexpr DiscreteElement& operator-=(DiscreteVector<OTags...> const& rhs)
299 {
300 static_assert((type_seq_contains_v<TypeSeq<OTags>, tags_seq> && ...));
301 ((m_values[type_seq_rank_v<OTags, tags_seq>] -= rhs.template get<OTags>()), ...);
302 return *this;
303 }
304
305 template <std::integral IntegralType>
306 KOKKOS_FUNCTION constexpr DiscreteElement& operator-=(IntegralType const& rhs)
307 requires(sizeof...(Tags) == 1)
308 {
309 m_values[0] -= rhs;
310 return *this;
311 }
312};
313
314namespace detail {
315
316void print_discrete_element(std::ostream& os, std::span<DiscreteElementType const> view);
317
318} // namespace detail
319
320template <concepts::discrete_dimension... Tags>
321std::ostream& operator<<(std::ostream& os, DiscreteElement<Tags...> const& arr)
322{
323 detail::print_discrete_element(os, detail::array(arr));
324 return os;
325}
326
327
328template <concepts::discrete_dimension... Tags, concepts::discrete_dimension... OTags>
329KOKKOS_FUNCTION constexpr bool operator==(
330 DiscreteElement<Tags...> const& lhs,
331 DiscreteElement<OTags...> const& rhs) noexcept
332{
333 return ((lhs.template uid<Tags>() == rhs.template uid<Tags>()) && ...);
334}
335
336#if !defined(__cpp_impl_three_way_comparison) || __cpp_impl_three_way_comparison < 201902L
337// In C++20, `a!=b` shall be automatically translated by the compiler to `!(a==b)`
339KOKKOS_FUNCTION constexpr bool operator!=(
340 DiscreteElement<Tags...> const& lhs,
341 DiscreteElement<OTags...> const& rhs) noexcept
342{
343 return !(lhs == rhs);
344}
345#endif
346
347template <concepts::discrete_dimension Tag>
348KOKKOS_FUNCTION constexpr bool operator<(
349 DiscreteElement<Tag> const& lhs,
350 DiscreteElement<Tag> const& rhs)
351{
352 return lhs.uid() < rhs.uid();
353}
354
355template <concepts::discrete_dimension Tag>
356KOKKOS_FUNCTION constexpr bool operator<=(
357 DiscreteElement<Tag> const& lhs,
358 DiscreteElement<Tag> const& rhs)
359{
360 return lhs.uid() <= rhs.uid();
361}
362
363template <concepts::discrete_dimension Tag>
364KOKKOS_FUNCTION constexpr bool operator>(
365 DiscreteElement<Tag> const& lhs,
366 DiscreteElement<Tag> const& rhs)
367{
368 return lhs.uid() > rhs.uid();
369}
370
371template <concepts::discrete_dimension Tag>
372KOKKOS_FUNCTION constexpr bool operator>=(
373 DiscreteElement<Tag> const& lhs,
374 DiscreteElement<Tag> const& rhs)
375{
376 return lhs.uid() >= rhs.uid();
377}
378
379/// right external binary operators: +, -
380
381template <concepts::discrete_dimension... Tags, concepts::discrete_dimension... OTags>
382KOKKOS_FUNCTION constexpr DiscreteElement<Tags...> operator+(
383 DiscreteElement<Tags...> const& lhs,
384 DiscreteVector<OTags...> const& rhs)
385{
386 static_assert((type_seq_contains_v<TypeSeq<OTags>, TypeSeq<Tags...>> && ...));
387 DiscreteElement<Tags...> result(lhs);
388 result += rhs;
389 return result;
390}
391
392template <concepts::discrete_dimension Tag, std::integral IntegralType>
393KOKKOS_FUNCTION constexpr DiscreteElement<Tag> operator+(
394 DiscreteElement<Tag> const& lhs,
395 IntegralType const& rhs)
396 requires(!is_discrete_vector_v<IntegralType>)
397{
398 DiscreteElement<Tag> result(lhs);
399 result += rhs;
400 return result;
401}
402
403template <concepts::discrete_dimension... Tags, concepts::discrete_dimension... OTags>
404KOKKOS_FUNCTION constexpr DiscreteElement<Tags...> operator-(
405 DiscreteElement<Tags...> const& lhs,
406 DiscreteVector<OTags...> const& rhs)
407{
408 static_assert((type_seq_contains_v<TypeSeq<OTags>, TypeSeq<Tags...>> && ...));
409 DiscreteElement<Tags...> result(lhs);
410 result -= rhs;
411 return result;
412}
413
414template <concepts::discrete_dimension Tag, std::integral IntegralType>
415KOKKOS_FUNCTION constexpr DiscreteElement<Tag> operator-(
416 DiscreteElement<Tag> const& lhs,
417 IntegralType const& rhs)
418 requires(!is_discrete_vector_v<IntegralType>)
419{
420 DiscreteElement<Tag> result(lhs);
421 result -= rhs;
422 return result;
423}
424
425/// binary operator: -
426
427template <concepts::discrete_dimension... Tags, concepts::discrete_dimension... OTags>
428KOKKOS_FUNCTION constexpr DiscreteVector<Tags...> operator-(
429 DiscreteElement<Tags...> const& lhs,
430 DiscreteElement<OTags...> const& rhs)
431{
432 static_assert(type_seq_same_v<TypeSeq<Tags...>, TypeSeq<OTags...>>);
433 return DiscreteVector<Tags...>((uid<Tags>(lhs) - uid<Tags>(rhs))...);
434}
435
436} // namespace ddc
friend class ChunkSpan
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
auto operator[](DiscreteElement< QueryDDims... > const &slice_spec) const
Slice out some dimensions.
Definition chunk.hpp:170
auto operator[](DiscreteVector< QueryDDims... > const &slice_spec) const
Slice out some dimensions.
Definition chunk.hpp:156
char const * label() const
Returns the label of the Chunk.
Definition chunk.hpp:265
const_allocation_mdspan_type allocation_mdspan() const
Provide a mdspan on the memory allocation.
Definition chunk.hpp:289
ElementType const * data_handle() const
Access to the underlying allocation pointer.
Definition chunk.hpp:273
auto allocation_kokkos_view()
Provide an unmanaged Kokkos::View on the memory allocation.
Definition chunk.hpp:305
auto operator[](DiscreteDomain< QueryDDims... > const &odomain)
Slice out some dimensions.
Definition chunk.hpp:192
auto allocation_kokkos_view() const
Provide an unmanaged Kokkos::View on the memory allocation.
Definition chunk.hpp:321
Chunk(SupportType const &domain, Allocator allocator=Allocator())
Construct a Chunk on a domain with uninitialized values.
Definition chunk.hpp:106
Chunk & operator=(Chunk const &other)=delete
Deleted: use deepcopy instead.
allocation_mdspan_type allocation_mdspan()
Provide a mdspan on the memory allocation.
Definition chunk.hpp:297
ElementType * data_handle()
Access to the underlying allocation pointer.
Definition chunk.hpp:281
view_type span_cview() const
Definition chunk.hpp:334
Chunk(Chunk const &other)=delete
Deleted: use deepcopy instead.
~Chunk() noexcept
Definition chunk.hpp:126
Chunk(std::string const &label, SupportType const &domain, Allocator allocator=Allocator())
Construct a labeled Chunk on a domain with uninitialized values.
Definition chunk.hpp:95
element_type & operator()(DElems const &... delems) noexcept
Element access using a list of DiscreteElement.
Definition chunk.hpp:235
Chunk()=default
Empty Chunk.
Chunk & operator=(Chunk &&other) noexcept
Move-assigns a new value to this field.
Definition chunk.hpp:140
Chunk(Chunk &&other) noexcept
Constructs a new Chunk by move.
Definition chunk.hpp:117
friend class Chunk
Definition chunk.hpp:83
span_type span_view()
Definition chunk.hpp:344
view_type span_view() const
Definition chunk.hpp:339
auto operator[](DiscreteDomain< QueryDDims... > const &odomain) const
Slice out some dimensions.
Definition chunk.hpp:184
element_type const & operator()(DElems const &... delems) const noexcept
Element access using a list of DiscreteElement.
Definition chunk.hpp:203
auto operator[](DiscreteVector< QueryDDims... > const &slice_spec)
Slice out some dimensions.
Definition chunk.hpp:163
auto operator[](DiscreteElement< QueryDDims... > const &slice_spec)
Slice out some dimensions.
Definition chunk.hpp:177
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 bool operator!=(DiscreteVector< OTags... > const &rhs) const noexcept
KOKKOS_DEFAULTED_FUNCTION constexpr DiscreteVector()=default
#define DDC_BUILD_DEPRECATED_CODE
Definition config.hpp:7
#define DDC_BUILD_DOUBLE_PRECISION
Definition config.hpp:15
The top-level namespace of DDC.
constexpr bool is_borrowed_chunk_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 > >
Definition chunk.hpp:30
KOKKOS_FUNCTION constexpr DiscreteElement< Tag > operator+(DiscreteElement< Tag > const &lhs, IntegralType const &rhs)
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
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.
KOKKOS_FUNCTION constexpr auto remove_dims_of(DiscreteDomain< DDimsA... > const &DDom_a, DiscreteDomain< DDimsB... > const &) noexcept
KOKKOS_FUNCTION constexpr auto remove_dims_of(DiscreteDomain< DDimsA... > const &DDom_a) noexcept
Remove the dimensions DDimsB from DDom_a.
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 DiscreteElement< QueryTag > select_or(DiscreteElement< Tags... > const &arr, DiscreteElement< QueryTag > const &default_value) noexcept
constexpr bool is_writable_chunk_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: +, -
constexpr bool is_discrete_element_v
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 replace_dim_of(DiscreteDomain< DDimsA... > const &DDom_a, DiscreteDomain< DDimsB... > const &DDom_b) noexcept
KOKKOS_FUNCTION constexpr bool operator<=(DiscreteElement< Tag > const &lhs, DiscreteElement< 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 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 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 DiscreteDomain< QueryDDims... > select(DiscreteDomain< DDims... > const &domain)
A compile-time sequence of types.
Definition type_seq.hpp:30
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)