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