19#ifndef TIMPI_STANDARD_TYPE_H
20#define TIMPI_STANDARD_TYPE_H
24#include "timpi/timpi_config.h"
36#ifdef TIMPI_DEFAULT_QUADRUPLE_PRECISION
37# include <boost/multiprecision/float128.hpp>
49#include <unordered_map>
50#include <unordered_set>
82template <
typename T,
typename Enable>
107template <
typename T,
typename A>
114template <
typename T,
typename A>
121template <
typename K,
typename T,
typename C,
typename A>
128template <
typename K,
typename T,
typename C,
typename A>
135template <
typename T,
typename C,
typename A>
142template <
typename T,
typename C,
typename A>
149template <
typename K,
typename T,
typename C,
typename A>
156template <
typename K,
typename T,
typename C,
typename A>
163template <
typename T,
typename C,
typename A>
170template <
typename T,
typename C,
typename A>
193template <
typename T,
typename A>
208#define TIMPI_STANDARD_TYPE(cxxtype,mpitype) \
210 class StandardType<cxxtype> : public DataType \
214 StandardType(const cxxtype * = nullptr) : DataType(mpitype) {} \
216 static const bool is_fixed_type = true; \
221#define TIMPI_STANDARD_TYPE(cxxtype,mpitype) \
223 class StandardType<cxxtype> : public DataType \
227 StandardType(const cxxtype * = nullptr) : DataType() {} \
229 static const bool is_fixed_type = true; \
273# ifdef TIMPI_DEFAULT_QUADRUPLE_PRECISION
296 _datatype =
t._datatype;
304# ifdef TIMPI_DEFAULT_QUADRUPLE_PRECISION
312template<
typename T1,
typename T2>
315 StandardType<typename std::remove_const<T1>::type>::is_fixed_type &&
316 StandardType<T2>::is_fixed_type>::type> :
public DataType
328 static const std::pair<T1, T2>
p;
335 d1(
const_cast<typename std::remove_const<T1>::type *
>
366 sizeof(std::pair<T1,T2>),
388 _datatype =
t._datatype;
397template<
typename T, std::
size_t N>
400 StandardType<T>::is_fixed_type>::type> :
public DataType
412 std::array<T, N> *
ex;
413 std::unique_ptr<std::array<T, N>>
temp;
415 ex =
const_cast<std::array<T, N> *
>(
example);
418 temp.reset(
new std::array<T, N>());
422 static_assert(
N > 0,
"Zero-length std::array is not supported by TIMPI");
469 _datatype =
t._datatype;
480template<std::
size_t n_minus_i>
483 template<
typename...
Types>
484 static void build(std::vector<std::unique_ptr<DataType>> &
out_vec,
485 const std::tuple<Types...> &
example);
491 template<
typename...
Types>
492 static void build(std::vector<std::unique_ptr<DataType>> & ,
493 const std::tuple<Types...> & ) {}
496template<std::
size_t n_minus_i>
497template<
typename...
Types>
499 (std::vector<std::unique_ptr<DataType>> &
out_vec,
500 const std::tuple<Types...> &
example)
503 std::tuple_element<
sizeof...(Types)-
n_minus_i, std::tuple<Types...>>::type
514template<std::
size_t n_minus_i>
519 const std::tuple<Types...> &
example);
527 const std::tuple<Types...> & ) {}
531template<std::
size_t n_minus_i>
535 const std::tuple<Types...> &
example)
546template <
typename Head,
typename...
Tail>
553template <
typename Head>
559template<
typename...
Types>
562 CheckAllFixedTypes<Types...>::is_fixed_type>::type> :
public DataType
574 static const std::tuple<
Types...>
t;
583 const std::size_t
tuplesize =
sizeof...(Types);
585 std::vector<std::unique_ptr<DataType>>
subtypes;
612 sizeof(std::tuple<Types...>),
634 _datatype =
t._datatype;
Encapsulates the MPI_Datatype.
ManageType(data_type uncommitted_type)
virtual ~ManageType() override
StandardType<T>'s which do not define a way to MPI_Type T should inherit from this class.
static const bool is_fixed_type
The SemiPermanent "class" is basically just a place for a destructor vtable.
static void add(std::unique_ptr< SemiPermanent > obj)
StandardType(const TIMPI_DEFAULT_SCALAR_TYPE *=nullptr)
StandardType & operator=(StandardType &t)
StandardType(const StandardType< TIMPI_DEFAULT_SCALAR_TYPE > &t)
StandardType & operator=(StandardType &t)
StandardType(const std::array< T, N > *example=nullptr)
StandardType(const StandardType< std::array< T, N > > &t)
StandardType(const std::complex< T > *=nullptr)
StandardType(const StandardType< std::pair< T1, T2 > > &t)
StandardType(const std::pair< T1, T2 > *example=nullptr)
StandardType & operator=(StandardType &t)
StandardType(const std::tuple< Types... > *example=nullptr)
StandardType & operator=(StandardType &t)
StandardType(const StandardType< std::tuple< Types... > > &t)
Templated class to provide the appropriate MPI datatype for use with built-in C types or simple C++ c...
StandardType(const T *example=nullptr)
void timpi_ignore(const Args &...)
StandardType< T > build_standard_type(const T *example=nullptr)
TIMPI_STANDARD_TYPE(char, MPI_CHAR)
Tnew cast_int(Told oldvar)
static void build(std::vector< std::unique_ptr< DataType > > &, const std::tuple< Types... > &)
static void build(std::vector< std::unique_ptr< DataType > > &out_vec, const std::tuple< Types... > &example)
static const bool is_fixed_type
static void fill(OutArray &, const std::tuple< Types... > &)
static void fill(OutArray &out, const std::tuple< Types... > &example)
InnermostType< T >::type type
InnermostType< std::pair< constK, T > >::type type
InnermostType< std::pair< constK, T > >::type type
InnermostType< T >::type type
InnermostType< T >::type type
InnermostType< std::pair< constK, T > >::type type
InnermostType< std::pair< constK, T > >::type type
InnermostType< T >::type type
InnermostType< T >::type type
InnermostType< T >::type type