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