DDC 0.17.0
Loading...
Searching...
No Matches
strided_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 <iosfwd>
9#include <iterator>
10#include <span>
11#include <tuple>
12#include <type_traits>
13
14#include <Kokkos_Assert.hpp>
15#include <Kokkos_Macros.hpp>
16
20#include "type_seq.hpp"
21
22namespace ddc {
23
24template <concepts::discrete_dimension DDim>
26
27template <concepts::discrete_dimension... DDims>
29
30template <class T>
31struct is_strided_discrete_domain : std::false_type
32{
33};
34
35template <concepts::discrete_dimension... Tags>
36struct is_strided_discrete_domain<StridedDiscreteDomain<Tags...>> : std::true_type
37{
38};
39
40template <class T>
42
43namespace concepts {
44
45template <class T>
46concept strided_discrete_domain = is_strided_discrete_domain_v<T>;
47
48}
49
50namespace detail {
51
52template <ddc::concepts::discrete_dimension... Tags>
53struct ToTypeSeq<StridedDiscreteDomain<Tags...>>
54{
55 using type = ddc::TypeSeq<Tags...>;
56};
57
58template <ddc::concepts::discrete_dimension... DDims, ddc::concepts::discrete_dimension... ODDims>
59struct Rebind<StridedDiscreteDomain<DDims...>, ddc::TypeSeq<ODDims...>>
60{
61 using type = StridedDiscreteDomain<ODDims...>;
62};
63
64} // namespace detail
65
66template <concepts::discrete_dimension... ODDims>
67KOKKOS_FUNCTION DiscreteVector<ODDims...> prod(
68 DiscreteVector<ODDims...> const& lhs,
69 DiscreteVector<ODDims...> const& rhs) noexcept
70{
71 return DiscreteVector<ODDims...>((get<ODDims>(lhs) * get<ODDims>(rhs))...);
72}
73
74template <concepts::discrete_dimension... DDims>
76{
77 template <concepts::discrete_dimension...>
78 friend class StridedDiscreteDomain;
79
80 static_assert(
81 type_seq_is_unique_v<TypeSeq<DDims...>>,
82 "The dimensions of a StridedDiscreteDomain must be unique");
83
84public:
85 using discrete_element_type = DiscreteElement<DDims...>;
86
87 using discrete_vector_type = DiscreteVector<DDims...>;
88
89private:
90 DiscreteElement<DDims...> m_element_begin;
91
92 DiscreteVector<DDims...> m_extents;
93
94 DiscreteVector<DDims...> m_strides;
95
96public:
97 static KOKKOS_FUNCTION constexpr std::size_t rank()
98 {
99 return sizeof...(DDims);
100 }
101
102 KOKKOS_DEFAULTED_FUNCTION StridedDiscreteDomain() = default;
103
104 /// Construct a StridedDiscreteDomain by copies and merge of domains
105 template <concepts::strided_discrete_domain... DDoms>
106 KOKKOS_FUNCTION constexpr explicit StridedDiscreteDomain(DDoms const&... domains)
107 : m_element_begin(domains.front()...)
108 , m_extents(domains.extents()...)
109 , m_strides(domains.strides()...)
110 {
111 }
112
113 /** Construct a StridedDiscreteDomain starting from element_begin with size points.
114 * @param element_begin the lower bound in each direction
115 * @param extents the number of points in each direction
116 * @param strides the step between two elements
117 */
118 KOKKOS_FUNCTION constexpr StridedDiscreteDomain(
119 discrete_element_type const& element_begin,
120 discrete_vector_type const& extents,
121 discrete_vector_type const& strides)
122 : m_element_begin(element_begin)
123 , m_extents(extents)
124 , m_strides(strides)
125 {
126 }
127
128 KOKKOS_DEFAULTED_FUNCTION StridedDiscreteDomain(StridedDiscreteDomain const& x) = default;
129
130 KOKKOS_DEFAULTED_FUNCTION StridedDiscreteDomain(StridedDiscreteDomain&& x) = default;
131
132 KOKKOS_DEFAULTED_FUNCTION ~StridedDiscreteDomain() = default;
133
134 KOKKOS_DEFAULTED_FUNCTION StridedDiscreteDomain& operator=(StridedDiscreteDomain const& x)
135 = default;
136
137 KOKKOS_DEFAULTED_FUNCTION StridedDiscreteDomain& operator=(StridedDiscreteDomain&& x) = default;
138
139 template <concepts::discrete_dimension... ODDims>
140 KOKKOS_FUNCTION constexpr bool operator==(StridedDiscreteDomain<ODDims...> const& other) const
141 {
142 if (empty() && other.empty()) {
143 return true;
144 }
145 return m_element_begin == other.m_element_begin && m_extents == other.m_extents
146 && m_strides == other.m_strides;
147 }
148
149#if !defined(__cpp_impl_three_way_comparison) || __cpp_impl_three_way_comparison < 201902L
150 // In C++20, `a!=b` shall be automatically translated by the compiler to `!(a==b)`
151 template <concepts::discrete_dimension... ODDims>
152 KOKKOS_FUNCTION constexpr bool operator!=(StridedDiscreteDomain<ODDims...> const& other) const
153 {
154 return !(*this == other);
155 }
156#endif
157
158 KOKKOS_FUNCTION constexpr std::size_t size() const
159 {
160 return (1UL * ... * get<DDims>(m_extents));
161 }
162
163 KOKKOS_FUNCTION constexpr discrete_vector_type extents() const noexcept
164 {
165 return m_extents;
166 }
167
168 KOKKOS_FUNCTION constexpr discrete_vector_type strides() const noexcept
169 {
170 return m_strides;
171 }
172
173 template <concepts::discrete_dimension QueryDDim>
174 KOKKOS_FUNCTION constexpr DiscreteVector<QueryDDim> extent() const noexcept
175 {
176 return DiscreteVector<QueryDDim>(m_extents);
177 }
178
179 KOKKOS_FUNCTION constexpr discrete_element_type front() const noexcept
180 {
181 return m_element_begin;
182 }
183
184 KOKKOS_FUNCTION constexpr discrete_element_type back() const noexcept
185 {
186 return discrete_element_type(
187 (DiscreteElement<DDims>(m_element_begin)
188 + (get<DDims>(m_extents) - 1) * get<DDims>(m_strides))...);
189 }
190
191 KOKKOS_FUNCTION constexpr StridedDiscreteDomain take_first(discrete_vector_type n) const
192 {
193 return StridedDiscreteDomain(front(), n, m_strides);
194 }
195
196 KOKKOS_FUNCTION constexpr StridedDiscreteDomain take_last(discrete_vector_type n) const
197 {
198 return StridedDiscreteDomain(front() + prod(extents() - n, m_strides), n, m_strides);
199 }
200
201 KOKKOS_FUNCTION constexpr StridedDiscreteDomain remove_first(discrete_vector_type n) const
202 {
203 return StridedDiscreteDomain(front() + prod(n, m_strides), extents() - n, m_strides);
204 }
205
206 KOKKOS_FUNCTION constexpr StridedDiscreteDomain remove_last(discrete_vector_type n) const
207 {
208 return StridedDiscreteDomain(front(), extents() - n, m_strides);
209 }
210
211 KOKKOS_FUNCTION constexpr StridedDiscreteDomain remove(
212 discrete_vector_type n1,
213 discrete_vector_type n2) const
214 {
215 return StridedDiscreteDomain(front() + prod(n1, m_strides), extents() - n1 - n2, m_strides);
216 }
217
218 KOKKOS_FUNCTION constexpr DiscreteElement<DDims...> operator()(
219 DiscreteVector<DDims...> const& dvect) const noexcept
220 {
221 return m_element_begin + prod(dvect, m_strides);
222 }
223
224 template <class... DElems>
225 KOKKOS_FUNCTION bool contains(DElems const&... delems) const noexcept
226 {
227 static_assert(
228 sizeof...(DDims) == (0 + ... + DElems::size()),
229 "Invalid number of dimensions");
230 static_assert((is_discrete_element_v<DElems> && ...), "Expected DiscreteElements");
231 auto const contains_1d = [](DiscreteElementType const i,
232 DiscreteElementType const b,
233 DiscreteVectorElement const n,
234 DiscreteVectorElement const s) {
235 return (i >= b) && (i < (b + (n - 1) * s + 1)) && ((i - b) % s == 0);
236 };
237 DiscreteElement<DDims...> const delem(delems...);
238 for (std::size_t i = 0; i < rank(); ++i) {
239 if (!contains_1d(
240 detail::array(delem)[i],
241 detail::array(m_element_begin)[i],
242 detail::array(m_extents)[i],
243 detail::array(m_strides)[i])) {
244 return false;
245 }
246 }
247 return true;
248 }
249
250 template <class... DElems>
251 KOKKOS_FUNCTION DiscreteVector<DDims...> distance_from_front(
252 DElems const&... delems) const noexcept
253 {
254 static_assert(
255 sizeof...(DDims) == (0 + ... + DElems::size()),
256 "Invalid number of dimensions");
257 static_assert((is_discrete_element_v<DElems> && ...), "Expected DiscreteElements");
258 KOKKOS_ASSERT(contains(delems...))
259 return DiscreteVector<DDims...>(
260 ((DiscreteElement<DDims>(take<DDims>(delems...))
261 - DiscreteElement<DDims>(m_element_begin))
262 / DiscreteVector<DDims>(m_strides))...);
263 }
264
265 KOKKOS_FUNCTION constexpr bool empty() const noexcept
266 {
267 return size() == 0;
268 }
269
270 KOKKOS_FUNCTION constexpr explicit operator bool()
271 {
272 return !empty();
273 }
274
275 KOKKOS_FUNCTION auto begin() const
276 requires(sizeof...(DDims) == 1)
277 {
279 std::tuple_element_t<0, std::tuple<DDims...>>>(front(), m_strides);
280 }
281
282 KOKKOS_FUNCTION auto end() const
283 requires(sizeof...(DDims) == 1)
284 {
285 return StridedDiscreteDomainIterator<std::tuple_element_t<
286 0,
287 std::tuple<DDims...>>>(m_element_begin + m_extents * m_strides, m_strides);
288 }
289
290 KOKKOS_FUNCTION auto cbegin() const
291 requires(sizeof...(DDims) == 1)
292 {
294 std::tuple_element_t<0, std::tuple<DDims...>>>(front(), m_strides);
295 }
296
297 KOKKOS_FUNCTION auto cend() const
298 requires(sizeof...(DDims) == 1)
299 {
300 return StridedDiscreteDomainIterator<std::tuple_element_t<
301 0,
302 std::tuple<DDims...>>>(m_element_begin + m_extents * m_strides, m_strides);
303 }
304
305 KOKKOS_FUNCTION constexpr decltype(auto) operator[](std::size_t n)
306 requires(sizeof...(DDims) == 1)
307 {
308 return begin()[n];
309 }
310
311 KOKKOS_FUNCTION constexpr decltype(auto) operator[](std::size_t n) const
312 requires(sizeof...(DDims) == 1)
313 {
314 return begin()[n];
315 }
316};
317
318template <>
320{
321 template <concepts::discrete_dimension...>
322 friend class StridedDiscreteDomain;
323
324public:
325 using discrete_element_type = DiscreteElement<>;
326
327 using discrete_vector_type = DiscreteVector<>;
328
329 static KOKKOS_FUNCTION constexpr std::size_t rank()
330 {
331 return 0;
332 }
333
334 KOKKOS_DEFAULTED_FUNCTION constexpr StridedDiscreteDomain() = default;
335
336 // Construct a StridedDiscreteDomain from a reordered copy of `domain`
337 template <concepts::discrete_dimension... ODDims>
338 KOKKOS_FUNCTION constexpr explicit StridedDiscreteDomain(
339 StridedDiscreteDomain<ODDims...> const& /*domain*/)
340 {
341 }
342
343 /** Construct a StridedDiscreteDomain starting from element_begin with size points.
344 * @param element_begin the lower bound in each direction
345 * @param size the number of points in each direction
346 * @param strides the step between two elements
347 */
348 KOKKOS_FUNCTION constexpr StridedDiscreteDomain(
349 [[maybe_unused]] discrete_element_type const& element_begin,
350 [[maybe_unused]] discrete_vector_type const& size,
351 [[maybe_unused]] discrete_vector_type const& strides)
352 {
353 // Parameters `element_begin`, `size` and `strides` are truly unused
354 }
355
356 KOKKOS_DEFAULTED_FUNCTION StridedDiscreteDomain(StridedDiscreteDomain const& x) = default;
357
358 KOKKOS_DEFAULTED_FUNCTION StridedDiscreteDomain(StridedDiscreteDomain&& x) = default;
359
360 KOKKOS_DEFAULTED_FUNCTION ~StridedDiscreteDomain() = default;
361
362 KOKKOS_DEFAULTED_FUNCTION StridedDiscreteDomain& operator=(StridedDiscreteDomain const& x)
363 = default;
364
365 KOKKOS_DEFAULTED_FUNCTION StridedDiscreteDomain& operator=(StridedDiscreteDomain&& x) = default;
366
367 KOKKOS_FUNCTION constexpr bool operator==(StridedDiscreteDomain const& /*other*/) const
368 {
369 return true;
370 }
371
372#if !defined(__cpp_impl_three_way_comparison) || __cpp_impl_three_way_comparison < 201902L
373 // In C++20, `a!=b` shall be automatically translated by the compiler to `!(a==b)`
374 KOKKOS_FUNCTION constexpr bool operator!=(StridedDiscreteDomain const& other) const
375 {
376 return !(*this == other);
377 }
378#endif
379
380 static KOKKOS_FUNCTION constexpr std::size_t size()
381 {
382 return 1;
383 }
384
385 static KOKKOS_FUNCTION constexpr discrete_vector_type extents() noexcept
386 {
387 return {};
388 }
389
390 static KOKKOS_FUNCTION constexpr discrete_vector_type strides() noexcept
391 {
392 return {};
393 }
394
395 static KOKKOS_FUNCTION constexpr discrete_element_type front() noexcept
396 {
397 return {};
398 }
399
400 static KOKKOS_FUNCTION constexpr discrete_element_type back() noexcept
401 {
402 return {};
403 }
404
405 KOKKOS_FUNCTION constexpr StridedDiscreteDomain take_first(discrete_vector_type /*n*/) const
406 {
407 return *this;
408 }
409
410 KOKKOS_FUNCTION constexpr StridedDiscreteDomain take_last(discrete_vector_type /*n*/) const
411 {
412 return *this;
413 }
414
415 KOKKOS_FUNCTION constexpr StridedDiscreteDomain remove_first(discrete_vector_type /*n*/) const
416 {
417 return *this;
418 }
419
420 KOKKOS_FUNCTION constexpr StridedDiscreteDomain remove_last(discrete_vector_type /*n*/) const
421 {
422 return *this;
423 }
424
425 KOKKOS_FUNCTION constexpr StridedDiscreteDomain remove(
426 discrete_vector_type /*n1*/,
427 discrete_vector_type /*n2*/) const
428 {
429 return *this;
430 }
431
432 KOKKOS_FUNCTION constexpr DiscreteElement<> operator()(
433 DiscreteVector<> const& /*dvect*/) const noexcept
434 {
435 return {};
436 }
437
438 static KOKKOS_FUNCTION bool contains() noexcept
439 {
440 return true;
441 }
442
443 static KOKKOS_FUNCTION bool contains(DiscreteElement<>) noexcept
444 {
445 return true;
446 }
447
448 static KOKKOS_FUNCTION DiscreteVector<> distance_from_front() noexcept
449 {
450 return {};
451 }
452
453 static KOKKOS_FUNCTION DiscreteVector<> distance_from_front(DiscreteElement<>) noexcept
454 {
455 return {};
456 }
457
458 static KOKKOS_FUNCTION constexpr bool empty() noexcept
459 {
460 return false;
461 }
462
463 KOKKOS_FUNCTION constexpr explicit operator bool()
464 {
465 return true;
466 }
467};
468
469template <concepts::discrete_dimension... QueryDDims, concepts::discrete_dimension... DDims>
470KOKKOS_FUNCTION constexpr StridedDiscreteDomain<QueryDDims...> select(
471 StridedDiscreteDomain<DDims...> const& domain)
472{
473 return StridedDiscreteDomain<QueryDDims...>(domain);
474}
475
476namespace detail {
477
478template <ddc::concepts::type_seq T>
479struct ConvertTypeSeqToStridedDiscreteDomain
480{
481};
482
483template <ddc::concepts::discrete_dimension... DDims>
484struct ConvertTypeSeqToStridedDiscreteDomain<ddc::TypeSeq<DDims...>>
485{
486 using type = StridedDiscreteDomain<DDims...>;
487};
488
489template <ddc::concepts::type_seq T>
490using convert_type_seq_to_strided_discrete_domain_t
491 = ConvertTypeSeqToStridedDiscreteDomain<T>::type;
492
493} // namespace detail
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 <concepts::discrete_dimension... DDimsA, concepts::discrete_dimension... DDimsB>
497KOKKOS_FUNCTION constexpr auto remove_dims_of(
498 StridedDiscreteDomain<DDimsA...> const& DDom_a,
499 StridedDiscreteDomain<DDimsB...> const& /*DDom_b*/) noexcept
500{
501 using TagSeqA = TypeSeq<DDimsA...>;
502 using TagSeqB = TypeSeq<DDimsB...>;
503
504 using type_seq_r = type_seq_remove_t<TagSeqA, TagSeqB>;
505 return detail::convert_type_seq_to_strided_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 <concepts::discrete_dimension... DDimsB, concepts::discrete_dimension... DDimsA>
512KOKKOS_FUNCTION constexpr auto remove_dims_of(
513 StridedDiscreteDomain<DDimsA...> const& DDom_a) noexcept
514{
515 using TagSeqA = TypeSeq<DDimsA...>;
516 using TagSeqB = TypeSeq<DDimsB...>;
517
518 using type_seq_r = type_seq_remove_t<TagSeqA, TagSeqB>;
519 return detail::convert_type_seq_to_strided_discrete_domain_t<type_seq_r>(DDom_a);
520}
521
522namespace detail {
523
524// 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
525template <typename DDim1, typename DDim2, typename DDimA, typename... DDimsB>
526KOKKOS_FUNCTION constexpr std::conditional_t<
527 std::is_same_v<DDimA, DDim1>,
530replace_dim_of_1d(
531 [[maybe_unused]] StridedDiscreteDomain<DDimA> const& DDom_a,
532 [[maybe_unused]] StridedDiscreteDomain<DDimsB...> const& DDom_b) noexcept
533{
534 if constexpr (std::is_same_v<DDimA, DDim1>) {
535 return ddc::StridedDiscreteDomain<DDim2>(DDom_b);
536 } else {
537 return DDom_a;
538 }
539}
540
541} // namespace detail
542
543// Replace in DDom_a the dimension Dim1 by the dimension Dim2 of DDom_b
544template <typename DDim1, typename DDim2, typename... DDimsA, typename... DDimsB>
545KOKKOS_FUNCTION constexpr auto replace_dim_of(
546 StridedDiscreteDomain<DDimsA...> const& DDom_a,
547 [[maybe_unused]] StridedDiscreteDomain<DDimsB...> const& DDom_b) noexcept
548{
549 // TODO : static_asserts
550 using TagSeqA = TypeSeq<DDimsA...>;
551 using TagSeqB = TypeSeq<DDim1>;
552 using TagSeqC = TypeSeq<DDim2>;
553
554 using type_seq_r = ddc::type_seq_replace_t<TagSeqA, TagSeqB, TagSeqC>;
555 return ddc::detail::convert_type_seq_to_strided_discrete_domain_t<type_seq_r>(
556 detail::replace_dim_of_1d<
557 DDim1,
558 DDim2,
559 DDimsA,
560 DDimsB...>(ddc::StridedDiscreteDomain<DDimsA>(DDom_a), DDom_b)...);
561}
562
563template <concepts::discrete_dimension... QueryDDims, concepts::discrete_dimension... DDims>
564KOKKOS_FUNCTION constexpr DiscreteVector<QueryDDims...> extents(
565 StridedDiscreteDomain<DDims...> const& domain) noexcept
566{
567 return DiscreteVector<QueryDDims...>(StridedDiscreteDomain<QueryDDims>(domain).size()...);
568}
569
570template <concepts::discrete_dimension... QueryDDims, concepts::discrete_dimension... DDims>
571KOKKOS_FUNCTION constexpr DiscreteElement<QueryDDims...> front(
572 StridedDiscreteDomain<DDims...> const& domain) noexcept
573{
574 return DiscreteElement<QueryDDims...>(StridedDiscreteDomain<QueryDDims>(domain).front()...);
575}
576
577template <concepts::discrete_dimension... QueryDDims, concepts::discrete_dimension... DDims>
578KOKKOS_FUNCTION constexpr DiscreteElement<QueryDDims...> back(
579 StridedDiscreteDomain<DDims...> const& domain) noexcept
580{
581 return DiscreteElement<QueryDDims...>(StridedDiscreteDomain<QueryDDims>(domain).back()...);
582}
583
584template <concepts::discrete_dimension DDim>
586{
587private:
588 DiscreteElement<DDim> m_value = DiscreteElement<DDim>();
589
590 DiscreteVector<DDim> m_stride = DiscreteVector<DDim>();
591
592public:
593 using iterator_category = std::random_access_iterator_tag;
594
595 using value_type = DiscreteElement<DDim>;
596
597 using difference_type = std::ptrdiff_t;
598
599 KOKKOS_DEFAULTED_FUNCTION StridedDiscreteDomainIterator() = default;
600
601 KOKKOS_FUNCTION constexpr explicit StridedDiscreteDomainIterator(
602 DiscreteElement<DDim> value,
603 DiscreteVector<DDim> stride)
604 : m_value(value)
605 , m_stride(stride)
606 {
607 }
608
609 KOKKOS_FUNCTION constexpr DiscreteElement<DDim> operator*() const noexcept
610 {
611 return m_value;
612 }
613
614 KOKKOS_FUNCTION constexpr StridedDiscreteDomainIterator& operator++()
615 {
616 m_value += m_stride;
617 return *this;
618 }
619
620 KOKKOS_FUNCTION constexpr StridedDiscreteDomainIterator operator++(int)
621 {
622 auto tmp = *this;
623 ++*this;
624 return tmp;
625 }
626
627 KOKKOS_FUNCTION constexpr StridedDiscreteDomainIterator& operator--()
628 {
629 m_value -= m_stride;
630 return *this;
631 }
632
633 KOKKOS_FUNCTION constexpr StridedDiscreteDomainIterator operator--(int)
634 {
635 auto tmp = *this;
636 --*this;
637 return tmp;
638 }
639
640 KOKKOS_FUNCTION constexpr StridedDiscreteDomainIterator& operator+=(difference_type n)
641 {
642 if (n >= static_cast<difference_type>(0)) {
643 m_value += static_cast<DiscreteElementType>(n) * m_stride;
644 } else {
645 m_value -= static_cast<DiscreteElementType>(-n) * m_stride;
646 }
647 return *this;
648 }
649
650 KOKKOS_FUNCTION constexpr StridedDiscreteDomainIterator& operator-=(difference_type n)
651 {
652 if (n >= static_cast<difference_type>(0)) {
653 m_value -= static_cast<DiscreteElementType>(n) * m_stride;
654 } else {
655 m_value += static_cast<DiscreteElementType>(-n) * m_stride;
656 }
657 return *this;
658 }
659
660 KOKKOS_FUNCTION constexpr DiscreteElement<DDim> operator[](difference_type n) const
661 {
662 return m_value + n * m_stride;
663 }
664
665 friend KOKKOS_FUNCTION constexpr bool operator==(
668 {
669 return xx.m_value == yy.m_value;
670 }
671
672#if !defined(__cpp_impl_three_way_comparison) || __cpp_impl_three_way_comparison < 201902L
673 // In C++20, `a!=b` shall be automatically translated by the compiler to `!(a==b)`
674 friend KOKKOS_FUNCTION constexpr bool operator!=(
677 {
678 return xx.m_value != yy.m_value;
679 }
680#endif
681
682 friend KOKKOS_FUNCTION constexpr bool operator<(
685 {
686 return xx.m_value < yy.m_value;
687 }
688
689 friend KOKKOS_FUNCTION constexpr bool operator>(
692 {
693 return yy < xx;
694 }
695
696 friend KOKKOS_FUNCTION constexpr bool operator<=(
699 {
700 return !(yy < xx);
701 }
702
703 friend KOKKOS_FUNCTION constexpr bool operator>=(
706 {
707 return !(xx < yy);
708 }
709
710 friend KOKKOS_FUNCTION constexpr StridedDiscreteDomainIterator operator+(
712 difference_type n)
713 {
714 return i += n;
715 }
716
717 friend KOKKOS_FUNCTION constexpr StridedDiscreteDomainIterator operator+(
718 difference_type n,
720 {
721 return i += n;
722 }
723
724 friend KOKKOS_FUNCTION constexpr StridedDiscreteDomainIterator operator-(
726 difference_type n)
727 {
728 return i -= n;
729 }
730
731 friend KOKKOS_FUNCTION constexpr difference_type operator-(
734 {
735 return (yy.m_value > xx.m_value) ? (-static_cast<difference_type>(yy.m_value - xx.m_value))
736 : (xx.m_value - yy.m_value);
737 }
738};
739
740namespace detail {
741
742void print_strided_discrete_domain(
743 std::ostream& os,
744 bool empty,
745 std::span<DiscreteElementType const> front,
746 std::span<DiscreteElementType const> back,
747 std::span<DiscreteVectorElement const> strides);
748
749} // namespace detail
750
751/**
752 * Print a StridedDiscreteDomain. Only the front and back elements are displayed,
753 * together with the strides.
754 *
755 * For example `StridedDiscreteDomain(front=(0, 1), back=(8, 19), strides=(2, 3))`, or
756 * `StridedDiscreteDomain(empty)` if the domain contains no element.
757 */
758template <concepts::discrete_dimension... DDims>
759std::ostream& operator<<(std::ostream& os, StridedDiscreteDomain<DDims...> const& domain)
760{
761 detail::print_strided_discrete_domain(
762 os,
763 domain.empty(),
764 detail::array(domain.front()),
765 detail::array(domain.back()),
766 detail::array(domain.strides()));
767 return os;
768}
769
770} // namespace ddc
friend class DiscreteDomain
KOKKOS_DEFAULTED_FUNCTION constexpr DiscreteElement()=default
KOKKOS_FUNCTION constexpr bool operator!=(DiscreteVector< OTags... > const &rhs) const noexcept
KOKKOS_DEFAULTED_FUNCTION constexpr DiscreteVector()=default
KOKKOS_FUNCTION std::size_t size() const
KOKKOS_FUNCTION Coordinate< CDim > coordinate(discrete_element_type const &icoord) const noexcept
Convert a mesh index into a position in CDim
Impl(Impl< DDim, OriginMemorySpace > const &impl)
Impl & operator=(Impl &&x)=default
Impl & operator=(Impl const &x)=delete
Impl(InputIt const points_begin, InputIt const points_end)
Construct a NonUniformPointSampling using a pair of iterators.
KOKKOS_FUNCTION discrete_element_type front() const noexcept
Lower bound index of the mesh.
Impl(InputRange const &points)
Construct a NonUniformPointSampling using a C++20 "common range".
Impl(std::initializer_list< Coordinate< CDim > > const points)
Construct a NonUniformPointSampling using a brace-list, i.e. NonUniformPointSampling mesh({0....
NonUniformPointSampling models a non-uniform discretization of the CDim segment .
static std::tuple< typename DDim::template Impl< DDim, Kokkos::HostSpace >, DiscreteDomain< DDim > > init(InputRange const &non_uniform_points)
Construct an Impl<Kokkos::HostSpace> and associated discrete_domain_type from a range containing the ...
static std::tuple< typename DDim::template Impl< DDim, Kokkos::HostSpace >, DiscreteDomain< DDim >, DiscreteDomain< DDim >, DiscreteDomain< DDim >, DiscreteDomain< DDim > > init_ghosted(InputRange const &domain_r, InputRange const &pre_ghost_r, InputRange const &post_ghost_r)
Construct 4 non-uniform DiscreteDomain and an Impl<Kokkos::HostSpace> from 3 ranges containing the po...
Impl & operator=(Impl &&x)=default
KOKKOS_FUNCTION Coordinate< CDim > origin() const noexcept
Lower bound index of the mesh.
KOKKOS_FUNCTION discrete_element_type front() const noexcept
Lower bound index of the mesh.
KOKKOS_FUNCTION Coordinate< CDim > coordinate(discrete_element_type const &icoord) const noexcept
Convert a mesh index into a position in CDim
Impl(Impl const &)=delete
KOKKOS_FUNCTION std::size_t n_period() const
Number of steps in a period.
Impl(Impl< DDim, OriginMemorySpace > const &impl)
Impl(Coordinate< CDim > origin, Real step, std::size_t n_period)
Construct a Impl from a point and a spacing step.
KOKKOS_FUNCTION Real step() const
Spacing step of the mesh.
Impl & operator=(Impl const &x)=delete
PeriodicSampling models a periodic discretization of the provided continuous dimension.
static std::tuple< typename DDim::template Impl< DDim, Kokkos::HostSpace >, DiscreteDomain< DDim > > init(Coordinate< CDim > a, Coordinate< CDim > b, DiscreteVector< DDim > n, DiscreteVector< DDim > n_period)
Construct a Impl<Kokkos::HostSpace> and associated discrete_domain_type from a segment and a number ...
std::tuple< Impl< DDim, Kokkos::HostSpace >, DiscreteDomain< DDim >, DiscreteDomain< DDim >, DiscreteDomain< DDim >, DiscreteDomain< DDim > > init_ghosted(Coordinate< CDim > a, Coordinate< CDim > b, DiscreteVector< DDim > n, DiscreteVector< DDim > n_period, DiscreteVector< DDim > n_ghosts_before, DiscreteVector< DDim > n_ghosts_after)
Construct a periodic DiscreteDomain from a segment and a number of points n.
std::tuple< Impl< DDim, Kokkos::HostSpace >, DiscreteDomain< DDim >, DiscreteDomain< DDim >, DiscreteDomain< DDim >, DiscreteDomain< DDim > > init_ghosted(Coordinate< CDim > a, Coordinate< CDim > b, DiscreteVector< DDim > n, DiscreteVector< DDim > n_period, DiscreteVector< DDim > n_ghosts)
Construct a periodic DiscreteDomain from a segment and a number of points n.
ScopeGuard & operator=(ScopeGuard const &x)=delete
~ScopeGuard() noexcept
ScopeGuard(int argc, char **&argv)
ScopeGuard(ScopeGuard &&x) noexcept=delete
ScopeGuard & operator=(ScopeGuard &&x) noexcept=delete
ScopeGuard(ScopeGuard const &x)=delete
static KOKKOS_FUNCTION bool contains(DiscreteElement<>) noexcept
KOKKOS_FUNCTION constexpr SparseDiscreteDomain remove(discrete_vector_type, discrete_vector_type) const
static KOKKOS_FUNCTION detail::TaggedVector< Kokkos::View< DiscreteElementType *, Kokkos::SharedSpace > > discrete_elements() noexcept
KOKKOS_FUNCTION constexpr SparseDiscreteDomain take_first(discrete_vector_type) const
static KOKKOS_FUNCTION constexpr std::size_t rank()
KOKKOS_DEFAULTED_FUNCTION constexpr SparseDiscreteDomain()=default
KOKKOS_FUNCTION constexpr DiscreteElement operator()(DiscreteVector<> const &) const noexcept
KOKKOS_FUNCTION constexpr SparseDiscreteDomain remove_last(discrete_vector_type) const
static KOKKOS_FUNCTION DiscreteVector distance_from_front() noexcept
static KOKKOS_FUNCTION constexpr std::size_t size()
static KOKKOS_FUNCTION constexpr bool empty() noexcept
static KOKKOS_FUNCTION DiscreteVector distance_from_front(DiscreteElement<>) noexcept
KOKKOS_FUNCTION constexpr bool operator==(SparseDiscreteDomain const &) const
static KOKKOS_FUNCTION constexpr discrete_element_type back() noexcept
static KOKKOS_FUNCTION bool contains() noexcept
KOKKOS_FUNCTION constexpr SparseDiscreteDomain take_last(discrete_vector_type) const
KOKKOS_FUNCTION constexpr operator bool()
KOKKOS_DEFAULTED_FUNCTION SparseDiscreteDomain & operator=(SparseDiscreteDomain const &x)=default
KOKKOS_DEFAULTED_FUNCTION SparseDiscreteDomain & operator=(SparseDiscreteDomain &&x)=default
KOKKOS_FUNCTION constexpr SparseDiscreteDomain remove_first(discrete_vector_type) const
KOKKOS_DEFAULTED_FUNCTION SparseDiscreteDomain(SparseDiscreteDomain const &x)=default
KOKKOS_DEFAULTED_FUNCTION ~SparseDiscreteDomain()=default
static KOKKOS_FUNCTION constexpr discrete_element_type front() noexcept
KOKKOS_FUNCTION constexpr SparseDiscreteDomain(SparseDiscreteDomain< ODDims... > const &)
static KOKKOS_FUNCTION constexpr discrete_vector_type extents() noexcept
KOKKOS_DEFAULTED_FUNCTION SparseDiscreteDomain(SparseDiscreteDomain &&x)=default
KOKKOS_FUNCTION constexpr bool operator==(SparseDiscreteDomain< ODDims... > const &other) const
KOKKOS_FUNCTION constexpr discrete_element_type back() const noexcept
KOKKOS_FUNCTION constexpr SparseDiscreteDomain remove_first(discrete_vector_type n) const
static KOKKOS_FUNCTION constexpr std::size_t rank()
KOKKOS_DEFAULTED_FUNCTION SparseDiscreteDomain & operator=(SparseDiscreteDomain const &x)=default
KOKKOS_FUNCTION constexpr SparseDiscreteDomain take_last(discrete_vector_type n) const
KOKKOS_FUNCTION DiscreteVector< DDims... > distance_from_front(DElems const &... delems) const noexcept
KOKKOS_FUNCTION constexpr auto discrete_elements() const noexcept
KOKKOS_FUNCTION constexpr SparseDiscreteDomain remove(discrete_vector_type n1, discrete_vector_type n2) const
KOKKOS_FUNCTION constexpr decltype(auto) operator[](std::size_t n) const
SparseDiscreteDomain(Kokkos::View< DiscreteElement< DDims > *, Kokkos::SharedSpace > const &... views)
Construct a SparseDiscreteDomain with Kokkos::View explicitly listing the discrete elements.
KOKKOS_DEFAULTED_FUNCTION SparseDiscreteDomain & operator=(SparseDiscreteDomain &&x)=default
KOKKOS_FUNCTION constexpr std::size_t size() const
KOKKOS_FUNCTION bool contains(DElems const &... delems) const noexcept
KOKKOS_FUNCTION constexpr decltype(auto) operator[](std::size_t n)
KOKKOS_FUNCTION constexpr SparseDiscreteDomain take_first(discrete_vector_type n) const
KOKKOS_DEFAULTED_FUNCTION SparseDiscreteDomain()=default
KOKKOS_DEFAULTED_FUNCTION SparseDiscreteDomain(SparseDiscreteDomain &&x)=default
KOKKOS_FUNCTION constexpr discrete_element_type front() const noexcept
KOKKOS_FUNCTION constexpr operator bool()
KOKKOS_FUNCTION constexpr bool empty() const noexcept
KOKKOS_FUNCTION constexpr SparseDiscreteDomain(DDoms const &... domains)
Construct a SparseDiscreteDomain by copies and merge of domains.
KOKKOS_FUNCTION constexpr DiscreteElement< DDims... > operator()(DiscreteVector< DDims... > const &dvect) const noexcept
KOKKOS_DEFAULTED_FUNCTION SparseDiscreteDomain(SparseDiscreteDomain const &x)=default
KOKKOS_FUNCTION constexpr SparseDiscreteDomain remove_last(discrete_vector_type n) const
KOKKOS_FUNCTION constexpr discrete_vector_type extents() const noexcept
KOKKOS_FUNCTION constexpr DiscreteVector< QueryDDim > extent() const noexcept
KOKKOS_DEFAULTED_FUNCTION ~SparseDiscreteDomain()=default
static KOKKOS_FUNCTION DiscreteVector distance_from_front() noexcept
KOKKOS_DEFAULTED_FUNCTION StridedDiscreteDomain & operator=(StridedDiscreteDomain &&x)=default
KOKKOS_FUNCTION constexpr StridedDiscreteDomain take_first(discrete_vector_type) const
static KOKKOS_FUNCTION constexpr std::size_t size()
KOKKOS_FUNCTION constexpr StridedDiscreteDomain(discrete_element_type const &element_begin, discrete_vector_type const &size, discrete_vector_type const &strides)
Construct a StridedDiscreteDomain starting from element_begin with size points.
KOKKOS_FUNCTION constexpr StridedDiscreteDomain remove(discrete_vector_type, discrete_vector_type) const
static KOKKOS_FUNCTION bool contains(DiscreteElement<>) noexcept
static KOKKOS_FUNCTION constexpr discrete_element_type front() noexcept
KOKKOS_FUNCTION constexpr StridedDiscreteDomain take_last(discrete_vector_type) const
static KOKKOS_FUNCTION constexpr discrete_vector_type strides() noexcept
KOKKOS_FUNCTION constexpr bool operator==(StridedDiscreteDomain const &) const
KOKKOS_FUNCTION constexpr StridedDiscreteDomain remove_first(discrete_vector_type) const
static KOKKOS_FUNCTION bool contains() noexcept
KOKKOS_FUNCTION constexpr StridedDiscreteDomain remove_last(discrete_vector_type) const
static KOKKOS_FUNCTION constexpr discrete_vector_type extents() noexcept
static KOKKOS_FUNCTION constexpr std::size_t rank()
KOKKOS_DEFAULTED_FUNCTION StridedDiscreteDomain(StridedDiscreteDomain &&x)=default
static KOKKOS_FUNCTION DiscreteVector distance_from_front(DiscreteElement<>) noexcept
KOKKOS_DEFAULTED_FUNCTION constexpr StridedDiscreteDomain()=default
KOKKOS_FUNCTION constexpr operator bool()
static KOKKOS_FUNCTION constexpr bool empty() noexcept
KOKKOS_DEFAULTED_FUNCTION StridedDiscreteDomain(StridedDiscreteDomain const &x)=default
KOKKOS_FUNCTION constexpr DiscreteElement operator()(DiscreteVector<> const &) const noexcept
static KOKKOS_FUNCTION constexpr discrete_element_type back() noexcept
KOKKOS_FUNCTION constexpr StridedDiscreteDomain(StridedDiscreteDomain< ODDims... > const &)
KOKKOS_DEFAULTED_FUNCTION ~StridedDiscreteDomain()=default
KOKKOS_DEFAULTED_FUNCTION StridedDiscreteDomain & operator=(StridedDiscreteDomain const &x)=default
KOKKOS_DEFAULTED_FUNCTION StridedDiscreteDomain & operator=(StridedDiscreteDomain const &x)=default
KOKKOS_FUNCTION constexpr discrete_vector_type extents() const noexcept
KOKKOS_FUNCTION constexpr operator bool()
KOKKOS_FUNCTION constexpr StridedDiscreteDomain take_first(discrete_vector_type n) const
KOKKOS_FUNCTION constexpr DiscreteVector< QueryDDim > extent() const noexcept
KOKKOS_FUNCTION constexpr discrete_element_type front() const noexcept
KOKKOS_FUNCTION bool contains(DElems const &... delems) const noexcept
KOKKOS_FUNCTION constexpr std::size_t size() const
KOKKOS_FUNCTION DiscreteVector< DDims... > distance_from_front(DElems const &... delems) const noexcept
KOKKOS_DEFAULTED_FUNCTION StridedDiscreteDomain(StridedDiscreteDomain &&x)=default
KOKKOS_FUNCTION constexpr discrete_vector_type strides() const noexcept
KOKKOS_DEFAULTED_FUNCTION StridedDiscreteDomain & operator=(StridedDiscreteDomain &&x)=default
KOKKOS_FUNCTION constexpr StridedDiscreteDomain remove(discrete_vector_type n1, discrete_vector_type n2) const
KOKKOS_FUNCTION constexpr StridedDiscreteDomain remove_first(discrete_vector_type n) const
KOKKOS_FUNCTION constexpr discrete_element_type back() const noexcept
KOKKOS_DEFAULTED_FUNCTION StridedDiscreteDomain()=default
KOKKOS_FUNCTION constexpr DiscreteElement< DDims... > operator()(DiscreteVector< DDims... > const &dvect) const noexcept
KOKKOS_FUNCTION constexpr decltype(auto) operator[](std::size_t n)
KOKKOS_FUNCTION constexpr bool operator==(StridedDiscreteDomain< ODDims... > const &other) const
KOKKOS_FUNCTION constexpr StridedDiscreteDomain remove_last(discrete_vector_type n) const
KOKKOS_FUNCTION constexpr StridedDiscreteDomain take_last(discrete_vector_type n) const
KOKKOS_DEFAULTED_FUNCTION ~StridedDiscreteDomain()=default
KOKKOS_FUNCTION constexpr decltype(auto) operator[](std::size_t n) const
KOKKOS_DEFAULTED_FUNCTION StridedDiscreteDomain(StridedDiscreteDomain const &x)=default
static KOKKOS_FUNCTION constexpr std::size_t rank()
KOKKOS_FUNCTION constexpr StridedDiscreteDomain(DDoms const &... domains)
Construct a StridedDiscreteDomain by copies and merge of domains.
KOKKOS_FUNCTION constexpr bool empty() const noexcept
KOKKOS_FUNCTION constexpr StridedDiscreteDomain(discrete_element_type const &element_begin, discrete_vector_type const &extents, discrete_vector_type const &strides)
Construct a StridedDiscreteDomain starting from element_begin with size points.
The top-level namespace of DDC.
constexpr bool is_non_uniform_point_sampling_v
KOKKOS_FUNCTION constexpr DiscreteElement< QueryDDims... > back(SparseDiscreteDomain< DDims... > const &domain) noexcept
KOKKOS_FUNCTION constexpr DiscreteElement< QueryDDims... > front(StridedDiscreteDomain< DDims... > const &domain) noexcept
KOKKOS_FUNCTION Coordinate< typename DDim::continuous_dimension_type > rlength(DiscreteDomain< DDim > const &d)
bool is_discrete_space_initialized() noexcept
KOKKOS_FUNCTION Coordinate< typename DDim::continuous_dimension_type > coordinate(DiscreteElement< DDim > const &c)
KOKKOS_FUNCTION Coordinate< typename DDim::continuous_dimension_type > distance_at_left(DiscreteElement< DDim > i)
KOKKOS_FUNCTION Coordinate< typename DDim::continuous_dimension_type > origin() noexcept
Lower bound index of the mesh.
KOKKOS_FUNCTION constexpr SparseDiscreteDomain< QueryDDims... > select(SparseDiscreteDomain< DDims... > const &domain)
KOKKOS_FUNCTION constexpr DiscreteVector< QueryDDims... > extents(StridedDiscreteDomain< DDims... > const &domain) noexcept
KOKKOS_FUNCTION Coordinate< typename DDim::continuous_dimension_type > rmin(DiscreteDomain< DDim > const &d)
KOKKOS_FUNCTION constexpr DiscreteElement< QueryDDims... > back(StridedDiscreteDomain< DDims... > const &domain) noexcept
KOKKOS_FUNCTION constexpr StridedDiscreteDomain< QueryDDims... > select(StridedDiscreteDomain< DDims... > const &domain)
KOKKOS_FUNCTION constexpr auto remove_dims_of(StridedDiscreteDomain< DDimsA... > const &DDom_a) noexcept
Remove the dimensions DDimsB from DDom_a.
KOKKOS_FUNCTION Coordinate< typename DDim::continuous_dimension_type > distance_at_right(DiscreteElement< DDim > i)
void init_discrete_space(Args &&... args)
Initialize (emplace) a global singleton discrete space.
KOKKOS_FUNCTION constexpr auto remove_dims_of(StridedDiscreteDomain< DDimsA... > const &DDom_a, StridedDiscreteDomain< DDimsB... > const &) noexcept
KOKKOS_FUNCTION constexpr auto remove_dims_of(SparseDiscreteDomain< DDimsA... > const &DDom_a, SparseDiscreteDomain< DDimsB... > const &) noexcept
detail::ddim_impl_t< DDim, Kokkos::HostSpace > const & host_discrete_space()
KOKKOS_FUNCTION constexpr DiscreteVector< QueryDDims... > extents(SparseDiscreteDomain< DDims... > const &domain) noexcept
KOKKOS_FUNCTION constexpr auto replace_dim_of(SparseDiscreteDomain< DDimsA... > const &DDom_a, SparseDiscreteDomain< DDimsB... > const &DDom_b) noexcept
KOKKOS_FUNCTION constexpr DiscreteElement< QueryDDims... > front(SparseDiscreteDomain< DDims... > const &domain) noexcept
constexpr bool is_strided_discrete_domain_v
KOKKOS_FUNCTION DiscreteVector< ODDims... > prod(DiscreteVector< ODDims... > const &lhs, DiscreteVector< ODDims... > const &rhs) noexcept
constexpr bool is_periodic_sampling_v
KOKKOS_FUNCTION Real step() noexcept
Spacing step of the mesh.
KOKKOS_FUNCTION constexpr auto replace_dim_of(StridedDiscreteDomain< DDimsA... > const &DDom_a, StridedDiscreteDomain< DDimsB... > const &DDom_b) noexcept
constexpr bool is_sparse_discrete_domain_v
KOKKOS_FUNCTION constexpr auto remove_dims_of(SparseDiscreteDomain< DDimsA... > const &DDom_a) noexcept
Remove the dimensions DDimsB from DDom_a.
KOKKOS_FUNCTION DiscreteElement< DDim > front() noexcept
Lower bound index of the mesh.
KOKKOS_FUNCTION detail::ddim_impl_t< DDim, MemorySpace > const & discrete_space()
Arg0 init_discrete_space(std::tuple< DDimImpl, Arg0 > &&a)
Move construct a global singleton discrete space and pass through the other argument.
std::tuple< Arg0, Arg1, Args... > init_discrete_space(std::tuple< DDimImpl, Arg0, Arg1, Args... > &&a)
Move construct a global singleton discrete space and pass through remaining arguments.
KOKKOS_FUNCTION Coordinate< typename DDim::continuous_dimension_type > rmax(DiscreteDomain< DDim > const &d)
A compile-time sequence of types.
Definition type_seq.hpp:30
friend KOKKOS_FUNCTION constexpr StridedDiscreteDomainIterator operator-(StridedDiscreteDomainIterator i, difference_type n)
KOKKOS_FUNCTION constexpr DiscreteElement< DDim > operator*() const noexcept
KOKKOS_FUNCTION constexpr StridedDiscreteDomainIterator & operator++()
friend KOKKOS_FUNCTION constexpr StridedDiscreteDomainIterator operator+(difference_type n, StridedDiscreteDomainIterator i)
KOKKOS_FUNCTION constexpr StridedDiscreteDomainIterator & operator-=(difference_type n)
KOKKOS_FUNCTION constexpr StridedDiscreteDomainIterator operator++(int)
friend KOKKOS_FUNCTION constexpr bool operator<(StridedDiscreteDomainIterator const &xx, StridedDiscreteDomainIterator const &yy)
KOKKOS_DEFAULTED_FUNCTION StridedDiscreteDomainIterator()=default
KOKKOS_FUNCTION constexpr StridedDiscreteDomainIterator operator--(int)
friend KOKKOS_FUNCTION constexpr bool operator==(StridedDiscreteDomainIterator const &xx, StridedDiscreteDomainIterator const &yy)
KOKKOS_FUNCTION constexpr StridedDiscreteDomainIterator(DiscreteElement< DDim > value, DiscreteVector< DDim > stride)
KOKKOS_FUNCTION constexpr StridedDiscreteDomainIterator & operator+=(difference_type n)
KOKKOS_FUNCTION constexpr DiscreteElement< DDim > operator[](difference_type n) const
friend KOKKOS_FUNCTION constexpr difference_type operator-(StridedDiscreteDomainIterator const &xx, StridedDiscreteDomainIterator const &yy)
KOKKOS_FUNCTION constexpr StridedDiscreteDomainIterator & operator--()
friend KOKKOS_FUNCTION constexpr bool operator>=(StridedDiscreteDomainIterator const &xx, StridedDiscreteDomainIterator const &yy)
friend KOKKOS_FUNCTION constexpr StridedDiscreteDomainIterator operator+(StridedDiscreteDomainIterator i, difference_type n)
friend KOKKOS_FUNCTION constexpr bool operator>(StridedDiscreteDomainIterator const &xx, StridedDiscreteDomainIterator const &yy)
friend KOKKOS_FUNCTION constexpr bool operator!=(StridedDiscreteDomainIterator const &xx, StridedDiscreteDomainIterator const &yy)
friend KOKKOS_FUNCTION constexpr bool operator<=(StridedDiscreteDomainIterator const &xx, StridedDiscreteDomainIterator const &yy)