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