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