ESyS-Particle  2.3
packed_multi_message.h
Go to the documentation of this file.
1 // //
3 // Copyright (c) 2003-2014 by The University of Queensland //
4 // Centre for Geoscience Computing //
5 // http://earth.uq.edu.au/centre-geoscience-computing //
6 // //
7 // Primary Business: Brisbane, Queensland, Australia //
8 // Licensed under the Open Software License version 3.0 //
9 // http://www.opensource.org/licenses/osl-3.0.php //
10 // //
12 
13 #ifndef __PACKED_MULTI_MESSAGE_H
14 #define __PACKED_MULTI_MESSAGE_H
15 
16 //--- MPI ---
17 #include <mpi.h>
18 
19 //--- project includes ---
21 
22 //--- STL includes ---
23 #include <string>
24 using std::string;
25 
26 
35 {
36  private:
37  MPI_Comm m_comm;
38  char* m_vbuffer;
40  int *m_position;
41  int *m_rpos;
42 
44  int *m_displ; //<! the diplacements of the slices in the buffer
45  int m_size;
47 
48  protected:
49  void grow();
50  void growTo(int);
51 
52  public:
53  TML_PackedMultiMessage(MPI_Comm,int isize=64);
54  virtual ~TML_PackedMultiMessage();
55 
57 
58  char* buffer(){return m_vbuffer;}; // make protected or make TML_Comm friend?
59  int* offsets(){return m_displ;};
60  int* sizes(){return m_rpos;};
61 
62  void clear();
63  void begin_pack(int);
64  void begin_unpack(int);
65 
66  void append(int,int);
67  void append(double,int);
68  void append(const string&,int);
69  void append(bool,int);
70 
71  int pop_int(int);
72  double pop_double(int);
73  //string pop_string(int);
74  string pop_string();
75  bool pop_bool(int);
76 };
77 
78 #endif // __PACKED_MULTI_MESSAGE_H
string pop_string()
Definition: packed_multi_message.cpp:249
void clear()
Definition: packed_multi_message.cpp:114
Handle class to access multimessages via a packed message interface.
Definition: multi_message_slab.h:32
int * m_displ
Definition: packed_multi_message.h:44
void grow()
Definition: packed_multi_message.cpp:74
int * m_position
the current end of the content in each slice
Definition: packed_multi_message.h:40
void append(int, int)
Definition: packed_multi_message.cpp:148
virtual ~TML_PackedMultiMessage()
Definition: packed_multi_message.cpp:51
char * buffer()
Definition: packed_multi_message.h:58
void begin_pack(int)
Definition: packed_multi_message.cpp:125
int * m_rpos
the number of bytes in the slice (i.e. m_position-m_displ)
Definition: packed_multi_message.h:41
void begin_unpack(int)
Definition: packed_multi_message.cpp:133
int * offsets()
Definition: packed_multi_message.h:59
int * m_recvcount
the buffer for the transfer of the size of the vbuffer
Definition: packed_multi_message.h:43
int * sizes()
Definition: packed_multi_message.h:60
Message buffer for sending and receiving packed data to mutltiple receivers. Data types are not check...
Definition: packed_multi_message.h:34
TML_PackedMultiMessage(MPI_Comm, int isize=64)
Definition: packed_multi_message.cpp:29
MPI_Comm m_comm
Definition: packed_multi_message.h:37
char * m_vbuffer
Definition: packed_multi_message.h:38
TML_PackedMultiMessageSlab operator[](int)
Definition: packed_multi_message.cpp:63
int pop_int(int)
Definition: packed_multi_message.cpp:216
bool pop_bool(int)
Definition: packed_multi_message.cpp:262
int m_int_increment
Definition: packed_multi_message.h:46
int m_vbuffersize
the size of the buffer per slice
Definition: packed_multi_message.h:39
int m_size
Definition: packed_multi_message.h:45
double pop_double(int)
Definition: packed_multi_message.cpp:231
void growTo(int)
Definition: packed_multi_message.cpp:94
int m_dbl_increment
the "packing size" of int/double
Definition: packed_multi_message.h:46