File: mpia2abuf.h

package info (click to toggle)
esys-particle 2.3.4%2Bdfsg1-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 13,036 kB
  • ctags: 10,805
  • sloc: cpp: 80,009; python: 5,872; makefile: 1,243; sh: 313; perl: 225
file content (52 lines) | stat: -rw-r--r-- 1,735 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/////////////////////////////////////////////////////////////
//                                                         //
// Copyright (c) 2003-2014 by The University of Queensland //
// Centre for Geoscience Computing                         //
// http://earth.uq.edu.au/centre-geoscience-computing      //
//                                                         //
// Primary Business: Brisbane, Queensland, Australia       //
// Licensed under the Open Software License version 3.0    //
// http://www.apache.org/licenses/LICENSE-2.0          //
//                                                         //
/////////////////////////////////////////////////////////////

#ifndef __MPIA2ABUFFER_H
#define __MPIA2ABUFFER_H

#include <mpi.h>

/*!
  \class CMPIA2ABuffer
  \brief class for a MPI-buffer supporting all-to-all communication
  
  \author Steffen Abe
  $Revision$
  $Date$
*/
class CMPIA2ABuffer
{
 private:
  MPI_Comm m_comm;
  int m_rank; //!< the rank in this communicator
  int m_size; //!< size of the communicator
  int m_int_increment,m_dbl_increment; //!< the "packing size" of int/double
  MPI_Status m_status;
  char* m_buffer_s; //!< send buffer
  char* m_buffer_r; //!< receive buffer
  int m_buffersize; //!< the size of the buffer per slice
  int *m_position_s; //!< the current end of the content in each slice of the send buffer
  int *m_position_r; //!< the current end of the content in each slice of the receive buffer 

 public:
  CMPIA2ABuffer(MPI_Comm,int);
  virtual ~CMPIA2ABuffer();

  virtual void clear();
  virtual void all2all();
  virtual void append(int,int);
  virtual void append(double,int);
  virtual int pop_int(int);
  virtual double pop_double(int);
};

#endif //__MPIA2ABUFFER_H