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