DistributedAnalogMessageDispatcher.cpp

Go to the documentation of this file.
00001 #include "DistributedAnalogMessageDispatcher.h"
00002 
00003 DistributedAnalogMessageDispatcher::DistributedAnalogMessageDispatcher(int numNodes,
00004         int minimumDelay,
00005         vector< DistributedIncomingAnalogMsgDispatcher* > & incomingDispatchers,
00006         vector< DistributedOutgoingAnalogMsgDispatcher*> & outgoingDispatchers,
00007         AnalogMessageDispatcher &localDispatcher)
00008         : nNodes(numNodes), minDelay(minimumDelay),
00009         incoming_dispatchers(incomingDispatchers),
00010         outgoing_dispatchers(outgoingDispatchers),
00011         local_dispatcher(localDispatcher), currentStep(0)
00012 {}
00013 
00014 DistributedAnalogMessageDispatcher::~DistributedAnalogMessageDispatcher()
00015 {}
00016 
00017 
00018 void DistributedAnalogMessageDispatcher::dispatchOutgoingAnalogMsgs()
00019 {
00020     vector<DistributedOutgoingAnalogMsgDispatcher *>::const_iterator it;
00021     for (it = outgoing_dispatchers.begin(); it != outgoing_dispatchers.end(); ++it)
00022         (*it)->dispatchMPIOutgoingAnalogMsgs(currentStep);
00023 }
00024 
00025 
00026 void DistributedAnalogMessageDispatcher::dispatchIncomingAnalogMsgs(int step)
00027 {
00028     /* vector<DistributedIncomingAnalogMsgDispatcher>::const_iterator it;
00029        for (it = incoming_dispatchers.begin(); it != incoming_dispatchers.end(); ++it)
00030           it->dispatchIncomingAnalogMsgs(currentStep); */
00031 }
00032 
00033 void DistributedAnalogMessageDispatcher::dispatchDelayerCycledIncomingAnalogMsgs()
00034 {
00035     vector<DistributedIncomingAnalogMsgDispatcher*>::const_iterator it;
00036     for (it = incoming_dispatchers.begin(); it != incoming_dispatchers.end(); ++it)
00037         (*it)->dispatchDelayerCycledIncomingAnalogMsgs();
00038 
00039     // this method is invoked after mpi exchange so we reset the current step within a cycle
00040     currentStep = 0;
00041 }
00042 
00043 void DistributedAnalogMessageDispatcher::dispatchAnalogMsgs()
00044 {
00045         dispatchOutgoingAnalogMsgs();
00046     // dispatchIncomingAnalogMsgs(currentStep);
00047     cycledLocalDispatcher.dispatchIncomingAnalogMsgs(currentStep);
00048     local_dispatcher.dispatchAnalogMsgs();
00049     currentStep++;
00050 }
00051 
00052 void DistributedAnalogMessageDispatcher::initialize()
00053 {
00054     vector<DistributedIncomingAnalogMsgDispatcher *>::const_iterator in_it;
00055     for (in_it = incoming_dispatchers.begin(); in_it != incoming_dispatchers.end(); ++in_it) 
00056         (*in_it)->initialize();
00057             
00058     vector<DistributedOutgoingAnalogMsgDispatcher *>::const_iterator out_it;
00059     for (out_it = outgoing_dispatchers.begin(); out_it != outgoing_dispatchers.end(); ++out_it)
00060         (*out_it)->initialize();
00061     cycledLocalDispatcher.initialize();
00062     
00063 }
00064 
00065 void DistributedAnalogMessageDispatcher::reset(double dt)
00066 {
00067         vector<DistributedIncomingAnalogMsgDispatcher *>::const_iterator in_it;
00068     for (in_it = incoming_dispatchers.begin(); in_it != incoming_dispatchers.end(); ++in_it) 
00069         (*in_it)->reset(dt);    
00070         local_dispatcher.reset(dt);        
00071     currentStep = 0;    
00072 }

Generated on Wed Jul 9 16:34:37 2008 for PCSIM by  doxygen 1.5.5