OMNeT++ Parallel Simulation Support  6.0.3
cmpicomm.h
1 //=========================================================================
2 // CMPICOMM.H - part of
3 //
4 // OMNeT++/OMNEST
5 // Discrete System Simulation in C++
6 //
7 //=========================================================================
8 
9 /*--------------------------------------------------------------*
10  Copyright (C) 1992-2017 Andras Varga
11  Copyright (C) 2006-2017 OpenSim Ltd.
12 
13  This file is distributed WITHOUT ANY WARRANTY. See the file
14  `license' for details on this and other legal matters.
15 *--------------------------------------------------------------*/
16 
17 #ifdef WITH_MPI
18 
19 #ifndef __OMNETPP_CMPICOMM_H
20 #define __OMNETPP_CMPICOMM_H
21 
22 #include "omnetpp/cparsimcomm.h"
23 
24 namespace omnetpp {
25 
26 class cMPICommBuffer;
27 
33 class SIM_API cMPICommunications : public cParsimCommunications
34 {
35  protected:
36  cMPICommBuffer *recycledBuffer;
37  int numPartitions;
38  int myRank;
39 
40  protected:
44  virtual cMPICommBuffer *doCreateCommBuffer();
45 
46  public:
50  cMPICommunications();
51 
55  virtual ~cMPICommunications();
56 
62  virtual void init(int numPartitions) override;
63 
67  virtual void shutdown() override;
68 
72  virtual int getNumPartitions() const override;
73 
77  virtual int getProcId() const override;
78 
82  virtual cCommBuffer *createCommBuffer() override;
83 
87  virtual void recycleCommBuffer(cCommBuffer *buffer) override;
88 
92  virtual void send(cCommBuffer *buffer, int tag, int destination) override;
93 
97  virtual void broadcast(cCommBuffer *buffer, int tag) override;
98 
103  virtual bool receiveBlocking(int filtTag, cCommBuffer *buffer, int& receivedTag, int& sourceProcId) override;
104 
110  virtual bool receiveNonblocking(int filtTag, cCommBuffer *buffer, int& receivedTag, int& sourceProcId) override;
112 };
113 
114 } // namespace omnetpp
115 
116 
117 #endif
118 
119 #endif