00001 #ifndef DISTRIBUTEDOUTGOINGANALOGMSGDISPATCHER_H_ 00002 #define DISTRIBUTEDOUTGOINGANALOGMSGDISPATCHER_H_ 00003 00004 #include <vector> 00005 #include <string> 00006 #include <utility> 00007 00008 #include "SimObject.h" 00009 #include "OutgoingAnalogMPIBufferSourcesSet.h" 00010 #include "MPIOutputBuffer.h" 00011 00012 using std::vector; 00013 using std::string; 00014 using std::pair; 00015 using std::make_pair; 00016 00017 00018 class DistributedOutgoingAnalogMsgDispatcher 00019 { 00020 public: 00021 00022 DistributedOutgoingAnalogMsgDispatcher(engineid_t eng_id, delay_t minimumDelay, MPIOutputBuffer *mpiOutputBuffer); 00023 00024 virtual ~DistributedOutgoingAnalogMsgDispatcher(); 00025 00026 void addOutgoingAnalogMessage(SimObject *src, analog_port_id_t src_port); 00027 00028 void addOutgoingAnalogMessage(SimObject *src, string srcfield); 00029 00030 void dispatchMPIOutgoingAnalogMsgs(int step); 00031 00032 void initialize(); 00033 00034 protected: 00035 engineid_t engineID; 00036 00037 int nNodes; 00038 00039 delay_t minDelay; 00040 00041 double *mpiBuffer; 00042 00043 //********************************************************************** 00044 // lists of source -> destination pairs defining all analog messages 00045 typedef vector< pair<SimObject*, analog_port_id_t> > port_outgoing_analog_msgs_type; 00046 port_outgoing_analog_msgs_type port_msgs; 00047 00048 typedef vector< pair<void *, Field::ValueType> > field_outgoing_analog_msgs_type; 00049 field_outgoing_analog_msgs_type field_msgs; 00050 00051 vector< unsigned > port_msgs_buff_pos; 00052 vector< unsigned > field_msgs_buff_pos; 00053 00054 OutgoingAnalogMPIBufferSourcesSet *outgoingSources; 00055 00056 MPIOutputBuffer *outputBuffer; 00057 00058 bool initialized; 00059 00060 }; 00061 00062 #endif /*DISTRIBUTEDOUTGOINGANALOGMSGDISPATCHER_H_*/