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