DDC 0.6.0
Loading...
Searching...
No Matches
sparse_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_Core.hpp>
14#include <Kokkos_StdAlgorithms.hpp>
15
16#include "ddc/detail/kokkos.hpp"
17#include "ddc/detail/tagged_vector.hpp"
18#include "ddc/detail/type_seq.hpp"
19#include "ddc/discrete_element.hpp"
20#include "ddc/discrete_vector.hpp"
21
22namespace ddc {
23
24template <class DDim>
25struct SparseDiscreteDomainIterator;
26
27template <class... DDims>
29
30template <class T>
31struct is_sparse_discrete_domain : std::false_type
32{
33};
34
35template <class... Tags>
36struct is_sparse_discrete_domain<SparseDiscreteDomain<Tags...>> : std::true_type
37{
38};
39
40template <class T>
42
43
44namespace detail {
45
46template <class... Tags>
47struct ToTypeSeq<SparseDiscreteDomain<Tags...>>
48{
49 using type = TypeSeq<Tags...>;
50};
51
52template <class T, class U>
53struct RebindDomain;
54
55template <class... DDims, class... ODDims>
56struct RebindDomain<SparseDiscreteDomain<DDims...>, detail::TypeSeq<ODDims...>>
57{
58 using type = SparseDiscreteDomain<ODDims...>;
59};
60
61template <class InputIt1, class InputIt2>
62KOKKOS_FUNCTION bool equal(InputIt1 first1, InputIt1 last1, InputIt2 first2)
63{
64 for (; first1 != last1; ++first1, ++first2) {
65 if (!(*first1 == *first2)) {
66 return false;
67 }
68 }
69
70 return true;
71}
72
73template <
74 class ForwardIt,
75 class T = typename std::iterator_traits<ForwardIt>::value_type,
76 class Compare>
77KOKKOS_FUNCTION ForwardIt lower_bound(ForwardIt first, ForwardIt last, const T& value, Compare comp)
78{
79 ForwardIt it;
80 typename std::iterator_traits<ForwardIt>::difference_type count = last - first;
81 while (count > 0) {
82 it = first;
83 typename std::iterator_traits<ForwardIt>::difference_type const step = count / 2;
84 it += step;
85
86 if (comp(*it, value)) {
87 first = ++it;
88 count -= step + 1;
89 } else {
90 count = step;
91 }
92 }
93
94 return first;
95}
96
97template <
98 class ForwardIt,
99 class T = typename std::iterator_traits<ForwardIt>::value_type,
100 class Compare>
101KOKKOS_FUNCTION bool binary_search(ForwardIt first, ForwardIt last, const T& value, Compare comp)
102{
103 first = ::ddc::detail::lower_bound(first, last, value, comp);
104 return (!(first == last) && !(comp(value, *first)));
105}
106
107template <class DDim>
108struct GetUidFn
109{
110 KOKKOS_FUNCTION DiscreteElementType
111 operator()(DiscreteElement<DDim> const& delem) const noexcept
112 {
113 return delem.uid();
114 }
115};
116
117} // namespace detail
118
119template <class... DDims>
121{
122 template <class...>
123 friend class SparseDiscreteDomain;
124
125public:
126 using discrete_element_type = DiscreteElement<DDims...>;
127
128 using discrete_vector_type = DiscreteVector<DDims...>;
129
130private:
131 detail::TaggedVector<Kokkos::View<DiscreteElementType*, Kokkos::SharedSpace>, DDims...> m_views;
132
133public:
134 static KOKKOS_FUNCTION constexpr std::size_t rank()
135 {
136 return sizeof...(DDims);
137 }
138
140
141 /// Construct a SparseDiscreteDomain by copies and merge of domains
142 template <class... DDoms, class = std::enable_if_t<(is_sparse_discrete_domain_v<DDoms> && ...)>>
143 KOKKOS_FUNCTION constexpr explicit SparseDiscreteDomain(DDoms const&... domains)
144 : m_views(domains.m_views...)
145 {
146 }
147
148 /** Construct a SparseDiscreteDomain with Kokkos::View explicitly listing the discrete elements.
149 * @param views list of Kokkos::View
150 */
151 explicit SparseDiscreteDomain(
152 Kokkos::View<DiscreteElement<DDims>*, Kokkos::SharedSpace> const&... views)
153 {
154 ((m_views[type_seq_rank_v<DDims, detail::TypeSeq<DDims...>>]
155 = Kokkos::View<DiscreteElementType*, Kokkos::SharedSpace>(views.label(), views.size())),
156 ...);
157 Kokkos::DefaultExecutionSpace const execution_space;
158 ((Kokkos::Experimental::transform(
159 "SparseDiscreteDomainCtor",
160 execution_space,
161 views,
162 m_views[type_seq_rank_v<DDims, detail::TypeSeq<DDims...>>],
163 detail::GetUidFn<DDims>())),
164 ...);
165 execution_space.fence("SparseDiscreteDomainCtor");
166 }
167
169
171
173
175 = default;
176
178
179 template <class... ODims>
180 KOKKOS_FUNCTION constexpr bool operator==(SparseDiscreteDomain<ODims...> const& other) const
181 {
182 if (empty() && other.empty()) {
183 return true;
184 }
185 if (m_views.size() != other.m_views.size()) {
186 return false;
187 }
188 for (std::size_t i = 0; i < m_views.size(); ++i) {
189 if (m_views[i].size() != other.m_views[i].size()) {
190 return false;
191 }
192 if (!detail::
193 equal(m_views[i].data(),
194 m_views[i].data() + m_views[i].size(),
195 other.m_views[i].data())) {
196 return false;
197 }
198 }
199 return true;
200 }
201
202#if !defined(__cpp_impl_three_way_comparison) || __cpp_impl_three_way_comparison < 201902L
203 // In C++20, `a!=b` shall be automatically translated by the compiler to `!(a==b)`
204 template <class... ODims>
205 KOKKOS_FUNCTION constexpr bool operator!=(SparseDiscreteDomain<ODims...> const& other) const
206 {
207 return !(*this == other);
208 }
209#endif
210
211 KOKKOS_FUNCTION constexpr std::size_t size() const
212 {
213 return (1UL * ... * get<DDims>(m_views).size());
214 }
215
216 KOKKOS_FUNCTION constexpr discrete_vector_type extents() const noexcept
217 {
218 return discrete_vector_type(get<DDims>(m_views).size()...);
219 }
220
221 KOKKOS_FUNCTION constexpr auto discrete_elements() const noexcept
222 {
223 return m_views;
224 }
225
226 template <class QueryDDim>
227 KOKKOS_FUNCTION constexpr DiscreteVector<QueryDDim> extent() const noexcept
228 {
229 return DiscreteVector<QueryDDim>(get<QueryDDim>(m_views).size());
230 }
231
232 KOKKOS_FUNCTION constexpr discrete_element_type front() const noexcept
233 {
234 return discrete_element_type(get<DDims>(m_views)(0)...);
235 }
236
237 KOKKOS_FUNCTION constexpr discrete_element_type back() const noexcept
238 {
239 return discrete_element_type(get<DDims>(m_views)(get<DDims>(m_views).size() - 1)...);
240 }
241
242 KOKKOS_FUNCTION constexpr SparseDiscreteDomain take_first(discrete_vector_type n) const
243 {
244 return SparseDiscreteDomain(front(), n);
245 }
246
247 KOKKOS_FUNCTION constexpr SparseDiscreteDomain take_last(discrete_vector_type n) const
248 {
249 return SparseDiscreteDomain(front() + prod(extents() - n), n);
250 }
251
252 KOKKOS_FUNCTION constexpr SparseDiscreteDomain remove_first(discrete_vector_type n) const
253 {
254 return SparseDiscreteDomain(front() + prod(n), extents() - n);
255 }
256
257 KOKKOS_FUNCTION constexpr SparseDiscreteDomain remove_last(discrete_vector_type n) const
258 {
260 }
261
263 discrete_vector_type n1,
264 discrete_vector_type n2) const
265 {
266 return SparseDiscreteDomain(front() + prod(n1), extents() - n1 - n2);
267 }
268
269 KOKKOS_FUNCTION constexpr DiscreteElement<DDims...> operator()(
270 DiscreteVector<DDims...> const& dvect) const noexcept
271 {
272 return m_views(get<DDims>(dvect)...);
273 }
274
275 template <class... DElems>
276 KOKKOS_FUNCTION bool contains(DElems const&... delems) const noexcept
277 {
278 static_assert(
279 sizeof...(DDims) == (0 + ... + DElems::size()),
280 "Invalid number of dimensions");
281 static_assert((is_discrete_element_v<DElems> && ...), "Expected DiscreteElements");
282 return (detail::binary_search(
283 get<DDims>(m_views).data(),
284 get<DDims>(m_views).data() + get<DDims>(m_views).size(),
285 uid<DDims>(take<DDims>(delems...)),
286 std::less {})
287 && ...);
288 }
289
290 template <class... DElems>
292 DElems const&... delems) const noexcept
293 {
294 static_assert(
295 sizeof...(DDims) == (0 + ... + DElems::size()),
296 "Invalid number of dimensions");
297 static_assert((is_discrete_element_v<DElems> && ...), "Expected DiscreteElements");
298 assert(contains(delems...));
299 return DiscreteVector<DDims...>(
300 (detail::lower_bound(
301 get<DDims>(m_views).data(),
302 get<DDims>(m_views).data() + get<DDims>(m_views).size(),
303 uid<DDims>(take<DDims>(delems...)),
304 std::less {})
305 - get<DDims>(m_views).data())...);
306 }
307
308 KOKKOS_FUNCTION constexpr bool empty() const noexcept
309 {
310 return size() == 0;
311 }
312
313 KOKKOS_FUNCTION constexpr explicit operator bool()
314 {
315 return !empty();
316 }
317
318 template <
319 std::size_t N = sizeof...(DDims),
320 class DDim0 = std::enable_if_t<N == 1, std::tuple_element_t<0, std::tuple<DDims...>>>>
321 KOKKOS_FUNCTION auto begin() const
322 {
323 return Kokkos::Experimental::begin(get<DDim0>(m_views));
324 }
325
326 template <
327 std::size_t N = sizeof...(DDims),
328 class DDim0 = std::enable_if_t<N == 1, std::tuple_element_t<0, std::tuple<DDims...>>>>
329 KOKKOS_FUNCTION auto end() const
330 {
331 return Kokkos::Experimental::end(get<DDim0>(m_views));
332 }
333
334 template <
335 std::size_t N = sizeof...(DDims),
336 class DDim0 = std::enable_if_t<N == 1, std::tuple_element_t<0, std::tuple<DDims...>>>>
337 KOKKOS_FUNCTION auto cbegin() const
338 {
339 return Kokkos::Experimental::cbegin(get<DDim0>(m_views));
340 }
341
342 template <
343 std::size_t N = sizeof...(DDims),
344 class DDim0 = std::enable_if_t<N == 1, std::tuple_element_t<0, std::tuple<DDims...>>>>
345 KOKKOS_FUNCTION auto cend() const
346 {
347 return Kokkos::Experimental::cend(get<DDim0>(m_views));
348 }
349
350 template <
351 std::size_t N = sizeof...(DDims),
352 class = std::enable_if_t<N == 1, std::tuple_element_t<0, std::tuple<DDims...>>>>
353 KOKKOS_FUNCTION constexpr decltype(auto) operator[](std::size_t n)
354 {
355 return begin()[n];
356 }
357
358 template <
359 std::size_t N = sizeof...(DDims),
360 class = std::enable_if_t<N == 1, std::tuple_element_t<0, std::tuple<DDims...>>>>
361 KOKKOS_FUNCTION constexpr decltype(auto) operator[](std::size_t n) const
362 {
363 return begin()[n];
364 }
365};
366
367template <>
369{
370 template <class...>
371 friend class SparseDiscreteDomain;
372
373public:
374 using discrete_element_type = DiscreteElement<>;
375
376 using discrete_vector_type = DiscreteVector<>;
377
378 static KOKKOS_FUNCTION constexpr std::size_t rank()
379 {
380 return 0;
381 }
382
384
385 // Construct a SparseDiscreteDomain from a reordered copy of `domain`
386 template <class... ODDims>
387 KOKKOS_FUNCTION constexpr explicit SparseDiscreteDomain(
388 [[maybe_unused]] SparseDiscreteDomain<ODDims...> const& domain)
389 {
390 }
391
393
395
397
399 = default;
400
402
403 KOKKOS_FUNCTION constexpr bool operator==(
404 [[maybe_unused]] SparseDiscreteDomain const& other) const
405 {
406 return true;
407 }
408
409#if !defined(__cpp_impl_three_way_comparison) || __cpp_impl_three_way_comparison < 201902L
410 // In C++20, `a!=b` shall be automatically translated by the compiler to `!(a==b)`
411 KOKKOS_FUNCTION constexpr bool operator!=(SparseDiscreteDomain const& other) const
412 {
413 return !(*this == other);
414 }
415#endif
416
417 static KOKKOS_FUNCTION constexpr std::size_t size()
418 {
419 return 1;
420 }
421
422 static KOKKOS_FUNCTION constexpr discrete_vector_type extents() noexcept
423 {
424 return {};
425 }
426
427 static KOKKOS_FUNCTION constexpr discrete_element_type front() noexcept
428 {
429 return {};
430 }
431
432 static KOKKOS_FUNCTION constexpr discrete_element_type back() noexcept
433 {
434 return {};
435 }
436
438 [[maybe_unused]] discrete_vector_type n) const
439 {
440 return *this;
441 }
442
444 [[maybe_unused]] discrete_vector_type n) const
445 {
446 return *this;
447 }
448
450 [[maybe_unused]] discrete_vector_type n) const
451 {
452 return *this;
453 }
454
456 [[maybe_unused]] discrete_vector_type n) const
457 {
458 return *this;
459 }
460
462 [[maybe_unused]] discrete_vector_type n1,
463 [[maybe_unused]] discrete_vector_type n2) const
464 {
465 return *this;
466 }
467
468 KOKKOS_FUNCTION constexpr DiscreteElement<> operator()(
469 DiscreteVector<> const& /* dvect */) const noexcept
470 {
471 return {};
472 }
473
474 static KOKKOS_FUNCTION bool contains() noexcept
475 {
476 return true;
477 }
478
479 static KOKKOS_FUNCTION bool contains(DiscreteElement<>) noexcept
480 {
481 return true;
482 }
483
485 {
486 return {};
487 }
488
489 static KOKKOS_FUNCTION DiscreteVector<> distance_from_front(DiscreteElement<>) noexcept
490 {
491 return {};
492 }
493
494 static KOKKOS_FUNCTION constexpr bool empty() noexcept
495 {
496 return false;
497 }
498
499 KOKKOS_FUNCTION constexpr explicit operator bool()
500 {
501 return true;
502 }
503};
504
505template <class... QueryDDims, class... DDims>
506KOKKOS_FUNCTION constexpr SparseDiscreteDomain<QueryDDims...> select(
507 SparseDiscreteDomain<DDims...> const& domain)
508{
509 return SparseDiscreteDomain<QueryDDims...>(
510 DiscreteElement<QueryDDims...>(domain.front()),
511 DiscreteElement<QueryDDims...>(domain.extents()));
512}
513
514namespace detail {
515
516template <class T>
517struct ConvertTypeSeqToSparseDiscreteDomain;
518
519template <class... DDims>
520struct ConvertTypeSeqToSparseDiscreteDomain<detail::TypeSeq<DDims...>>
521{
522 using type = SparseDiscreteDomain<DDims...>;
523};
524
525template <class T>
526using convert_type_seq_to_sparse_discrete_domain_t =
527 typename ConvertTypeSeqToSparseDiscreteDomain<T>::type;
528
529} // namespace detail
530
531// 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)
532template <class... DDimsA, class... DDimsB>
533KOKKOS_FUNCTION constexpr auto remove_dims_of(
534 SparseDiscreteDomain<DDimsA...> const& DDom_a,
535 [[maybe_unused]] SparseDiscreteDomain<DDimsB...> const& DDom_b) noexcept
536{
537 using TagSeqA = detail::TypeSeq<DDimsA...>;
538 using TagSeqB = detail::TypeSeq<DDimsB...>;
539
540 using type_seq_r = type_seq_remove_t<TagSeqA, TagSeqB>;
541 return detail::convert_type_seq_to_sparse_discrete_domain_t<type_seq_r>(DDom_a);
542}
543
544//! Remove the dimensions DDimsB from DDom_a
545//! @param[in] DDom_a The discrete domain on which to remove dimensions
546//! @return The discrete domain without DDimsB dimensions
547template <class... DDimsB, class... DDimsA>
548KOKKOS_FUNCTION constexpr auto remove_dims_of(
549 SparseDiscreteDomain<DDimsA...> const& DDom_a) noexcept
550{
551 using TagSeqA = detail::TypeSeq<DDimsA...>;
552 using TagSeqB = detail::TypeSeq<DDimsB...>;
553
554 using type_seq_r = type_seq_remove_t<TagSeqA, TagSeqB>;
555 return detail::convert_type_seq_to_sparse_discrete_domain_t<type_seq_r>(DDom_a);
556}
557
558namespace detail {
559
560// 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
561template <typename DDim1, typename DDim2, typename DDimA, typename... DDimsB>
562KOKKOS_FUNCTION constexpr std::conditional_t<
563 std::is_same_v<DDimA, DDim1>,
566replace_dim_of_1d(
567 SparseDiscreteDomain<DDimA> const& DDom_a,
568 [[maybe_unused]] SparseDiscreteDomain<DDimsB...> const& DDom_b) noexcept
569{
570 if constexpr (std::is_same_v<DDimA, DDim1>) {
571 return ddc::SparseDiscreteDomain<DDim2>(DDom_b);
572 } else {
573 return DDom_a;
574 }
575}
576
577} // namespace detail
578
579// Replace in DDom_a the dimension Dim1 by the dimension Dim2 of DDom_b
580template <typename DDim1, typename DDim2, typename... DDimsA, typename... DDimsB>
581KOKKOS_FUNCTION constexpr auto replace_dim_of(
582 SparseDiscreteDomain<DDimsA...> const& DDom_a,
583 [[maybe_unused]] SparseDiscreteDomain<DDimsB...> const& DDom_b) noexcept
584{
585 // TODO : static_asserts
586 using TagSeqA = detail::TypeSeq<DDimsA...>;
587 using TagSeqB = detail::TypeSeq<DDim1>;
588 using TagSeqC = detail::TypeSeq<DDim2>;
589
590 using type_seq_r = ddc::type_seq_replace_t<TagSeqA, TagSeqB, TagSeqC>;
591 return ddc::detail::convert_type_seq_to_sparse_discrete_domain_t<type_seq_r>(
592 detail::replace_dim_of_1d<
593 DDim1,
594 DDim2,
595 DDimsA,
596 DDimsB...>(ddc::SparseDiscreteDomain<DDimsA>(DDom_a), DDom_b)...);
597}
598
599template <class... QueryDDims, class... DDims>
600KOKKOS_FUNCTION constexpr DiscreteVector<QueryDDims...> extents(
601 SparseDiscreteDomain<DDims...> const& domain) noexcept
602{
603 return DiscreteVector<QueryDDims...>(SparseDiscreteDomain<QueryDDims>(domain).size()...);
604}
605
606template <class... QueryDDims, class... DDims>
607KOKKOS_FUNCTION constexpr DiscreteElement<QueryDDims...> front(
608 SparseDiscreteDomain<DDims...> const& domain) noexcept
609{
610 return DiscreteElement<QueryDDims...>(SparseDiscreteDomain<QueryDDims>(domain).front()...);
611}
612
613template <class... QueryDDims, class... DDims>
614KOKKOS_FUNCTION constexpr DiscreteElement<QueryDDims...> back(
615 SparseDiscreteDomain<DDims...> const& domain) noexcept
616{
617 return DiscreteElement<QueryDDims...>(SparseDiscreteDomain<QueryDDims>(domain).back()...);
618}
619
620} // namespace ddc
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 constexpr bool operator==(SparseDiscreteDomain const &other) const
static KOKKOS_FUNCTION bool contains(DiscreteElement<>) noexcept
static KOKKOS_FUNCTION constexpr std::size_t rank()
KOKKOS_DEFAULTED_FUNCTION constexpr SparseDiscreteDomain()=default
KOKKOS_FUNCTION constexpr SparseDiscreteDomain(SparseDiscreteDomain< ODDims... > const &domain)
KOKKOS_FUNCTION constexpr DiscreteElement operator()(DiscreteVector<> const &) const noexcept
KOKKOS_FUNCTION constexpr SparseDiscreteDomain take_last(discrete_vector_type n) const
static KOKKOS_FUNCTION DiscreteVector distance_from_front() noexcept
static KOKKOS_FUNCTION constexpr std::size_t size()
static KOKKOS_FUNCTION constexpr bool empty() noexcept
KOKKOS_FUNCTION constexpr SparseDiscreteDomain remove(discrete_vector_type n1, discrete_vector_type n2) const
static KOKKOS_FUNCTION DiscreteVector distance_from_front(DiscreteElement<>) noexcept
KOKKOS_FUNCTION constexpr SparseDiscreteDomain remove_first(discrete_vector_type n) const
static KOKKOS_FUNCTION constexpr discrete_element_type back() noexcept
static KOKKOS_FUNCTION bool contains() noexcept
KOKKOS_FUNCTION constexpr operator bool()
KOKKOS_DEFAULTED_FUNCTION SparseDiscreteDomain & operator=(SparseDiscreteDomain const &x)=default
KOKKOS_DEFAULTED_FUNCTION SparseDiscreteDomain & operator=(SparseDiscreteDomain &&x)=default
KOKKOS_DEFAULTED_FUNCTION SparseDiscreteDomain(SparseDiscreteDomain const &x)=default
KOKKOS_DEFAULTED_FUNCTION ~SparseDiscreteDomain()=default
KOKKOS_FUNCTION constexpr SparseDiscreteDomain take_first(discrete_vector_type n) const
static KOKKOS_FUNCTION constexpr discrete_element_type front() noexcept
static KOKKOS_FUNCTION constexpr discrete_vector_type extents() noexcept
KOKKOS_DEFAULTED_FUNCTION SparseDiscreteDomain(SparseDiscreteDomain &&x)=default
KOKKOS_FUNCTION constexpr SparseDiscreteDomain remove_last(discrete_vector_type n) 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_FUNCTION constexpr decltype(auto) operator[](std::size_t n) const
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 SparseDiscreteDomain(DDoms const &... domains)
Construct a SparseDiscreteDomain by copies and merge of domains.
SparseDiscreteDomain(Kokkos::View< DiscreteElement< DDims > *, Kokkos::SharedSpace > const &... views)
Construct a SparseDiscreteDomain with Kokkos::View explicitly listing the discrete elements.
KOKKOS_FUNCTION auto cbegin() const
KOKKOS_FUNCTION constexpr decltype(auto) operator[](std::size_t n)
KOKKOS_DEFAULTED_FUNCTION SparseDiscreteDomain & operator=(SparseDiscreteDomain &&x)=default
KOKKOS_FUNCTION constexpr std::size_t size() const
KOKKOS_FUNCTION constexpr bool operator==(SparseDiscreteDomain< ODims... > const &other) const
KOKKOS_FUNCTION bool contains(DElems const &... delems) const noexcept
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 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 auto end() const
KOKKOS_FUNCTION auto cend() const
KOKKOS_FUNCTION auto begin() const
KOKKOS_FUNCTION constexpr discrete_vector_type extents() const noexcept
KOKKOS_FUNCTION constexpr DiscreteVector< QueryDDim > extent() const noexcept
KOKKOS_DEFAULTED_FUNCTION ~SparseDiscreteDomain()=default
The top-level namespace of DDC.
KOKKOS_FUNCTION constexpr DiscreteElement< QueryDDims... > back(SparseDiscreteDomain< DDims... > const &domain) noexcept
KOKKOS_FUNCTION constexpr SparseDiscreteDomain< QueryDDims... > select(SparseDiscreteDomain< DDims... > const &domain)
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_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 constexpr auto remove_dims_of(SparseDiscreteDomain< DDimsA... > const &DDom_a, SparseDiscreteDomain< DDimsB... > const &DDom_b) noexcept