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