00001 //========================================================================= 00002 // CMPICOMM.H - part of 00003 // 00004 // OMNeT++/OMNEST 00005 // Discrete System Simulation in C++ 00006 // 00007 // Written by: Andras Varga, 2003 00008 // 00009 //========================================================================= 00010 00011 /*--------------------------------------------------------------* 00012 Copyright (C) 2003-2005 Andras Varga 00013 Monash University, Dept. of Electrical and Computer Systems Eng. 00014 Melbourne, Australia 00015 00016 This file is distributed WITHOUT ANY WARRANTY. See the file 00017 `license' for details on this and other legal matters. 00018 *--------------------------------------------------------------*/ 00019 00020 #ifndef __CMPICOMM_H__ 00021 #define __CMPICOMM_H__ 00022 00023 #include "cparsimcomm.h" 00024 00025 class cMPICommBuffer; 00026 00032 class cMPICommunications : public cParsimCommunications 00033 { 00034 protected: 00035 cMPICommBuffer *recycledBuffer; 00036 int numPartitions; 00037 int myRank; 00038 00039 protected: 00043 virtual cMPICommBuffer *doCreateCommBuffer(); 00044 00045 public: 00049 cMPICommunications(); 00050 00054 virtual ~cMPICommunications(); 00055 00061 virtual void init(); 00062 00066 virtual void shutdown(); 00067 00071 virtual int getNumPartitions(); 00072 00076 virtual int getProcId(); 00077 00081 virtual cCommBuffer *createCommBuffer(); 00082 00086 virtual void recycleCommBuffer(cCommBuffer *buffer); 00087 00091 virtual void send(cCommBuffer *buffer, int tag, int destination); 00092 00096 virtual void broadcast(cCommBuffer *buffer, int tag); 00097 00102 virtual bool receiveBlocking(int filtTag, cCommBuffer *buffer, int& receivedTag, int& sourceProcId); 00103 00109 virtual bool receiveNonblocking(int filtTag, cCommBuffer *buffer, int& receivedTag, int& sourceProcId); 00111 }; 00112 00113 #endif 00114 00115