4 #ifndef DUNE_COMMON_PARALLEL_MPIDATA_HH
5 #define DUNE_COMMON_PARALLEL_MPIDATA_HH
37 template<
class,
class =
void>
46 template<
class T,
class Enable>
49 friend auto getMPIData<T>(T&);
69 MPI_Datatype
type()
const {
96 struct MPIData<T, std::
void_t<std::tuple<decltype(std::declval<T>().data()),
97 decltype(std::declval<T>().size()),
98 typename std::decay_t<T>::value_type>>>{
101 using hasResizeOp = decltype(std::declval<U>().resize(0));
104 friend auto getMPIData<T>(T&);
109 static constexpr
bool static_size = std::is_const<T>::value || !Std::is_detected_v<hasResizeOp, T>;
111 return (
void*)
data_.data();
120 template<
class S = T>
122 -> 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:38
Dune namespace.
Definition: alignedallocator.hh:11
auto getMPIData(T &t)
Definition: mpidata.hh:41
A traits class describing the mapping of types onto MPI_Datatypes.
Definition: mpitraits.hh:39
Definition: mpidata.hh:48
T & data_
Definition: mpidata.hh:51
void * ptr() const
Definition: mpidata.hh:58
MPI_Datatype type() const
Definition: mpidata.hh:69
int size() const
Definition: mpidata.hh:65
static constexpr bool static_size
Definition: mpidata.hh:63
MPIData(T &t)
Definition: mpidata.hh:53
void get()
Definition: mpidata.hh:87
MPIData()
Definition: mpidata.hh:78
void * ptr()
Definition: mpidata.hh:81
int size()
Definition: mpidata.hh:84
MPI_Datatype type() const
Definition: mpidata.hh:88
MPIData(T &t)
Definition: mpidata.hh:105
void * ptr()
Definition: mpidata.hh:110
auto resize(int size) -> std::enable_if_t<!std::is_const< S >::value||!Std::is_detected_v< hasResizeOp, S >>
Definition: mpidata.hh:121
int size()
Definition: mpidata.hh:113
T & data_
Definition: mpidata.hh:128
MPI_Datatype type() const
Definition: mpidata.hh:116