MPI-type for std::array

This commit is contained in:
Joachim Schoeberl 2023-09-05 21:53:55 +02:00
parent 24d79dbfdd
commit 63660682c2

View File

@ -44,6 +44,21 @@ namespace ngcore
static MPI_Datatype MPIType () { return MPI_C_BOOL; } };
template<int S, typename T>
struct MPI_typetrait<std::array<T,S>>
{
static MPI_Datatype MPIType ()
{
static MPI_Datatype MPI_T = 0;
if (!MPI_T)
{
MPI_Type_contiguous ( S, MPI_typetrait<T>::MPIType(), &MPI_T);
MPI_Type_commit ( &MPI_T );
}
return MPI_T;
}
};
template <class T, class T2 = decltype(MPI_typetrait<T>::MPIType())>
inline MPI_Datatype GetMPIType () {
return MPI_typetrait<T>::MPIType();