5#ifndef DUNE_MPITRAITS_HH
6#define DUNE_MPITRAITS_HH
64#define ComposeMPITraits(p,m) \
66 struct MPITraits<p>{ \
67 static inline MPI_Datatype getType(){ \
70 static constexpr bool is_intrinsic = true; \
89#undef ComposeMPITraits
93 template<
class K,
int n>
112 MPI_Type_create_struct(1, length, &displ, &vectortype, &datatype);
113 MPI_Type_commit(&datatype);
120 template<
class K,
int n>
121 MPI_Datatype MPITraits<FieldVector<K,n> >::datatype = MPI_DATATYPE_NULL;
122 template<
class K,
int n>
123 MPI_Datatype MPITraits<FieldVector<K,n> >::vectortype = {MPI_DATATYPE_NULL};
127 class bigunsignedint;
130 struct MPITraits<bigunsignedint<k> >
132 static MPI_Datatype datatype;
133 static MPI_Datatype vectortype;
135 static inline MPI_Datatype
getType()
137 if(datatype==MPI_DATATYPE_NULL) {
141 bigunsignedint<k> data;
144 MPI_Get_address(&data, &base);
145 MPI_Get_address(&(data.digit), &displ);
148 MPI_Type_create_struct(1, length, &displ, &vectortype, &datatype);
149 MPI_Type_commit(&datatype);
159 MPI_Datatype MPITraits<bigunsignedint<k> >::datatype = MPI_DATATYPE_NULL;
161 MPI_Datatype MPITraits<bigunsignedint<k> >::vectortype = MPI_DATATYPE_NULL;
163 template<
typename T1,
typename T2>
164 struct MPITraits<
std::pair<T1,T2 > >
167 inline static MPI_Datatype
getType();
169 static MPI_Datatype type;
171 template<
typename T1,
typename T2>
172 MPI_Datatype MPITraits<std::pair<T1,T2> >::getType()
174 if(type==MPI_DATATYPE_NULL) {
175 int length[2] = {1, 1};
180 using Pair = std::pair<T1, T2>;
181 static_assert(std::is_standard_layout<Pair>::value,
"offsetof() is only defined for standard layout types");
182 disp[0] = offsetof(Pair, first);
183 disp[1] = offsetof(Pair, second);
186 MPI_Type_create_struct(2, length, disp, types, &tmp);
188 MPI_Type_create_resized(tmp, 0,
sizeof(Pair), &type);
189 MPI_Type_commit(&type);
196 template<
typename T1,
typename T2>
197 MPI_Datatype MPITraits<std::pair<T1,T2> >::type=MPI_DATATYPE_NULL;
Dune namespace.
Definition alignedallocator.hh:13
A dynamically growing random access list.
Definition arraylist.hh:62
A traits class describing the mapping of types onto MPI_Datatypes.
Definition mpitraits.hh:41
static MPI_Datatype getType()
Definition mpitraits.hh:48
static constexpr bool is_intrinsic
Definition mpitraits.hh:56
static constexpr int n
Definition bigunsignedint.hh:78
vector space out of a tensor product of fields.
Definition fvector.hh:95