8template <
class NameTuple,
class OutputTuple,
size_t... I>
10 std::string event_name,
13 std::integer_sequence<size_t, I...>)
15 std::array<size_t,
sizeof...(I)> sizes;
17 ((PDI_share((std::get<I>(names) +
"_extents").c_str(), &sizes[I], PDI_INOUT)), ...);
19 PDI_event((event_name +
"_extents").c_str());
21 ((PDI_reclaim((std::get<I>(names) +
"_extents").c_str())), ...);
24 ((std::get<I>(args).resize(sizes[I])), ...);
26 ((PDI_share(std::get<I>(names).c_str(), std::get<I>(args).data(), PDI_INOUT)), ...);
28 PDI_event(event_name.c_str());
30 ((PDI_reclaim(std::get<I>(names).c_str())), ...);
33template <
class TupleType,
size_t... I>
34auto get_name_tuple(TupleType input_args, std::integer_sequence<size_t, I...>)
36 return std::make_tuple(std::string(std::get<I * 2>(input_args))...);
39template <
class TupleType,
size_t... I>
40auto get_vector_tuple(TupleType input_args, std::integer_sequence<size_t, I...>)
42 return std::tie(std::get<I * 2 + 1>(input_args)...);
50template <
class T,
class... Args>
52 std::string event_name,
54 std::vector<T>& out_vector,
57 auto idx_sequence = std::make_index_sequence<
sizeof...(Args) / 2 + 1> {};
58 auto arg_tuple = std::tie(name, out_vector, input_args...);
59 auto names = detail::get_name_tuple(arg_tuple, idx_sequence);
60 auto out_vectors = detail::get_vector_tuple(arg_tuple, idx_sequence);
61 detail::PDI_get_array(event_name, names, out_vectors, idx_sequence);
64template <
class... Grids>
65void PDI_expose_idx_range(IdxRange<Grids...> index_range, std::string name)
67 IdxStep<Grids...> extents = index_range.extents();
68 Idx<Grids...> local_starts = index_range.front();
69 Idx<Grids...> global_starts(Idx<Grids> {0}...);
71 IdxStep<Grids...> starts = local_starts - global_starts;
72 int constexpr n_grids =
sizeof...(Grids);
73 std::array<ddc::DiscreteVectorElement, n_grids> starts_arr = ddc::detail::array(starts);
74 std::array<ddc::DiscreteVectorElement, n_grids> extents_arr = ddc::detail::array(extents);
75 std::array<std::size_t, n_grids> starts_s_arr;
76 std::array<std::size_t, n_grids> extents_s_arr;
77 for (
int i(0); i < n_grids; ++i) {
78 starts_s_arr[i] = std::size_t(starts_arr[i]);
79 extents_s_arr[i] = std::size_t(extents_arr[i]);
81 PDI_expose((name +
"_starts").c_str(), starts_s_arr.data(), PDI_OUT);
82 PDI_expose((name +
"_extents").c_str(), extents_s_arr.data(), PDI_OUT);
A class which describes the real space in the temporal direction.
Definition geometry.hpp:44