6 #ifndef DUNE_COMMON_PARALLEL_MPIDATA_HH
7 #define DUNE_COMMON_PARALLEL_MPIDATA_HH
39 template<
class,
class =
void>
48 template<
class T,
class Enable>
51 friend auto getMPIData<T>(T&);
71 MPI_Datatype
type()
const {
98 struct MPIData<T, std::
void_t<std::tuple<decltype(std::declval<T>().data()),
99 decltype(std::declval<T>().size()),
100 typename std::decay_t<T>::value_type>>>{
103 using hasResizeOp = decltype(std::declval<U>().resize(0));
106 friend auto getMPIData<T>(T&);
111 static constexpr
bool static_size = std::is_const<T>::value || !Std::is_detected_v<hasResizeOp, T>;
113 return (
void*)
data_.data();
122 template<
class S = T>
124 -> std::enable_if_t<!std::is_const<S>::value || !Std::is_detected_v<hasResizeOp, S>>
Traits classes for mapping types onto MPI_Datatype.
Traits for type conversions and type information.
typename Impl::voider< Types... >::type void_t
Is void for all valid input types. The workhorse for C++11 SFINAE-techniques.
Definition: typetraits.hh:40
Dune namespace.
Definition: alignedallocator.hh:13
auto getMPIData(T &t)
Definition: mpidata.hh:43
A traits class describing the mapping of types onto MPI_Datatypes.
Definition: mpitraits.hh:41
Definition: mpidata.hh:50
T & data_
Definition: mpidata.hh:53
void * ptr() const
Definition: mpidata.hh:60
MPI_Datatype type() const
Definition: mpidata.hh:71
int size() const
Definition: mpidata.hh:67
static constexpr bool static_size
Definition: mpidata.hh:65
MPIData(T &t)
Definition: mpidata.hh:55
void get()
Definition: mpidata.hh:89
MPIData()
Definition: mpidata.hh:80
void * ptr()
Definition: mpidata.hh:83
int size()
Definition: mpidata.hh:86
MPI_Datatype type() const
Definition: mpidata.hh:90
MPIData(T &t)
Definition: mpidata.hh:107
void * ptr()
Definition: mpidata.hh:112
auto resize(int size) -> std::enable_if_t<!std::is_const< S >::value||!Std::is_detected_v< hasResizeOp, S >>
Definition: mpidata.hh:123
int size()
Definition: mpidata.hh:115
T & data_
Definition: mpidata.hh:130
MPI_Datatype type() const
Definition: mpidata.hh:118