Canoe
Comprehensive Atmosphere N' Ocean Engine
message_traits.hpp
Go to the documentation of this file.
1 #ifndef SRC_EXCHANGER_MESSAGE_TRAITS_HPP_
2 #define SRC_EXCHANGER_MESSAGE_TRAITS_HPP_
3 
4 // C/C++
5 #include <string>
6 
7 // canoe
8 #include <configure.hpp>
9 
10 #ifdef MPI_PARALLEL
11 #include <mpi.h>
12 #endif
13 
14 class RadiationBand;
15 class ParticleData;
16 class ParticleBase;
17 
19 template <typename T>
20 struct MessageTraits {
21  using DataType = double;
22 
23  constexpr static int num_buffers = 1;
24  constexpr static const char* name = "";
25 
26 #ifdef MPI_PARALLEL
27  static MPI_Datatype mpi_type;
28 #endif
29 };
30 
31 // Specialization for RadiationBand Exchanger
32 template <>
34  using DataType = Real;
35 
36  constexpr static int num_buffers = 2;
37  constexpr static const char* name = "RadiationBand";
38 
39 #ifdef MPI_PARALLEL
40  static MPI_Datatype mpi_type;
41 #endif // MPI_PARALLEL
42 };
43 
44 // Specialization for Particle Exchanger
45 template <>
48 
49  constexpr static int num_buffers = 56;
50  constexpr static const char* name = "ParticleBase";
51 
52 #ifdef MPI_PARALLEL
53  static MPI_Datatype mpi_type;
54 #endif // MPI_PARALLEL
55 };
56 
57 namespace MessageHelper {
58 
59 extern int mpi_tag_ub;
60 int create_mpi_tag(int lid, int tid, std::string name);
61 
62 } // namespace MessageHelper
63 
64 #endif // SRC_COMMUNICATOR_COMMUNICATOR_HPP_
int create_mpi_tag(int lid, int tid, std::string name)
Traits class providing Message information for class T.
constexpr static const char * name
constexpr static int num_buffers