DDC 0.5.0
Loading...
Searching...
No Matches
discrete_domain.hpp
1// Copyright (C) The DDC development team, see COPYRIGHT.md file
2//
3// SPDX-License-Identifier: MIT
4
5#pragma once
6
7#include <cassert>
8#include <cstddef>
9#include <iterator>
10#include <tuple>
11#include <type_traits>
12
13#include <Kokkos_Macros.hpp>
14
15#include "ddc/detail/type_seq.hpp"
16#include "ddc/discrete_element.hpp"
17#include "ddc/discrete_vector.hpp"
18
19namespace ddc {
20
21template <class DDim>
23
24template <class... DDims>
25class DiscreteDomain;
26
27template <class T>
28struct is_discrete_domain : std::false_type
29{
30};
31
32template <class... Tags>
33struct is_discrete_domain<DiscreteDomain<Tags...>> : std::true_type
34{
35};
36
37template <class T>
38inline constexpr bool is_discrete_domain_v = is_discrete_domain<T>::value;
39
40
41namespace detail {
42
43template <class... Tags>
44struct ToTypeSeq<DiscreteDomain<Tags...>>
45{
46 using type = TypeSeq<Tags...>;
47};
48
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 * ... * (uid<DDims>(m_element_end) - uid<DDims>(m_element_begin)));
135 }
136
137 KOKKOS_FUNCTION constexpr discrete_vector_type extents() const noexcept
138 {
139 return discrete_vector_type((uid<DDims>(m_element_end) - uid<DDims>(m_element_begin))...);
140 }
141
142 template <class QueryDDim>
143 KOKKOS_FUNCTION constexpr DiscreteVector<QueryDDim> extent() const noexcept
144 {
145 return DiscreteVector<QueryDDim>(
146 uid<QueryDDim>(m_element_end) - uid<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((uid<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 assert(((uid<ODDims>(m_element_begin) <= uid<ODDims>(odomain.m_element_begin)) && ...));
196 assert(((uid<ODDims>(m_element_end) >= uid<ODDims>(odomain.m_element_end)) && ...));
197 const DiscreteVector<DDims...> myextents = extents();
198 const DiscreteVector<ODDims...> oextents = odomain.extents();
199 return DiscreteDomain(
200 DiscreteElement<DDims...>(
201 (uid_or<DDims>(odomain.m_element_begin, uid<DDims>(m_element_begin)))...),
202 DiscreteVector<DDims...>((get_or<DDims>(oextents, get<DDims>(myextents)))...));
203 }
204
205 template <class... DElems>
206 KOKKOS_FUNCTION bool contains(DElems const&... delems) const noexcept
207 {
208 static_assert(
209 sizeof...(DDims) == (0 + ... + DElems::size()),
210 "Invalid number of dimensions");
211 static_assert((is_discrete_element_v<DElems> && ...), "Expected DiscreteElements");
212 return (((DiscreteElement<DDims>(take<DDims>(delems...))
213 >= DiscreteElement<DDims>(m_element_begin))
214 && ...)
215 && ((DiscreteElement<DDims>(take<DDims>(delems...))
216 < DiscreteElement<DDims>(m_element_end))
217 && ...));
218 }
219
220 template <class... DElems>
222 DElems const&... delems) const noexcept
223 {
224 static_assert(
225 sizeof...(DDims) == (0 + ... + DElems::size()),
226 "Invalid number of dimensions");
227 static_assert((is_discrete_element_v<DElems> && ...), "Expected DiscreteElements");
228 return DiscreteVector<DDims...>(
229 (DiscreteElement<DDims>(take<DDims>(delems...))
230 - DiscreteElement<DDims>(m_element_begin))...);
231 }
232
233 KOKKOS_FUNCTION constexpr bool empty() const noexcept
234 {
235 return size() == 0;
236 }
237
238 KOKKOS_FUNCTION constexpr explicit operator bool()
239 {
240 return !empty();
241 }
242
243 template <
244 std::size_t N = sizeof...(DDims),
245 class DDim0 = std::enable_if_t<N == 1, std::tuple_element_t<0, std::tuple<DDims...>>>>
246 KOKKOS_FUNCTION auto begin() const
247 {
248 return DiscreteDomainIterator<DDim0>(front());
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 end() const
255 {
256 return DiscreteDomainIterator<DDim0>(m_element_end);
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 cbegin() 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 cend() const
271 {
272 return DiscreteDomainIterator<DDim0>(m_element_end);
273 }
274
275 template <
276 std::size_t N = sizeof...(DDims),
277 class = std::enable_if_t<N == 1, std::tuple_element_t<0, std::tuple<DDims...>>>>
278 KOKKOS_FUNCTION constexpr decltype(auto) operator[](std::size_t n)
279 {
280 return begin()[n];
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) const
287 {
288 return begin()[n];
289 }
290};
291
292template <>
293class DiscreteDomain<>
294{
295 template <class...>
296 friend class DiscreteDomain;
297
298public:
299 using discrete_element_type = DiscreteElement<>;
300
301 using discrete_vector_type = DiscreteVector<>;
302
303 static KOKKOS_FUNCTION constexpr std::size_t rank()
304 {
305 return 0;
306 }
307
308 KOKKOS_DEFAULTED_FUNCTION constexpr DiscreteDomain() = default;
309
310 /// Construct a DiscreteDomain by copies and merge of domains
311 template <class... DDoms, class = std::enable_if_t<(is_discrete_domain_v<DDoms> && ...)>>
312 KOKKOS_FUNCTION constexpr explicit DiscreteDomain([[maybe_unused]] DDoms const&... domains)
313 {
314 }
315
316 /** Construct a DiscreteDomain starting from element_begin with size points.
317 * @param element_begin the lower bound in each direction
318 * @param size the number of points in each direction
319 */
321 [[maybe_unused]] discrete_element_type const& element_begin,
322 [[maybe_unused]] discrete_vector_type const& size)
323 {
324 }
325
327
329
331
333
335
336 KOKKOS_FUNCTION constexpr bool operator==([[maybe_unused]] DiscreteDomain const& other) const
337 {
338 return true;
339 }
340
341#if !defined(__cpp_impl_three_way_comparison) || __cpp_impl_three_way_comparison < 201902L
342 // In C++20, `a!=b` shall be automatically translated by the compiler to `!(a==b)`
343 KOKKOS_FUNCTION constexpr bool operator!=(DiscreteDomain const& other) const
344 {
345 return !(*this == other);
346 }
347#endif
348
349 static KOKKOS_FUNCTION constexpr std::size_t size()
350 {
351 return 1;
352 }
353
354 static KOKKOS_FUNCTION constexpr discrete_vector_type extents() noexcept
355 {
356 return {};
357 }
358
359 static KOKKOS_FUNCTION constexpr discrete_element_type front() noexcept
360 {
361 return {};
362 }
363
364 static KOKKOS_FUNCTION constexpr discrete_element_type back() noexcept
365 {
366 return {};
367 }
368
370 [[maybe_unused]] discrete_vector_type n) const
371 {
372 return *this;
373 }
374
376 [[maybe_unused]] discrete_vector_type n) const
377 {
378 return *this;
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 n1,
395 [[maybe_unused]] discrete_vector_type n2) const
396 {
397 return *this;
398 }
399
400 KOKKOS_FUNCTION constexpr DiscreteElement<> operator()(
401 DiscreteVector<> const& /* dvect */) const noexcept
402 {
403 return {};
404 }
405
406 template <class... ODims>
408 DiscreteDomain<ODims...> const& /* odomain */) const
409 {
410 return *this;
411 }
412
413 static KOKKOS_FUNCTION bool contains() noexcept
414 {
415 return true;
416 }
417
418 static KOKKOS_FUNCTION bool contains(DiscreteElement<>) noexcept
419 {
420 return true;
421 }
422
424 {
425 return {};
426 }
427
428 static KOKKOS_FUNCTION DiscreteVector<> distance_from_front(DiscreteElement<>) noexcept
429 {
430 return {};
431 }
432
433 static KOKKOS_FUNCTION constexpr bool empty() noexcept
434 {
435 return false;
436 }
437
438 KOKKOS_FUNCTION constexpr explicit operator bool()
439 {
440 return true;
441 }
442};
443
444template <class... QueryDDims, class... DDims>
445KOKKOS_FUNCTION constexpr DiscreteDomain<QueryDDims...> select(
446 DiscreteDomain<DDims...> const& domain)
447{
448 return DiscreteDomain<QueryDDims...>(
449 DiscreteElement<QueryDDims...>(domain.front()),
450 DiscreteVector<QueryDDims...>(domain.extents()));
451}
452
453namespace detail {
454
455template <class T>
456struct ConvertTypeSeqToDiscreteDomain;
457
458template <class... DDims>
459struct ConvertTypeSeqToDiscreteDomain<detail::TypeSeq<DDims...>>
460{
461 using type = DiscreteDomain<DDims...>;
462};
463
464template <class T>
465using convert_type_seq_to_discrete_domain_t = typename ConvertTypeSeqToDiscreteDomain<T>::type;
466
467} // namespace detail
468
469// Computes the cartesian product of DiscreteDomain types
470// Example usage : "using DDom = cartesian_prod_t<DDom1,DDom2,DDom3>;"
471template <typename... DDoms>
472struct cartesian_prod;
473
474template <typename... DDims1, typename... DDims2, typename... DDomsTail>
475struct cartesian_prod<DiscreteDomain<DDims1...>, DiscreteDomain<DDims2...>, DDomsTail...>
476{
477 using type = typename cartesian_prod<DiscreteDomain<DDims1..., DDims2...>, DDomsTail...>::type;
478};
479
480template <typename... DDims>
481struct cartesian_prod<DiscreteDomain<DDims...>>
482{
483 using type = DiscreteDomain<DDims...>;
484};
485
486template <>
487struct cartesian_prod<>
488{
489 using type = ddc::DiscreteDomain<>;
490};
491
492template <typename... DDoms>
493using cartesian_prod_t = typename cartesian_prod<DDoms...>::type;
494
495// 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)
496template <class... DDimsA, class... DDimsB>
497KOKKOS_FUNCTION constexpr auto remove_dims_of(
498 DiscreteDomain<DDimsA...> const& DDom_a,
499 [[maybe_unused]] DiscreteDomain<DDimsB...> const& DDom_b) noexcept
500{
501 using TagSeqA = detail::TypeSeq<DDimsA...>;
502 using TagSeqB = detail::TypeSeq<DDimsB...>;
503
504 using type_seq_r = type_seq_remove_t<TagSeqA, TagSeqB>;
505 return detail::convert_type_seq_to_discrete_domain_t<type_seq_r>(DDom_a);
506}
507
508//! Remove the dimensions DDimsB from DDom_a
509//! @param[in] DDom_a The discrete domain on which to remove dimensions
510//! @return The discrete domain without DDimsB dimensions
511template <class... DDimsB, class... DDimsA>
512KOKKOS_FUNCTION constexpr auto remove_dims_of(DiscreteDomain<DDimsA...> const& DDom_a) noexcept
513{
514 using TagSeqA = detail::TypeSeq<DDimsA...>;
515 using TagSeqB = detail::TypeSeq<DDimsB...>;
516
517 using type_seq_r = type_seq_remove_t<TagSeqA, TagSeqB>;
518 return detail::convert_type_seq_to_discrete_domain_t<type_seq_r>(DDom_a);
519}
520
521// Remove dimensions from a domain type
522template <typename DDom, typename... DDims>
523using remove_dims_of_t = decltype(remove_dims_of<DDims...>(std::declval<DDom>()));
524
525namespace detail {
526
527// 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
528template <typename DDim1, typename DDim2, typename DDimA, typename... DDimsB>
529KOKKOS_FUNCTION constexpr std::conditional_t<
530 std::is_same_v<DDimA, DDim1>,
531 ddc::DiscreteDomain<DDim2>,
532 ddc::DiscreteDomain<DDimA>>
533replace_dim_of_1d(
534 DiscreteDomain<DDimA> const& DDom_a,
535 [[maybe_unused]] DiscreteDomain<DDimsB...> const& DDom_b) noexcept
536{
537 if constexpr (std::is_same_v<DDimA, DDim1>) {
538 return ddc::DiscreteDomain<DDim2>(DDom_b);
539 } else {
540 return DDom_a;
541 }
542}
543
544} // namespace detail
545
546// Replace in DDom_a the dimension Dim1 by the dimension Dim2 of DDom_b
547template <typename DDim1, typename DDim2, typename... DDimsA, typename... DDimsB>
548KOKKOS_FUNCTION constexpr auto replace_dim_of(
549 DiscreteDomain<DDimsA...> const& DDom_a,
550 [[maybe_unused]] DiscreteDomain<DDimsB...> const& DDom_b) noexcept
551{
552 // TODO : static_asserts
553 using TagSeqA = detail::TypeSeq<DDimsA...>;
554 using TagSeqB = detail::TypeSeq<DDim1>;
555 using TagSeqC = detail::TypeSeq<DDim2>;
556
557 using type_seq_r = ddc::type_seq_replace_t<TagSeqA, TagSeqB, TagSeqC>;
558 return ddc::detail::convert_type_seq_to_discrete_domain_t<type_seq_r>(
559 detail::replace_dim_of_1d<
560 DDim1,
561 DDim2,
562 DDimsA,
563 DDimsB...>(ddc::DiscreteDomain<DDimsA>(DDom_a), DDom_b)...);
564}
565
566// Replace dimensions from a domain type
567template <typename DDom, typename DDim1, typename DDim2>
568using replace_dim_of_t = decltype(replace_dim_of<DDim1, DDim2>(
569 std::declval<DDom>(),
570 std::declval<typename detail::RebindDomain<DDom, detail::TypeSeq<DDim2>>::type>()));
571
572
573template <class... QueryDDims, class... DDims>
574KOKKOS_FUNCTION constexpr DiscreteVector<QueryDDims...> extents(
575 DiscreteDomain<DDims...> const& domain) noexcept
576{
577 return DiscreteVector<QueryDDims...>(DiscreteDomain<QueryDDims>(domain).size()...);
578}
579
580template <class... QueryDDims, class... DDims>
581KOKKOS_FUNCTION constexpr DiscreteElement<QueryDDims...> front(
582 DiscreteDomain<DDims...> const& domain) noexcept
583{
584 return DiscreteElement<QueryDDims...>(DiscreteDomain<QueryDDims>(domain).front()...);
585}
586
587template <class... QueryDDims, class... DDims>
588KOKKOS_FUNCTION constexpr DiscreteElement<QueryDDims...> back(
589 DiscreteDomain<DDims...> const& domain) noexcept
590{
591 return DiscreteElement<QueryDDims...>(DiscreteDomain<QueryDDims>(domain).back()...);
592}
593
594template <class DDim>
596{
597private:
598 DiscreteElement<DDim> m_value = DiscreteElement<DDim>();
599
600public:
601 using iterator_category = std::random_access_iterator_tag;
602
603 using value_type = DiscreteElement<DDim>;
604
605 using difference_type = std::ptrdiff_t;
606
608
609 KOKKOS_FUNCTION constexpr explicit DiscreteDomainIterator(DiscreteElement<DDim> value)
610 : m_value(value)
611 {
612 }
613
614 KOKKOS_FUNCTION constexpr DiscreteElement<DDim> operator*() const noexcept
615 {
616 return m_value;
617 }
618
620 {
621 ++m_value.uid();
622 return *this;
623 }
624
626 {
627 auto tmp = *this;
628 ++*this;
629 return tmp;
630 }
631
633 {
634 --m_value.uid();
635 return *this;
636 }
637
639 {
640 auto tmp = *this;
641 --*this;
642 return tmp;
643 }
644
645 KOKKOS_FUNCTION constexpr DiscreteDomainIterator& operator+=(difference_type n)
646 {
647 if (n >= difference_type(0)) {
648 m_value.uid() += static_cast<DiscreteElementType>(n);
649 } else {
650 m_value.uid() -= static_cast<DiscreteElementType>(-n);
651 }
652 return *this;
653 }
654
655 KOKKOS_FUNCTION constexpr DiscreteDomainIterator& operator-=(difference_type n)
656 {
657 if (n >= difference_type(0)) {
658 m_value.uid() -= static_cast<DiscreteElementType>(n);
659 } else {
660 m_value.uid() += static_cast<DiscreteElementType>(-n);
661 }
662 return *this;
663 }
664
665 KOKKOS_FUNCTION constexpr DiscreteElement<DDim> operator[](difference_type n) const
666 {
667 return m_value + n;
668 }
669
670 friend KOKKOS_FUNCTION constexpr bool operator==(
671 DiscreteDomainIterator const& xx,
672 DiscreteDomainIterator const& yy)
673 {
674 return xx.m_value == yy.m_value;
675 }
676
677#if !defined(__cpp_impl_three_way_comparison) || __cpp_impl_three_way_comparison < 201902L
678 // In C++20, `a!=b` shall be automatically translated by the compiler to `!(a==b)`
679 friend KOKKOS_FUNCTION constexpr bool operator!=(
682 {
683 return xx.m_value != yy.m_value;
684 }
685#endif
686
687 friend KOKKOS_FUNCTION constexpr bool operator<(
688 DiscreteDomainIterator const& xx,
689 DiscreteDomainIterator const& yy)
690 {
691 return xx.m_value < yy.m_value;
692 }
693
694 friend KOKKOS_FUNCTION constexpr bool operator>(
695 DiscreteDomainIterator const& xx,
696 DiscreteDomainIterator const& yy)
697 {
698 return yy < xx;
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 !(xx < yy);
713 }
714
717 difference_type n)
718 {
719 return i += n;
720 }
721
723 difference_type n,
725 {
726 return i += n;
727 }
728
731 difference_type n)
732 {
733 return i -= n;
734 }
735
736 friend KOKKOS_FUNCTION constexpr difference_type operator-(
737 DiscreteDomainIterator const& xx,
738 DiscreteDomainIterator const& yy)
739 {
740 return (yy.m_value > xx.m_value) ? (-static_cast<difference_type>(yy.m_value - xx.m_value))
741 : (xx.m_value - yy.m_value);
742 }
743};
744
745} // 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)