DDC 0.1.0
Loading...
Searching...
No Matches
discrete_domain.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 <cassert>
8#include <cstddef>
9#include <iterator>
10#include <tuple>
11#include <type_traits>
12
13#include <Kokkos_Macros.hpp>
14
15#include "ddc/detail/type_seq.hpp"
16#include "ddc/discrete_element.hpp"
17#include "ddc/discrete_vector.hpp"
18
19namespace ddc {
20
21template <class DDim>
23
24template <class... DDims>
25class DiscreteDomain;
26
27template <class T>
28struct is_discrete_domain : std::false_type
29{
30};
31
32template <class... Tags>
33struct is_discrete_domain<DiscreteDomain<Tags...>> : std::true_type
34{
35};
36
37template <class T>
38inline constexpr bool is_discrete_domain_v = is_discrete_domain<T>::value;
39
40
41namespace detail {
42
43template <class... Tags>
44struct ToTypeSeq<DiscreteDomain<Tags...>>
45{
46 using type = TypeSeq<Tags...>;
47};
48
49} // namespace detail
50
51template <class... DDims>
53{
54 template <class...>
55 friend class DiscreteDomain;
56
57public:
58 using discrete_element_type = DiscreteElement<DDims...>;
59
60 using mlength_type = DiscreteVector<DDims...>;
61
62private:
63 DiscreteElement<DDims...> m_element_begin;
64
65 DiscreteElement<DDims...> m_element_end;
66
67public:
68 static KOKKOS_FUNCTION constexpr std::size_t rank()
69 {
70 return sizeof...(DDims);
71 }
72
74
75 /// Construct a DiscreteDomain by copies and merge of domains
76 template <class... DDoms, class = std::enable_if_t<(is_discrete_domain_v<DDoms> && ...)>>
77 KOKKOS_FUNCTION constexpr explicit DiscreteDomain(DDoms const&... domains)
78 : m_element_begin(domains.front()...)
79 , m_element_end((domains.front() + domains.extents())...)
80 {
81 }
82
83 /** Construct a DiscreteDomain starting from element_begin with size points.
84 * @param element_begin the lower bound in each direction
85 * @param size the number of points in each direction
86 */
88 discrete_element_type const& element_begin,
89 mlength_type const& size)
90 : m_element_begin(element_begin)
91 , m_element_end(element_begin + size)
92 {
93 }
94
96
98
100
102
104
105 template <class... ODims>
106 KOKKOS_FUNCTION constexpr bool operator==(DiscreteDomain<ODims...> const& other) const
107 {
108 if (empty() && other.empty()) {
109 return true;
110 }
111 return m_element_begin == other.m_element_begin && m_element_end == other.m_element_end;
112 }
113
114#if !defined(__cpp_impl_three_way_comparison) || __cpp_impl_three_way_comparison < 201902L
115 // In C++20, `a!=b` shall be automatically translated by the compiler to `!(a==b)`
116 template <class... ODims>
117 KOKKOS_FUNCTION constexpr bool operator!=(DiscreteDomain<ODims...> const& other) const
118 {
119 return !(*this == other);
120 }
121#endif
122
123 KOKKOS_FUNCTION constexpr std::size_t size() const
124 {
125 return (1UL * ... * (uid<DDims>(m_element_end) - uid<DDims>(m_element_begin)));
126 }
127
128 KOKKOS_FUNCTION constexpr mlength_type extents() const noexcept
129 {
130 return mlength_type((uid<DDims>(m_element_end) - uid<DDims>(m_element_begin))...);
131 }
132
133 template <class QueryDDim>
134 KOKKOS_FUNCTION constexpr DiscreteVector<QueryDDim> extent() const noexcept
135 {
136 return DiscreteVector<QueryDDim>(
137 uid<QueryDDim>(m_element_end) - uid<QueryDDim>(m_element_begin));
138 }
139
140 KOKKOS_FUNCTION constexpr discrete_element_type front() const noexcept
141 {
142 return m_element_begin;
143 }
144
145 KOKKOS_FUNCTION constexpr discrete_element_type back() const noexcept
146 {
147 return discrete_element_type((uid<DDims>(m_element_end) - 1)...);
148 }
149
150 KOKKOS_FUNCTION constexpr DiscreteDomain take_first(mlength_type n) const
151 {
152 return DiscreteDomain(front(), n);
153 }
154
155 KOKKOS_FUNCTION constexpr DiscreteDomain take_last(mlength_type n) const
156 {
157 return DiscreteDomain(front() + (extents() - n), n);
158 }
159
160 KOKKOS_FUNCTION constexpr DiscreteDomain remove_first(mlength_type n) const
161 {
162 return DiscreteDomain(front() + n, extents() - n);
163 }
164
165 KOKKOS_FUNCTION constexpr DiscreteDomain remove_last(mlength_type n) const
166 {
167 return DiscreteDomain(front(), extents() - n);
168 }
169
170 KOKKOS_FUNCTION constexpr DiscreteDomain remove(mlength_type n1, mlength_type n2) const
171 {
172 return DiscreteDomain(front() + n1, extents() - n1 - n2);
173 }
174
175 template <class... ODDims>
176 KOKKOS_FUNCTION constexpr auto restrict(DiscreteDomain<ODDims...> const& odomain) const
177 {
178 assert(((uid<ODDims>(m_element_begin) <= uid<ODDims>(odomain.m_element_begin)) && ...));
179 assert(((uid<ODDims>(m_element_end) >= uid<ODDims>(odomain.m_element_end)) && ...));
180 const DiscreteVector<DDims...> myextents = extents();
181 const DiscreteVector<ODDims...> oextents = odomain.extents();
182 return DiscreteDomain(
183 DiscreteElement<DDims...>(
184 (uid_or<DDims>(odomain.m_element_begin, uid<DDims>(m_element_begin)))...),
185 DiscreteVector<DDims...>((get_or<DDims>(oextents, get<DDims>(myextents)))...));
186 }
187
188 KOKKOS_FUNCTION constexpr bool empty() const noexcept
189 {
190 return size() == 0;
191 }
192
193 KOKKOS_FUNCTION constexpr explicit operator bool()
194 {
195 return !empty();
196 }
197
198 template <
199 std::size_t N = sizeof...(DDims),
200 class DDim0 = std::enable_if_t<N == 1, std::tuple_element_t<0, std::tuple<DDims...>>>>
201 KOKKOS_FUNCTION auto begin() const
202 {
203 return DiscreteDomainIterator<DDim0>(front());
204 }
205
206 template <
207 std::size_t N = sizeof...(DDims),
208 class DDim0 = std::enable_if_t<N == 1, std::tuple_element_t<0, std::tuple<DDims...>>>>
209 KOKKOS_FUNCTION auto end() const
210 {
211 return DiscreteDomainIterator<DDim0>(m_element_end);
212 }
213
214 template <
215 std::size_t N = sizeof...(DDims),
216 class DDim0 = std::enable_if_t<N == 1, std::tuple_element_t<0, std::tuple<DDims...>>>>
217 KOKKOS_FUNCTION auto cbegin() const
218 {
219 return DiscreteDomainIterator<DDim0>(front());
220 }
221
222 template <
223 std::size_t N = sizeof...(DDims),
224 class DDim0 = std::enable_if_t<N == 1, std::tuple_element_t<0, std::tuple<DDims...>>>>
225 KOKKOS_FUNCTION auto cend() const
226 {
227 return DiscreteDomainIterator<DDim0>(m_element_end);
228 }
229
230 template <
231 std::size_t N = sizeof...(DDims),
232 class = std::enable_if_t<N == 1, std::tuple_element_t<0, std::tuple<DDims...>>>>
233 KOKKOS_FUNCTION constexpr decltype(auto) operator[](std::size_t n)
234 {
235 return begin()[n];
236 }
237
238 template <
239 std::size_t N = sizeof...(DDims),
240 class = std::enable_if_t<N == 1, std::tuple_element_t<0, std::tuple<DDims...>>>>
241 KOKKOS_FUNCTION constexpr decltype(auto) operator[](std::size_t n) const
242 {
243 return begin()[n];
244 }
245};
246
247template <>
248class DiscreteDomain<>
249{
250 template <class...>
251 friend class DiscreteDomain;
252
253public:
254 using discrete_element_type = DiscreteElement<>;
255
256 using mlength_type = DiscreteVector<>;
257
258 static KOKKOS_FUNCTION constexpr std::size_t rank()
259 {
260 return 0;
261 }
262
263 KOKKOS_DEFAULTED_FUNCTION constexpr DiscreteDomain() = default;
264
265 // Construct a DiscreteDomain from a reordered copy of `domain`
266 template <class... ODDims>
267 KOKKOS_FUNCTION constexpr explicit DiscreteDomain(
268 [[maybe_unused]] DiscreteDomain<ODDims...> const& domain)
269 {
270 }
271
272 /** Construct a DiscreteDomain starting from element_begin with size points.
273 * @param element_begin the lower bound in each direction
274 * @param size the number of points in each direction
275 */
277 [[maybe_unused]] discrete_element_type const& element_begin,
278 [[maybe_unused]] mlength_type const& size)
279 {
280 }
281
283
285
287
289
291
292 KOKKOS_FUNCTION constexpr bool operator==([[maybe_unused]] DiscreteDomain const& other) const
293 {
294 return true;
295 }
296
297#if !defined(__cpp_impl_three_way_comparison) || __cpp_impl_three_way_comparison < 201902L
298 // In C++20, `a!=b` shall be automatically translated by the compiler to `!(a==b)`
299 KOKKOS_FUNCTION constexpr bool operator!=(DiscreteDomain const& other) const
300 {
301 return !(*this == other);
302 }
303#endif
304
305 static KOKKOS_FUNCTION constexpr std::size_t size()
306 {
307 return 1;
308 }
309
310 static KOKKOS_FUNCTION constexpr mlength_type extents() noexcept
311 {
312 return {};
313 }
314
315 static KOKKOS_FUNCTION constexpr discrete_element_type front() noexcept
316 {
317 return {};
318 }
319
320 static KOKKOS_FUNCTION constexpr discrete_element_type back() noexcept
321 {
322 return {};
323 }
324
325 KOKKOS_FUNCTION constexpr DiscreteDomain take_first([[maybe_unused]] mlength_type n) const
326 {
327 return *this;
328 }
329
330 KOKKOS_FUNCTION constexpr DiscreteDomain take_last([[maybe_unused]] mlength_type n) const
331 {
332 return *this;
333 }
334
335 KOKKOS_FUNCTION constexpr DiscreteDomain remove_first([[maybe_unused]] mlength_type n) const
336 {
337 return *this;
338 }
339
340 KOKKOS_FUNCTION constexpr DiscreteDomain remove_last([[maybe_unused]] mlength_type n) const
341 {
342 return *this;
343 }
344
346 [[maybe_unused]] mlength_type n1,
347 [[maybe_unused]] mlength_type n2) const
348 {
349 return *this;
350 }
351
352 template <class... ODims>
353 KOKKOS_FUNCTION constexpr DiscreteDomain restrict(DiscreteDomain<ODims...> const&) const
354 {
355 return *this;
356 }
357
358 static KOKKOS_FUNCTION constexpr bool empty() noexcept
359 {
360 return false;
361 }
362
363 KOKKOS_FUNCTION constexpr explicit operator bool()
364 {
365 return true;
366 }
367};
368
369template <class... QueryDDims, class... DDims>
370KOKKOS_FUNCTION constexpr DiscreteDomain<QueryDDims...> select(
371 DiscreteDomain<DDims...> const& domain)
372{
373 return DiscreteDomain<QueryDDims...>(
374 select<QueryDDims...>(domain.front()),
375 select<QueryDDims...>(domain.extents()));
376}
377
378namespace detail {
379
380template <class T>
381struct ConvertTypeSeqToDiscreteDomain;
382
383template <class... DDims>
384struct ConvertTypeSeqToDiscreteDomain<detail::TypeSeq<DDims...>>
385{
386 using type = DiscreteDomain<DDims...>;
387};
388
389template <class T>
390using convert_type_seq_to_discrete_domain_t = typename ConvertTypeSeqToDiscreteDomain<T>::type;
391
392} // namespace detail
393
394// Computes the cartesian product of DiscreteDomain types
395// Example usage : "using DDom = cartesian_prod_t<DDom1,DDom2,DDom3>;"
396template <typename... DDom>
397struct cartesian_prod;
398
399template <typename... DDim1, typename... DDim2>
400struct cartesian_prod<ddc::DiscreteDomain<DDim1...>, ddc::DiscreteDomain<DDim2...>>
401{
402 using type = ddc::DiscreteDomain<DDim1..., DDim2...>;
403};
404
405template <typename DDom>
406struct cartesian_prod<DDom>
407{
408 using type = DDom;
409};
410
411template <>
412struct cartesian_prod<>
413{
414 using type = ddc::DiscreteDomain<>;
415};
416
417template <typename DDom1, typename DDom2, typename... Tail>
418struct cartesian_prod<DDom1, DDom2, Tail...>
419{
420 using type =
421 typename cartesian_prod<typename cartesian_prod<DDom1, DDom2>::type, Tail...>::type;
422};
423
424template <typename... DDom>
425using cartesian_prod_t = typename cartesian_prod<DDom...>::type;
426
427// Computes the substraction DDom_a - DDom_b in the sense of linear spaces(retained dimensions are those in DDom_a which are not in DDom_b)
428template <class... DDimsA, class... DDimsB>
429KOKKOS_FUNCTION constexpr auto remove_dims_of(
430 DiscreteDomain<DDimsA...> const& DDom_a,
431 [[maybe_unused]] DiscreteDomain<DDimsB...> const& DDom_b) noexcept
432{
433 using TagSeqA = detail::TypeSeq<DDimsA...>;
434 using TagSeqB = detail::TypeSeq<DDimsB...>;
435
436 using type_seq_r = type_seq_remove_t<TagSeqA, TagSeqB>;
437 return detail::convert_type_seq_to_discrete_domain_t<type_seq_r>(DDom_a);
438}
439
440//! Remove the dimensions DDimsB from DDom_a
441//! @param[in] DDom_a The discrete domain on which to remove dimensions
442//! @return The discrete domain without DDimsB dimensions
443template <class... DDimsB, class DDomA>
444KOKKOS_FUNCTION constexpr auto remove_dims_of(DDomA const& DDom_a) noexcept
445{
446 using TagSeqA = typename detail::ToTypeSeq<DDomA>::type;
447 using TagSeqB = detail::TypeSeq<DDimsB...>;
448
449 using type_seq_r = type_seq_remove_t<TagSeqA, TagSeqB>;
450 return detail::convert_type_seq_to_discrete_domain_t<type_seq_r>(DDom_a);
451}
452
453// Remove dimensions from a domain type
454template <typename DDom, typename... DDims>
455using remove_dims_of_t = decltype(remove_dims_of<DDims...>(std::declval<DDom>()));
456
457namespace detail {
458
459// Checks if dimension of DDom_a is DDim1. If not, returns restriction to DDim2 of DDom_b. May not be usefull in its own, it helps for replace_dim_of
460template <typename DDim1, typename DDim2, typename DDimA, typename... DDimsB>
461KOKKOS_FUNCTION constexpr std::conditional_t<
462 std::is_same_v<DDimA, DDim1>,
463 ddc::DiscreteDomain<DDim2>,
464 ddc::DiscreteDomain<DDimA>>
465replace_dim_of_1d(
466 DiscreteDomain<DDimA> const& DDom_a,
467 [[maybe_unused]] DiscreteDomain<DDimsB...> const& DDom_b) noexcept
468{
469 if constexpr (std::is_same_v<DDimA, DDim1>) {
470 return ddc::select<DDim2>(DDom_b);
471 } else {
472 return DDom_a;
473 }
474}
475
476} // namespace detail
477
478// Replace in DDom_a the dimension Dim1 by the dimension Dim2 of DDom_b
479template <typename DDim1, typename DDim2, typename... DDimsA, typename... DDimsB>
480KOKKOS_FUNCTION constexpr auto replace_dim_of(
481 DiscreteDomain<DDimsA...> const& DDom_a,
482 [[maybe_unused]] DiscreteDomain<DDimsB...> const& DDom_b) noexcept
483{
484 // TODO : static_asserts
485 using TagSeqA = detail::TypeSeq<DDimsA...>;
486 using TagSeqB = detail::TypeSeq<DDim1>;
487 using TagSeqC = detail::TypeSeq<DDim2>;
488
489 using type_seq_r = ddc::type_seq_replace_t<TagSeqA, TagSeqB, TagSeqC>;
490 return ddc::detail::convert_type_seq_to_discrete_domain_t<type_seq_r>(
491 detail::replace_dim_of_1d<
492 DDim1,
493 DDim2,
494 DDimsA,
495 DDimsB...>(ddc::select<DDimsA>(DDom_a), DDom_b)...);
496}
497
498// Replace dimensions from a domain type
499template <typename DDom, typename DDim1, typename DDim2>
500using replace_dim_of_t
501 = decltype(replace_dim_of<
502 DDim1,
503 DDim2>(std::declval<DDom>(), std::declval<DiscreteDomain<DDim2>>()));
504
505
506template <class... QueryDDims, class... DDims>
507KOKKOS_FUNCTION constexpr DiscreteVector<QueryDDims...> extents(
508 DiscreteDomain<DDims...> const& domain) noexcept
509{
510 return DiscreteVector<QueryDDims...>(select<QueryDDims>(domain).size()...);
511}
512
513template <class... QueryDDims, class... DDims>
514KOKKOS_FUNCTION constexpr DiscreteElement<QueryDDims...> front(
515 DiscreteDomain<DDims...> const& domain) noexcept
516{
517 return DiscreteElement<QueryDDims...>(select<QueryDDims>(domain).front()...);
518}
519
520template <class... QueryDDims, class... DDims>
521KOKKOS_FUNCTION constexpr DiscreteElement<QueryDDims...> back(
522 DiscreteDomain<DDims...> const& domain) noexcept
523{
524 return DiscreteElement<QueryDDims...>(select<QueryDDims>(domain).back()...);
525}
526
527template <class DDim>
529{
530private:
531 DiscreteElement<DDim> m_value = DiscreteElement<DDim>();
532
533public:
534 using iterator_category = std::random_access_iterator_tag;
535
536 using value_type = DiscreteElement<DDim>;
537
538 using difference_type = std::ptrdiff_t;
539
541
542 KOKKOS_FUNCTION constexpr explicit DiscreteDomainIterator(DiscreteElement<DDim> value)
543 : m_value(value)
544 {
545 }
546
547 KOKKOS_FUNCTION constexpr DiscreteElement<DDim> operator*() const noexcept
548 {
549 return m_value;
550 }
551
553 {
554 ++m_value.uid();
555 return *this;
556 }
557
559 {
560 auto tmp = *this;
561 ++*this;
562 return tmp;
563 }
564
566 {
567 --m_value.uid();
568 return *this;
569 }
570
572 {
573 auto tmp = *this;
574 --*this;
575 return tmp;
576 }
577
578 KOKKOS_FUNCTION constexpr DiscreteDomainIterator& operator+=(difference_type n)
579 {
580 if (n >= difference_type(0)) {
581 m_value.uid() += static_cast<DiscreteElementType>(n);
582 } else {
583 m_value.uid() -= static_cast<DiscreteElementType>(-n);
584 }
585 return *this;
586 }
587
588 KOKKOS_FUNCTION constexpr DiscreteDomainIterator& operator-=(difference_type n)
589 {
590 if (n >= difference_type(0)) {
591 m_value.uid() -= static_cast<DiscreteElementType>(n);
592 } else {
593 m_value.uid() += static_cast<DiscreteElementType>(-n);
594 }
595 return *this;
596 }
597
598 KOKKOS_FUNCTION constexpr DiscreteElement<DDim> operator[](difference_type n) const
599 {
600 return m_value + n;
601 }
602
603 friend KOKKOS_FUNCTION constexpr bool operator==(
604 DiscreteDomainIterator const& xx,
605 DiscreteDomainIterator const& yy)
606 {
607 return xx.m_value == yy.m_value;
608 }
609
610#if !defined(__cpp_impl_three_way_comparison) || __cpp_impl_three_way_comparison < 201902L
611 // In C++20, `a!=b` shall be automatically translated by the compiler to `!(a==b)`
612 friend KOKKOS_FUNCTION constexpr bool operator!=(
615 {
616 return xx.m_value != yy.m_value;
617 }
618#endif
619
620 friend KOKKOS_FUNCTION constexpr bool operator<(
621 DiscreteDomainIterator const& xx,
622 DiscreteDomainIterator const& yy)
623 {
624 return xx.m_value < yy.m_value;
625 }
626
627 friend KOKKOS_FUNCTION constexpr bool operator>(
628 DiscreteDomainIterator const& xx,
629 DiscreteDomainIterator const& yy)
630 {
631 return yy < xx;
632 }
633
634 friend KOKKOS_FUNCTION constexpr bool operator<=(
635 DiscreteDomainIterator const& xx,
636 DiscreteDomainIterator const& yy)
637 {
638 return !(yy < xx);
639 }
640
641 friend KOKKOS_FUNCTION constexpr bool operator>=(
642 DiscreteDomainIterator const& xx,
643 DiscreteDomainIterator const& yy)
644 {
645 return !(xx < yy);
646 }
647
650 difference_type n)
651 {
652 return i += n;
653 }
654
656 difference_type n,
658 {
659 return i += n;
660 }
661
664 difference_type n)
665 {
666 return i -= n;
667 }
668
669 friend KOKKOS_FUNCTION constexpr difference_type operator-(
670 DiscreteDomainIterator const& xx,
671 DiscreteDomainIterator const& yy)
672 {
673 return (yy.m_value > xx.m_value) ? (-static_cast<difference_type>(yy.m_value - xx.m_value))
674 : (xx.m_value - yy.m_value);
675 }
676};
677
678} // namespace ddc
KOKKOS_DEFAULTED_FUNCTION ~DiscreteDomain()=default
static KOKKOS_FUNCTION constexpr mlength_type extents() noexcept
KOKKOS_FUNCTION constexpr DiscreteDomain take_first(mlength_type n) const
static KOKKOS_FUNCTION constexpr std::size_t rank()
KOKKOS_DEFAULTED_FUNCTION DiscreteDomain(DiscreteDomain const &x)=default
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 constexpr discrete_element_type back() noexcept
KOKKOS_FUNCTION constexpr DiscreteDomain remove_first(mlength_type n) const
KOKKOS_FUNCTION constexpr DiscreteDomain remove_last(mlength_type n) const
static KOKKOS_FUNCTION constexpr discrete_element_type front() noexcept
KOKKOS_DEFAULTED_FUNCTION DiscreteDomain & operator=(DiscreteDomain const &x)=default
KOKKOS_FUNCTION constexpr DiscreteDomain(DiscreteDomain< ODDims... > const &domain)
KOKKOS_FUNCTION constexpr DiscreteDomain restrict(DiscreteDomain< ODims... > const &) const
KOKKOS_FUNCTION constexpr DiscreteDomain remove(mlength_type n1, mlength_type n2) const
KOKKOS_FUNCTION constexpr bool operator==(DiscreteDomain const &other) const
KOKKOS_FUNCTION constexpr DiscreteDomain take_last(mlength_type n) const
KOKKOS_FUNCTION constexpr DiscreteDomain(discrete_element_type const &element_begin, mlength_type const &size)
Construct a DiscreteDomain starting from element_begin with size points.
KOKKOS_DEFAULTED_FUNCTION DiscreteDomain(DiscreteDomain &&x)=default
KOKKOS_DEFAULTED_FUNCTION DiscreteDomain(DiscreteDomain const &x)=default
KOKKOS_DEFAULTED_FUNCTION DiscreteDomain(DiscreteDomain &&x)=default
KOKKOS_FUNCTION constexpr DiscreteDomain take_first(mlength_type n) const
KOKKOS_FUNCTION auto begin() 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 DiscreteDomain remove_last(mlength_type n) const
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_FUNCTION constexpr DiscreteDomain(discrete_element_type const &element_begin, mlength_type const &size)
Construct a DiscreteDomain starting from element_begin with size points.
KOKKOS_DEFAULTED_FUNCTION DiscreteDomain & operator=(DiscreteDomain &&x)=default
KOKKOS_FUNCTION constexpr bool operator==(DiscreteDomain< ODims... > const &other) const
KOKKOS_FUNCTION constexpr DiscreteDomain take_last(mlength_type n) const
KOKKOS_FUNCTION constexpr DiscreteDomain remove_first(mlength_type n) const
KOKKOS_FUNCTION auto cbegin() const
KOKKOS_FUNCTION auto end() const
KOKKOS_DEFAULTED_FUNCTION ~DiscreteDomain()=default
KOKKOS_FUNCTION auto cend() const
KOKKOS_FUNCTION constexpr DiscreteDomain remove(mlength_type n1, mlength_type n2) const
KOKKOS_FUNCTION constexpr auto restrict(DiscreteDomain< ODDims... > const &odomain) const
KOKKOS_FUNCTION constexpr decltype(auto) operator[](std::size_t n) const
KOKKOS_FUNCTION constexpr discrete_element_type back() const noexcept
KOKKOS_DEFAULTED_FUNCTION DiscreteDomain & operator=(DiscreteDomain const &x)=default
KOKKOS_FUNCTION constexpr mlength_type extents() const noexcept
KOKKOS_DEFAULTED_FUNCTION DiscreteDomain()=default
KOKKOS_FUNCTION constexpr operator bool()
KOKKOS_FUNCTION constexpr decltype(auto) operator[](std::size_t n)
KOKKOS_DEFAULTED_FUNCTION constexpr 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.
KOKKOS_FUNCTION constexpr DiscreteElement< QueryDDims... > back(DiscreteDomain< DDims... > const &domain) noexcept
KOKKOS_FUNCTION constexpr DiscreteElement< QueryDDims... > front(DiscreteDomain< DDims... > const &domain) noexcept
KOKKOS_FUNCTION constexpr auto remove_dims_of(DDomA const &DDom_a) noexcept
Remove the dimensions DDimsB from DDom_a.
KOKKOS_FUNCTION constexpr DiscreteVector< QueryDDims... > extents(DiscreteDomain< DDims... > const &domain) noexcept
KOKKOS_FUNCTION constexpr auto remove_dims_of(DiscreteDomain< DDimsA... > const &DDom_a, DiscreteDomain< DDimsB... > const &DDom_b) noexcept
KOKKOS_FUNCTION constexpr auto replace_dim_of(DiscreteDomain< DDimsA... > const &DDom_a, DiscreteDomain< DDimsB... > const &DDom_b) noexcept
constexpr bool is_discrete_domain_v
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)