ESyS-Particle  4.0.1
mpisgvbuf.h
1 
2 // //
3 // Copyright (c) 2003-2011 by The University of Queensland //
4 // Earth Systems Science Computational Centre (ESSCC) //
5 // http://www.uq.edu.au/esscc //
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 __MPISGVBUF_H
14 #define __MPISGVBUF_H
15 
16 #include "Parallel/mpisgbuf.h"
17 #include <string>
18 
28 {
29 private:
30  char* m_vbuffer;
31  char* m_dummy_vbuffer;
32  int m_vbuffersize;
33  int *m_position;
34  int *m_rpos;
35 
36  int *m_recvcount;
37  int *m_displ; //<! the diplacements of the slices in the buffer
38  int m_ndummy;
39 
40 
41  protected:
42  void grow();
43  void growTo(int);
44 
45  public:
46  CMPIVarSGBufferRoot(MPI_Comm,int isize=16);
47  virtual ~CMPIVarSGBufferRoot();
48 
49  virtual void clear();
50  virtual void gather();
51  virtual void scatter();
52  virtual void append(int,int);
53  virtual void append(double,int);
54  virtual void append(const char*,int);
55  virtual int pop_int(int);
56  virtual double pop_double(int);
57  virtual void pop_doubles(int,double *,int);
58 };
59 
69 {
70  private:
71  char* m_vbuffer;
72  int m_vbuffersize;
73  int m_position;
74  int m_data_size;
75 
76  protected:
77  void grow();
78  void growTo(int);
79 
80  public:
81  CMPIVarSGBufferLeaf(MPI_Comm,int,int isize=16);
82  virtual ~CMPIVarSGBufferLeaf();
83 
84  virtual void clear();
85  virtual void send();
86  virtual void receive();
87  virtual void append(int);
88  virtual void append(double);
89  virtual void append(const char*);
90  virtual int pop_int();
91  virtual double pop_double();
92  virtual void pop_doubles(double *,int);
93  virtual std::string pop_string();
94 };
95 
96 
97 
98 #endif // __MPISGVBUF_H