24#include "kamping/kassert/kassert.hpp"
25#ifdef KAMPING_ENABLE_REFLECTION
26 #include <boost/pfr.hpp>
33namespace kamping::types {
51template <
typename T,
typename Lookup = type_dispatcher_lookup>
53#ifdef KAMPING_ENABLE_REFLECTION
56 || boost::pfr::is_implicitly_reflectable<T, kamping_tag>::value,
57 "Type must be a std::pair, std::tuple or reflectable"
62 "Type must be a std::pair or std::tuple"
80template <
typename T,
typename F,
size_t...
Is>
82 (f(std::get<Is>(std::forward<T>(
t)),
Is), ...);
86template <
typename T,
typename F>
94template <
typename T,
typename F>
99#ifdef KAMPING_ENABLE_REFLECTION
100 boost::pfr::for_each_field(
t, std::forward<F>(f));
113 return std::tuple_size_v<T>;
115#ifdef KAMPING_ENABLE_REFLECTION
116 return boost::pfr::tuple_size_v<T>;
118 if constexpr (std::is_arithmetic_v<T>) {
121 return std::tuple_size_v<T>;
129namespace kamping::types {
131template <
typename T,
typename Lookup>
136 int blocklens[kamping::internal::tuple_size<T>];
144 "\n --> Type not supported by the current Lookup policy. "
145 "Please specialize mpi_type_traits for this type or provide a custom Lookup."
STL-compatible allocator for requesting memory using the builtin MPI allocator.
Definition allocator.hpp:32
TypeCategory
Type groups as defined in Section 6.9.2 of the MPI 4.0 standard.
Definition builtin_types.hpp:32
constexpr bool category_has_to_be_committed(TypeCategory category)
Returns whether an MPI_Datatype of the given category must be committed before use.
Definition builtin_types.hpp:35
Mapping of C++ datatypes to builtin MPI types.
Type traits and dispatcher for mapping C++ types to MPI datatypes.
Internal namespace marking the code that is not user-facing.
Definition collectives_helpers.hpp:20
void for_each_tuple_field(T &&t, F &&f, std::index_sequence< Is... >)
Applies functor f to each field of the tuple with an index in index sequence Is.
Definition struct_type.hpp:81
void for_each_field(T &t, F &&f)
Applies functor f to each field of the tuple-like type t. Works for std::pair and std::tuple....
Definition struct_type.hpp:95
constexpr size_t tuple_size
The number of elements in a tuple-like type.
Definition struct_type.hpp:109
Helper to check if a type is a std::pair.
Definition type_helpers.hpp:28
Helper to check if a type is a std::tuple.
Definition type_helpers.hpp:35
Tag used for indicating that a struct is reflectable.
Definition struct_type.hpp:40
Constructs an MPI_Datatype for a struct-like type.
Definition struct_type.hpp:52
static MPI_Datatype data_type()
The MPI_Datatype corresponding to the type.
Definition struct_type.hpp:132
static constexpr TypeCategory category
The category of the type.
Definition struct_type.hpp:66
static constexpr bool has_to_be_committed
Whether the type has to be committed before it can be used in MPI calls.
Definition struct_type.hpp:68
Internal type helpers for the kamping-types module.