From b51ef8cdddafd230107c9b342dafc4cc141c89ef Mon Sep 17 00:00:00 2001 From: GitHub CI Documentation builder Date: Wed, 23 Oct 2024 09:29:25 +0000 Subject: [PATCH] Update docs --- dir_a6b7057cb1432410798a61ba57a7ee60.js | 1 + files.html | 3 +- navtreeindex4.js | 2 +- navtreeindex5.js | 2 +- navtreeindex8.js | 9 +- transpose_8hpp_source.html | 104 +++++++++++------ type__seq__tools_8hpp_source.html | 149 ++++++++++++++++++++++++ 7 files changed, 225 insertions(+), 45 deletions(-) create mode 100644 type__seq__tools_8hpp_source.html diff --git a/dir_a6b7057cb1432410798a61ba57a7ee60.js b/dir_a6b7057cb1432410798a61ba57a7ee60.js index ee6016c4c..7183d0920 100644 --- a/dir_a6b7057cb1432410798a61ba57a7ee60.js +++ b/dir_a6b7057cb1432410798a61ba57a7ee60.js @@ -9,5 +9,6 @@ var dir_a6b7057cb1432410798a61ba57a7ee60 = [ "non_uniform_interpolation_points.hpp", "non__uniform__interpolation__points_8hpp_source.html", null ], [ "preprocessor.hpp", "preprocessor_8hpp_source.html", null ], [ "transpose.hpp", "transpose_8hpp_source.html", null ], + [ "type_seq_tools.hpp", "type__seq__tools_8hpp_source.html", null ], [ "utils_tools.hpp", "utils__tools_8hpp.html", "utils__tools_8hpp" ] ]; \ No newline at end of file diff --git a/files.html b/files.html index 69ef2091c..bb165a018 100644 --- a/files.html +++ b/files.html @@ -328,7 +328,8 @@  non_uniform_interpolation_points.hpp  preprocessor.hpp  transpose.hpp - utils_tools.hppFile Describing useful functions + type_seq_tools.hpp + utils_tools.hppFile Describing useful functions   tests   data_types  grid_builder.hpp diff --git a/navtreeindex4.js b/navtreeindex4.js index bea2474da..188b2cb70 100644 --- a/navtreeindex4.js +++ b/navtreeindex4.js @@ -213,8 +213,8 @@ var NAVTREEINDEX4 = "classQNSolver.html#a866ea0a8cd34e7789d8847aaf963fdf2":[16,211,4], "classQNSolver.html#a8e24e91f5ed1c4bb590e93eb4f1f81ba":[16,211,2], "classQNSolver.html#a8e24e91f5ed1c4bb590e93eb4f1f81ba":[16,211,0], -"classQNSolver.html#afbc0b4cd0f70f63c93dc6d8c540a2d9d":[16,211,3], "classQNSolver.html#afbc0b4cd0f70f63c93dc6d8c540a2d9d":[16,211,1], +"classQNSolver.html#afbc0b4cd0f70f63c93dc6d8c540a2d9d":[16,211,3], "classQuadrature.html":[16,212], "classQuadrature.html#a5a7011a414f2f78524042fd2104342f0":[16,212,2], "classQuadrature.html#acc3a757e91e2d185ee290c409156fd4f":[16,212,1], diff --git a/navtreeindex5.js b/navtreeindex5.js index ee98f7970..29216b87f 100644 --- a/navtreeindex5.js +++ b/navtreeindex5.js @@ -26,8 +26,8 @@ var NAVTREEINDEX5 = "classSingleModePerturbInitialization.html#a15387a7189e36d23965cbb2595a8ce8c":[16,222,6], "classSingleModePerturbInitialization.html#a49e29d0f5b2005da7b1b71bafcd63e69":[16,222,2], "classSingleModePerturbInitialization.html#a53ca3f65b528117d31bb9880f07a8fde":[16,222,0], -"classSingleModePerturbInitialization.html#a543dcd83b62baaceb48d54a2cab09e83":[16,222,3], "classSingleModePerturbInitialization.html#a543dcd83b62baaceb48d54a2cab09e83":[16,222,1], +"classSingleModePerturbInitialization.html#a543dcd83b62baaceb48d54a2cab09e83":[16,222,3], "classSingleModePerturbInitialization.html#a61e6fb88a3b58a97d55b07577e5ef1e4":[16,222,4], "classSingleModePerturbInitialization.html#a6fe8be7de3eefd844b3f15e7d50b1707":[16,222,5], "classSingleModePerturbInitialization.html#abcef02302c35de979ca2d34d5f4b5b8f":[16,222,7], diff --git a/navtreeindex8.js b/navtreeindex8.js index fa94156fd..586763c02 100644 --- a/navtreeindex8.js +++ b/navtreeindex8.js @@ -132,12 +132,13 @@ var NAVTREEINDEX8 = "trapezoid__quadrature_8hpp.html#a018d1c83039e9397ba5e4d9dae02dec3":[17,0,16,6,0], "trapezoid__quadrature_8hpp.html#aaa40ccc446046b233d7b0476eb64a8e6":[17,0,16,6,1], "trapezoid__quadrature_8hpp_source.html":[17,0,16,6], +"type__seq__tools_8hpp_source.html":[17,0,19,9], "types_8hpp_source.html":[17,0,13,1,3], "utils__patch__locators_8hpp_source.html":[17,0,13,0,8], -"utils__tools_8hpp.html":[17,0,19,9], -"utils__tools_8hpp.html#a74cd2065291900b963fdc775ae5aec8d":[17,0,19,9,1], -"utils__tools_8hpp.html#a939e3995d29bdb32c073e38494563009":[17,0,19,9,0], -"utils__tools_8hpp_source.html":[17,0,19,9], +"utils__tools_8hpp.html":[17,0,19,10], +"utils__tools_8hpp.html#a74cd2065291900b963fdc775ae5aec8d":[17,0,19,10,1], +"utils__tools_8hpp.html#a939e3995d29bdb32c073e38494563009":[17,0,19,10,0], +"utils__tools_8hpp_source.html":[17,0,19,10], "vector__field_8hpp_source.html":[17,0,2,5], "vector__field__common_8hpp_source.html":[17,0,2,6], "vector__field__mem_8hpp_source.html":[17,0,2,7], diff --git a/transpose_8hpp_source.html b/transpose_8hpp_source.html index 2a0175a1f..263316d5c 100644 --- a/transpose_8hpp_source.html +++ b/transpose_8hpp_source.html @@ -104,46 +104,74 @@
1 // SPDX-License-Identifier: MIT
-
2 
-
3 #pragma once
-
4 
-
20 template <
-
21  class ExecSpace,
-
22  class ElementType,
-
23  class StartDomain,
-
24  class StartLayoutStridedPolicy,
-
25  class MemorySpace,
-
26  class EndDomain,
-
27  class EndLayoutStridedPolicy>
-
28 ddc::ChunkSpan<ElementType, EndDomain, EndLayoutStridedPolicy, MemorySpace> transpose_layout(
-
29  ExecSpace const& execution_space,
-
30  ddc::ChunkSpan<ElementType, EndDomain, EndLayoutStridedPolicy, MemorySpace> end_span,
-
31  ddc::ChunkView<ElementType, StartDomain, StartLayoutStridedPolicy, MemorySpace> start_view)
-
32 {
-
33  static_assert(
-
34  Kokkos::SpaceAccessibility<ExecSpace, MemorySpace>::accessible,
-
35  "MemorySpace has to be accessible for ExecutionSpace.");
-
36  // assert that ddc::DiscreteDomain<Dims...> is a transposed discrete domain by
-
37  // checking that it is a subset of StartDomain and that StartDomain is a subset
-
38  // of it.
-
39  static_assert(ddc::type_seq_contains_v<
-
40  ddc::to_type_seq_t<StartDomain>,
-
41  ddc::to_type_seq_t<EndDomain>>);
+
2 #pragma once
+
3 
+
4 #include "ddc_alias_inline_functions.hpp"
+
5 #include "ddc_aliases.hpp"
+
6 #include "type_seq_tools.hpp"
+
7 
+
23 template <
+
24  class ExecSpace,
+
25  class ElementType,
+
26  class IdxRangeOut,
+
27  class LayoutStridedPolicyIn,
+
28  class MemorySpace,
+
29  class IdxRangeIn,
+
30  class LayoutStridedPolicyOut>
+
31 Field<ElementType, IdxRangeIn, LayoutStridedPolicyOut, MemorySpace> transpose_layout(
+
32  ExecSpace const& execution_space,
+
33  Field<ElementType, IdxRangeIn, LayoutStridedPolicyOut, MemorySpace> transposed_field,
+
34  ConstField<ElementType, IdxRangeOut, LayoutStridedPolicyIn, MemorySpace> field_to_transpose)
+
35 {
+
36  static_assert(
+
37  Kokkos::SpaceAccessibility<ExecSpace, MemorySpace>::accessible,
+
38  "MemorySpace has to be accessible for ExecutionSpace.");
+
39  // assert that IdxRange<Dims...> is a transposed discrete domain by
+
40  // checking that it is a subset of IdxRangeOut and that IdxRangeOut is a subset
+
41  // of it.
42  static_assert(ddc::type_seq_contains_v<
-
43  ddc::to_type_seq_t<EndDomain>,
-
44  ddc::to_type_seq_t<StartDomain>>);
-
45 
-
46  // Check that both views have the same domain (just reordered)
-
47  assert(start_view.domain() == end_span.domain());
+
43  ddc::to_type_seq_t<IdxRangeOut>,
+
44  ddc::to_type_seq_t<IdxRangeIn>>);
+
45  static_assert(ddc::type_seq_contains_v<
+
46  ddc::to_type_seq_t<IdxRangeIn>,
+
47  ddc::to_type_seq_t<IdxRangeOut>>);
48 
-
49  using StartIndex = typename StartDomain::discrete_element_type;
-
50 
-
51  ddc::parallel_for_each(
-
52  execution_space,
-
53  start_view.domain(),
-
54  KOKKOS_LAMBDA(StartIndex idx) { end_span(idx) = start_view(idx); });
-
55  return end_span;
-
56 }
+
49  // Check that both views have the same domain (just reordered)
+
50  assert(get_idx_range(field_to_transpose) == get_idx_range(transposed_field));
+
51 
+
52  IdxRangeOut idx_range(field_to_transpose.domain());
+
53 
+
54  constexpr std::size_t n_dims(ddc::type_seq_size_v<ddc::to_type_seq_t<IdxRangeOut>>);
+
55 
+
56  if constexpr (n_dims < 7) {
+
57  using ToTransposeIndex = typename IdxRangeOut::discrete_element_type;
+
58  ddc::parallel_for_each(
+
59  execution_space,
+
60  idx_range,
+
61  KOKKOS_LAMBDA(ToTransposeIndex idx) {
+
62  transposed_field(idx) = field_to_transpose(idx);
+
63  });
+
64  } else {
+
65  using IdxRangeParallel = ddc::detail::convert_type_seq_to_discrete_domain_t<
+
66  type_seq_range_t<ddc::to_type_seq_t<IdxRangeOut>, 0, 6>>;
+
67  using IdxRangeSerial = ddc::detail::convert_type_seq_to_discrete_domain_t<
+
68  type_seq_range_t<ddc::to_type_seq_t<IdxRangeOut>, 6, n_dims>>;
+
69  using IdxParallel = typename IdxRangeParallel::discrete_element_type;
+
70  using IdxSerial = typename IdxRangeSerial::discrete_element_type;
+
71  IdxRangeParallel parallel_idx_range(idx_range);
+
72  IdxRangeSerial serial_idx_range(idx_range);
+
73  ddc::parallel_for_each(
+
74  execution_space,
+
75  parallel_idx_range,
+
76  KOKKOS_LAMBDA(IdxParallel p_idx) {
+
77  for (IdxSerial s_idx : serial_idx_range) {
+
78  transposed_field(p_idx, s_idx) = field_to_transpose(p_idx, s_idx);
+
79  }
+
80  });
+
81  }
+
82  return transposed_field;
+
83 }
+
IdxRange< Grid1D... > get_idx_range(IdxRangeFDistrib idx_range)
Get the index range for specific grid dimensions from a multi-D index range.
Definition: collisions_dimensions.hpp:83
diff --git a/type__seq__tools_8hpp_source.html b/type__seq__tools_8hpp_source.html new file mode 100644 index 000000000..42f799c39 --- /dev/null +++ b/type__seq__tools_8hpp_source.html @@ -0,0 +1,149 @@ + + + + + + + +Gyselalib++: /home/runner/work/gyselalibxx/gyselalibxx/code_branch/src/utils/type_seq_tools.hpp Source File + + + + + + + + + + + + + + + + +
+
+ + + + + + + + +
+
Gyselalib++ +
+
+ + + + + + +
+
+
+ + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
type_seq_tools.hpp
+
+
+
1 // SPDX-License-Identifier: MIT
+
2 #pragma once
+
3 
+
4 namespace detail {
+
5 
+
6 template <
+
7  class TypeSeqIn,
+
8  std::size_t Start,
+
9  std::size_t End,
+
10  std::size_t Idx = 0,
+
11  class TypeSeqOut = ddc::detail::TypeSeq<>>
+
12 struct TypeSeqRange
+
13 {
+
14  static_assert(End <= ddc::type_seq_size_v<TypeSeqIn>);
+
15  using new_result_type = std::conditional_t<
+
16  (Start <= Idx) && (Idx < End),
+
17  ddc::type_seq_merge_t<
+
18  TypeSeqOut,
+
19  ddc::detail::TypeSeq<ddc::type_seq_element_t<Idx, TypeSeqIn>>>,
+
20  TypeSeqOut>;
+
21  using type = typename TypeSeqRange<TypeSeqIn, Start, End, Idx + 1, new_result_type>::type;
+
22 };
+
23 
+
24 template <class TypeSeqIn, std::size_t Start, std::size_t End, class TypeSeqOut>
+
25 struct TypeSeqRange<TypeSeqIn, Start, End, End, TypeSeqOut>
+
26 {
+
27  using type = TypeSeqOut;
+
28 };
+
29 
+
30 } // namespace detail
+
31 
+
33 template <class TypeSeqIn, std::size_t Start, std::size_t End>
+
34 using type_seq_range_t = typename detail::TypeSeqRange<TypeSeqIn, Start, End, Start>::type;
+
+
+ + + +