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