MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
typetraits.h
Go to the documentation of this file.
1// Copyright (C) 2024 The m-AIA AUTHORS
2//
3// This file is part of m-AIA (https://git.rwth-aachen.de/aia/m-AIA/m-AIA)
4//
5// SPDX-License-Identifier: LGPL-3.0-only
6
7#ifndef TYPETRAITS_H
8#define TYPETRAITS_H
9
10#include "COMM/mpioverride.h"
11#include "INCLUDE/maiatypes.h"
12
13namespace maia {
14
15#ifndef MAIA_MS_COMPILER
16// Disallow usage of non-specified traits
17namespace detail_ {
18template <class T>
19struct traits_error {};
20} // namespace detail_
21template <class T>
24};
25#else
26template <class T>
27struct type_traits {};
28
29template <>
30struct type_traits<long> {
31 static MString name() { return "MLong"; };
32 static MPI_Datatype mpiType() { return MPI_LONG; };
33};
34#endif
35
36// Specialized templates for known types
37
38template <>
40 static MString name() { return "MFloat"; };
41 static MPI_Datatype mpiType() { return MPI_DOUBLE; };
42};
43
44template <>
46 static MString name() { return "MString"; };
47 // MString has no corresponding MPI data type
48};
49
50template <>
52 static MString name() { return "MChar"; };
53 static MPI_Datatype mpiType() { return MPI_CHAR; };
54};
55
56template <>
58 static MString name() { return "MInt"; };
59 static MPI_Datatype mpiType() { return MPI_INT; };
60};
61
62template <>
64 static MString name() { return "MUint"; };
65 static MPI_Datatype mpiType() { return MPI_UNSIGNED; };
66};
67
68template <>
70 static MString name() { return "MLong"; };
71 static MPI_Datatype mpiType() { return MPI_LONG; };
72};
73
74template <>
76 static MString name() { return "MUlong"; };
77 static MPI_Datatype mpiType() { return MPI_UNSIGNED_LONG; };
78};
79
80template <>
82 static MString name() { return "MBool"; };
83 static MPI_Datatype mpiType() { return MPI_C_BOOL; };
84};
85
86template <>
87struct type_traits<uint_fast8_t> {
88 static MString name() { return "uint_fast8_t"; };
89 static MPI_Datatype mpiType() { return MPI_UINT8_T; };
90};
91
92} /* namespace maia */
93
94
95#endif /* ifndef TYPETRAITS_H */
int32_t MInt
Definition: maiatypes.h:62
uint32_t MUint
Definition: maiatypes.h:63
std::basic_string< char > MString
Definition: maiatypes.h:55
double MFloat
Definition: maiatypes.h:52
int64_t MLong
Definition: maiatypes.h:64
bool MBool
Definition: maiatypes.h:58
char MChar
Definition: maiatypes.h:56
uint64_t MUlong
Definition: maiatypes.h:65
Namespace for auxiliary functions/classes.
static MString name()
Definition: typetraits.h:82
static MPI_Datatype mpiType()
Definition: typetraits.h:83
static MString name()
Definition: typetraits.h:52
static MPI_Datatype mpiType()
Definition: typetraits.h:53
static MPI_Datatype mpiType()
Definition: typetraits.h:41
static MString name()
Definition: typetraits.h:40
static MPI_Datatype mpiType()
Definition: typetraits.h:59
static MString name()
Definition: typetraits.h:58
static MPI_Datatype mpiType()
Definition: typetraits.h:71
static MString name()
Definition: typetraits.h:70
static MString name()
Definition: typetraits.h:46
static MPI_Datatype mpiType()
Definition: typetraits.h:65
static MString name()
Definition: typetraits.h:64
static MString name()
Definition: typetraits.h:76
static MPI_Datatype mpiType()
Definition: typetraits.h:77
static MPI_Datatype mpiType()
Definition: typetraits.h:32
static MString name()
Definition: typetraits.h:31
static MPI_Datatype mpiType()
Definition: typetraits.h:89
typename detail_::traits_error< T >::ERROR_CANNOT_USE_NON_SPECIFIED_TRAITS error
Definition: typetraits.h:23