-
Notifications
You must be signed in to change notification settings - Fork 1
/
mpicomm.h
50 lines (43 loc) · 1.44 KB
/
mpicomm.h
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
// Percy++ Copyright 2007,2012,2013 Ian Goldberg <iang@cs.uwaterloo.ca>,
// Casey Devet <cjdevet@cs.uwaterloo.ca>,
// Paul Hendry <pshdenry@uwaterloo.ca>,
// Ryan Henry <rhenry@cs.uwaterloo.ca>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of version 2 of the GNU General Public License as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// There is a copy of the GNU General Public License in the COPYING file
// packaged with this plugin; if you cannot find it, write to the Free
// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
// 02110-1301 USA
#ifndef __MPICOMM_H__
#define __MPICOMM_H__
#include <mpi.h>
#include <iostream>
#include <vector>
#include "percytypes.h"
#include "percyparams.h"
#include "percycomm.h"
class MPIStreamBuf : public std::streambuf
{
public:
MPIStreamBuf (int other_rank, MPI_Comm comm = MPI_COMM_WORLD);
~MPIStreamBuf ();
protected:
virtual int underflow ();
virtual int overflow (int c = EOF);
virtual std::streamsize xsputn (const char * s, std::streamsize n);
private:
char * buffer;
int buffersize;
int other_rank;
int my_rank;
MPI_Comm comm;
};
#endif