DDC 0.9.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 <cstddef>
8#include <iterator>
9#include <tuple>
10#include <type_traits>
11
12#include <Kokkos_Core.hpp>
13#include <Kokkos_StdAlgorithms.hpp>
14
15#include "detail/kokkos.hpp"
16#include "detail/tagged_vector.hpp"
17#include "detail/type_seq.hpp"
18
19#include "discrete_element.hpp"
20#include "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, T const& 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, T const& 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
125 static_assert(
126 type_seq_is_unique_v<detail::TypeSeq<DDims...>>,
127 "The dimensions of a SparseDiscreteDomain must be unique");
128
129public:
130 using discrete_element_type = DiscreteElement<DDims...>;
131
132 using discrete_vector_type = DiscreteVector<DDims...>;
133
134private:
135 detail::TaggedVector<Kokkos::View<DiscreteElementType*, Kokkos::SharedSpace>, DDims...> m_views;
136
137public:
138 static KOKKOS_FUNCTION constexpr std::size_t rank()
139 {
140 return sizeof...(DDims);
141 }
142
144
145 /// Construct a SparseDiscreteDomain by copies and merge of domains
146 template <class... DDoms, class = std::enable_if_t<(is_sparse_discrete_domain_v<DDoms> && ...)>>
147 KOKKOS_FUNCTION constexpr explicit SparseDiscreteDomain(DDoms const&... domains)
148 : m_views(domains.m_views...)
149 {
150 }
151
152 /** Construct a SparseDiscreteDomain with Kokkos::View explicitly listing the discrete elements.
153 * @param views list of Kokkos::View
154 */
155 explicit SparseDiscreteDomain(
156 Kokkos::View<DiscreteElement<DDims>*, Kokkos::SharedSpace> const&... views)
157 {
158 ((m_views[type_seq_rank_v<DDims, detail::TypeSeq<DDims...>>]
159 = Kokkos::View<DiscreteElementType*, Kokkos::SharedSpace>(views.label(), views.size())),
160 ...);
161 Kokkos::DefaultExecutionSpace const execution_space;
162 ((Kokkos::Experimental::transform(
163 "SparseDiscreteDomainCtor",
164 execution_space,
165 views,
166 m_views[type_seq_rank_v<DDims, detail::TypeSeq<DDims...>>],
167 detail::GetUidFn<DDims>())),
168 ...);
169 execution_space.fence("SparseDiscreteDomainCtor");
170 }
171
173
175
177
179 = default;
180
182
183 template <class... ODims>
184 KOKKOS_FUNCTION constexpr bool operator==(SparseDiscreteDomain<ODims...> const& other) const
185 {
186 if (empty() && other.empty()) {
187 return true;
188 }
189 if (m_views.size() != other.m_views.size()) {
190 return false;
191 }
192 for (std::size_t i = 0; i < m_views.size(); ++i) {
193 if (m_views[i].size() != other.m_views[i].size()) {
194 return false;
195 }
196 if (!detail::
197 equal(m_views[i].data(),
198 m_views[i].data() + m_views[i].size(),
199 other.m_views[i].data())) {
200 return false;
201 }
202 }
203 return true;
204 }
205
206#if !defined(__cpp_impl_three_way_comparison) || __cpp_impl_three_way_comparison < 201902L
207 // In C++20, `a!=b` shall be automatically translated by the compiler to `!(a==b)`
208 template <class... ODims>
209 KOKKOS_FUNCTION constexpr bool operator!=(SparseDiscreteDomain<ODims...> const& other) const
210 {
211 return !(*this == other);
212 }
213#endif
214
215 KOKKOS_FUNCTION constexpr std::size_t size() const
216 {
217 return (1UL * ... * get<DDims>(m_views).size());
218 }
219
220 KOKKOS_FUNCTION constexpr discrete_vector_type extents() const noexcept
221 {
222 return discrete_vector_type(get<DDims>(m_views).size()...);
223 }
224
225 KOKKOS_FUNCTION constexpr auto discrete_elements() const noexcept
226 {
227 return m_views;
228 }
229
230 template <class QueryDDim>
231 KOKKOS_FUNCTION constexpr DiscreteVector<QueryDDim> extent() const noexcept
232 {
233 return DiscreteVector<QueryDDim>(get<QueryDDim>(m_views).size());
234 }
235
236 KOKKOS_FUNCTION constexpr discrete_element_type front() const noexcept
237 {
238 return discrete_element_type(get<DDims>(m_views)(0)...);
239 }
240
241 KOKKOS_FUNCTION constexpr discrete_element_type back() const noexcept
242 {
243 return discrete_element_type(get<DDims>(m_views)(get<DDims>(m_views).size() - 1)...);
244 }
245
246 KOKKOS_FUNCTION constexpr SparseDiscreteDomain take_first(discrete_vector_type n) const
247 {
248 return SparseDiscreteDomain(front(), n);
249 }
250
251 KOKKOS_FUNCTION constexpr SparseDiscreteDomain take_last(discrete_vector_type n) const
252 {
253 return SparseDiscreteDomain(front() + prod(extents() - n), n);
254 }
255
256 KOKKOS_FUNCTION constexpr SparseDiscreteDomain remove_first(discrete_vector_type n) const
257 {
258 return SparseDiscreteDomain(front() + prod(n), extents() - n);
259 }
260
261 KOKKOS_FUNCTION constexpr SparseDiscreteDomain remove_last(discrete_vector_type n) const
262 {
264 }
265
267 discrete_vector_type n1,
268 discrete_vector_type n2) const
269 {
270 return SparseDiscreteDomain(front() + prod(n1), extents() - n1 - n2);
271 }
272
273 KOKKOS_FUNCTION constexpr DiscreteElement<DDims...> operator()(
274 DiscreteVector<DDims...> const& dvect) const noexcept
275 {
276 return m_views(get<DDims>(dvect)...);
277 }
278
279 template <class... DElems>
280 KOKKOS_FUNCTION bool contains(DElems const&... delems) const noexcept
281 {
282 static_assert(
283 sizeof...(DDims) == (0 + ... + DElems::size()),
284 "Invalid number of dimensions");
285 static_assert((is_discrete_element_v<DElems> && ...), "Expected DiscreteElements");
286 return (detail::binary_search(
287 get<DDims>(m_views).data(),
288 get<DDims>(m_views).data() + get<DDims>(m_views).size(),
289 uid<DDims>(take<DDims>(delems...)),
290 std::less {})
291 && ...);
292 }
293
294 template <class... DElems>
296 DElems const&... delems) const noexcept
297 {
298 static_assert(
299 sizeof...(DDims) == (0 + ... + DElems::size()),
300 "Invalid number of dimensions");
301 static_assert((is_discrete_element_v<DElems> && ...), "Expected DiscreteElements");
302 KOKKOS_ASSERT((contains(delems...)))
303 return DiscreteVector<DDims...>(
304 (detail::lower_bound(
305 get<DDims>(m_views).data(),
306 get<DDims>(m_views).data() + get<DDims>(m_views).size(),
307 uid<DDims>(take<DDims>(delems...)),
308 std::less {})
309 - get<DDims>(m_views).data())...);
310 }
311
312 KOKKOS_FUNCTION constexpr bool empty() const noexcept
313 {
314 return size() == 0;
315 }
316
317 KOKKOS_FUNCTION constexpr explicit operator bool()
318 {
319 return !empty();
320 }
321
322 template <
323 std::size_t N = sizeof...(DDims),
324 class DDim0 = std::enable_if_t<N == 1, std::tuple_element_t<0, std::tuple<DDims...>>>>
325 KOKKOS_FUNCTION auto begin() const
326 {
327 return Kokkos::Experimental::begin(get<DDim0>(m_views));
328 }
329
330 template <
331 std::size_t N = sizeof...(DDims),
332 class DDim0 = std::enable_if_t<N == 1, std::tuple_element_t<0, std::tuple<DDims...>>>>
333 KOKKOS_FUNCTION auto end() const
334 {
335 return Kokkos::Experimental::end(get<DDim0>(m_views));
336 }
337
338 template <
339 std::size_t N = sizeof...(DDims),
340 class DDim0 = std::enable_if_t<N == 1, std::tuple_element_t<0, std::tuple<DDims...>>>>
341 KOKKOS_FUNCTION auto cbegin() const
342 {
343 return Kokkos::Experimental::cbegin(get<DDim0>(m_views));
344 }
345
346 template <
347 std::size_t N = sizeof...(DDims),
348 class DDim0 = std::enable_if_t<N == 1, std::tuple_element_t<0, std::tuple<DDims...>>>>
349 KOKKOS_FUNCTION auto cend() const
350 {
351 return Kokkos::Experimental::cend(get<DDim0>(m_views));
352 }
353
354 template <
355 std::size_t N = sizeof...(DDims),
356 class = std::enable_if_t<N == 1, std::tuple_element_t<0, std::tuple<DDims...>>>>
357 KOKKOS_FUNCTION constexpr decltype(auto) operator[](std::size_t n)
358 {
359 return begin()[n];
360 }
361
362 template <
363 std::size_t N = sizeof...(DDims),
364 class = std::enable_if_t<N == 1, std::tuple_element_t<0, std::tuple<DDims...>>>>
365 KOKKOS_FUNCTION constexpr decltype(auto) operator[](std::size_t n) const
366 {
367 return begin()[n];
368 }
369};
370
371template <>
373{
374 template <class...>
375 friend class SparseDiscreteDomain;
376
377public:
378 using discrete_element_type = DiscreteElement<>;
379
380 using discrete_vector_type = DiscreteVector<>;
381
382 static KOKKOS_FUNCTION constexpr std::size_t rank()
383 {
384 return 0;
385 }
386
388
389 // Construct a SparseDiscreteDomain from a reordered copy of `domain`
390 template <class... ODDims>
391 KOKKOS_FUNCTION constexpr explicit SparseDiscreteDomain(
392 [[maybe_unused]] SparseDiscreteDomain<ODDims...> const& domain)
393 {
394 }
395
397
399
401
403 = default;
404
406
407 KOKKOS_FUNCTION constexpr bool operator==(
408 [[maybe_unused]] SparseDiscreteDomain const& other) const
409 {
410 return true;
411 }
412
413#if !defined(__cpp_impl_three_way_comparison) || __cpp_impl_three_way_comparison < 201902L
414 // In C++20, `a!=b` shall be automatically translated by the compiler to `!(a==b)`
415 KOKKOS_FUNCTION constexpr bool operator!=(SparseDiscreteDomain const& other) const
416 {
417 return !(*this == other);
418 }
419#endif
420
421 static KOKKOS_FUNCTION constexpr std::size_t size()
422 {
423 return 1;
424 }
425
426 static KOKKOS_FUNCTION constexpr discrete_vector_type extents() noexcept
427 {
428 return {};
429 }
430
431 static KOKKOS_FUNCTION constexpr discrete_element_type front() noexcept
432 {
433 return {};
434 }
435
436 static KOKKOS_FUNCTION constexpr discrete_element_type back() noexcept
437 {
438 return {};
439 }
440
442 [[maybe_unused]] discrete_vector_type n) const
443 {
444 return *this;
445 }
446
448 [[maybe_unused]] discrete_vector_type n) const
449 {
450 return *this;
451 }
452
454 [[maybe_unused]] discrete_vector_type n) const
455 {
456 return *this;
457 }
458
460 [[maybe_unused]] discrete_vector_type n) const
461 {
462 return *this;
463 }
464
466 [[maybe_unused]] discrete_vector_type n1,
467 [[maybe_unused]] discrete_vector_type n2) const
468 {
469 return *this;
470 }
471
472 KOKKOS_FUNCTION constexpr DiscreteElement<> operator()(
473 DiscreteVector<> const& /* dvect */) const noexcept
474 {
475 return {};
476 }
477
478 static KOKKOS_FUNCTION bool contains() noexcept
479 {
480 return true;
481 }
482
483 static KOKKOS_FUNCTION bool contains(DiscreteElement<>) noexcept
484 {
485 return true;
486 }
487
489 {
490 return {};
491 }
492
493 static KOKKOS_FUNCTION DiscreteVector<> distance_from_front(DiscreteElement<>) noexcept
494 {
495 return {};
496 }
497
498 static KOKKOS_FUNCTION constexpr bool empty() noexcept
499 {
500 return false;
501 }
502
503 KOKKOS_FUNCTION constexpr explicit operator bool()
504 {
505 return true;
506 }
507};
508
509template <class... QueryDDims, class... DDims>
510KOKKOS_FUNCTION constexpr SparseDiscreteDomain<QueryDDims...> select(
511 SparseDiscreteDomain<DDims...> const& domain)
512{
513 return SparseDiscreteDomain<QueryDDims...>(
514 DiscreteElement<QueryDDims...>(domain.front()),
515 DiscreteElement<QueryDDims...>(domain.extents()));
516}
517
518namespace detail {
519
520template <class T>
521struct ConvertTypeSeqToSparseDiscreteDomain;
522
523template <class... DDims>
524struct ConvertTypeSeqToSparseDiscreteDomain<detail::TypeSeq<DDims...>>
525{
526 using type = SparseDiscreteDomain<DDims...>;
527};
528
529template <class T>
530using convert_type_seq_to_sparse_discrete_domain_t =
531 typename ConvertTypeSeqToSparseDiscreteDomain<T>::type;
532
533} // namespace detail
534
535// 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)
536template <class... DDimsA, class... DDimsB>
537KOKKOS_FUNCTION constexpr auto remove_dims_of(
538 SparseDiscreteDomain<DDimsA...> const& DDom_a,
539 [[maybe_unused]] SparseDiscreteDomain<DDimsB...> const& DDom_b) noexcept
540{
541 using TagSeqA = detail::TypeSeq<DDimsA...>;
542 using TagSeqB = detail::TypeSeq<DDimsB...>;
543
544 using type_seq_r = type_seq_remove_t<TagSeqA, TagSeqB>;
545 return detail::convert_type_seq_to_sparse_discrete_domain_t<type_seq_r>(DDom_a);
546}
547
548//! Remove the dimensions DDimsB from DDom_a
549//! @param[in] DDom_a The discrete domain on which to remove dimensions
550//! @return The discrete domain without DDimsB dimensions
551template <class... DDimsB, class... DDimsA>
552KOKKOS_FUNCTION constexpr auto remove_dims_of(
553 SparseDiscreteDomain<DDimsA...> const& DDom_a) noexcept
554{
555 using TagSeqA = detail::TypeSeq<DDimsA...>;
556 using TagSeqB = detail::TypeSeq<DDimsB...>;
557
558 using type_seq_r = type_seq_remove_t<TagSeqA, TagSeqB>;
559 return detail::convert_type_seq_to_sparse_discrete_domain_t<type_seq_r>(DDom_a);
560}
561
562namespace detail {
563
564// 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
565template <typename DDim1, typename DDim2, typename DDimA, typename... DDimsB>
566KOKKOS_FUNCTION constexpr std::conditional_t<
567 std::is_same_v<DDimA, DDim1>,
570replace_dim_of_1d(
571 SparseDiscreteDomain<DDimA> const& DDom_a,
572 [[maybe_unused]] SparseDiscreteDomain<DDimsB...> const& DDom_b) noexcept
573{
574 if constexpr (std::is_same_v<DDimA, DDim1>) {
575 return ddc::SparseDiscreteDomain<DDim2>(DDom_b);
576 } else {
577 return DDom_a;
578 }
579}
580
581} // namespace detail
582
583// Replace in DDom_a the dimension Dim1 by the dimension Dim2 of DDom_b
584template <typename DDim1, typename DDim2, typename... DDimsA, typename... DDimsB>
585KOKKOS_FUNCTION constexpr auto replace_dim_of(
586 SparseDiscreteDomain<DDimsA...> const& DDom_a,
587 [[maybe_unused]] SparseDiscreteDomain<DDimsB...> const& DDom_b) noexcept
588{
589 // TODO : static_asserts
590 using TagSeqA = detail::TypeSeq<DDimsA...>;
591 using TagSeqB = detail::TypeSeq<DDim1>;
592 using TagSeqC = detail::TypeSeq<DDim2>;
593
594 using type_seq_r = ddc::type_seq_replace_t<TagSeqA, TagSeqB, TagSeqC>;
595 return ddc::detail::convert_type_seq_to_sparse_discrete_domain_t<type_seq_r>(
596 detail::replace_dim_of_1d<
597 DDim1,
598 DDim2,
599 DDimsA,
600 DDimsB...>(ddc::SparseDiscreteDomain<DDimsA>(DDom_a), DDom_b)...);
601}
602
603template <class... QueryDDims, class... DDims>
604KOKKOS_FUNCTION constexpr DiscreteVector<QueryDDims...> extents(
605 SparseDiscreteDomain<DDims...> const& domain) noexcept
606{
607 return DiscreteVector<QueryDDims...>(SparseDiscreteDomain<QueryDDims>(domain).size()...);
608}
609
610template <class... QueryDDims, class... DDims>
611KOKKOS_FUNCTION constexpr DiscreteElement<QueryDDims...> front(
612 SparseDiscreteDomain<DDims...> const& domain) noexcept
613{
614 return DiscreteElement<QueryDDims...>(SparseDiscreteDomain<QueryDDims>(domain).front()...);
615}
616
617template <class... QueryDDims, class... DDims>
618KOKKOS_FUNCTION constexpr DiscreteElement<QueryDDims...> back(
619 SparseDiscreteDomain<DDims...> const& domain) noexcept
620{
621 return DiscreteElement<QueryDDims...>(SparseDiscreteDomain<QueryDDims>(domain).back()...);
622}
623
624} // 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