00001 #ifndef DISTRIBUTEDSPIKESCHEDULER_H_ 00002 #define DISTRIBUTEDSPIKESCHEDULER_H_ 00003 00004 #include <vector> 00005 00006 #include "globaldefinitions.h" 00007 #include "SpikeScheduler.h" 00008 #include "MPIOutputBuffer.h" 00009 #include "TargetNodesMap.h" 00010 00011 using std::vector; 00012 00014 00027 class DistributedSpikeScheduler : public SpikeScheduler 00028 { 00029 public: 00030 00032 00039 DistributedSpikeScheduler(SpikeScheduler &localScheduler, 00040 TargetNodesMap &targetNodesMap, 00041 MPIOutputBufferVector &mpiOutputBuffers, 00042 int numLocalEngines = 1); 00043 00044 virtual ~DistributedSpikeScheduler(); 00045 00047 /* 00048 * It is invoked by the SingleThreadSimEngine when some advancing spiking object generates a spike. 00049 * 00050 * \param senderid Identifier of the sim object that emits the spike. 00051 * \param offsetFraction The exact moment in time when the spike occured is given by t + offsetFraction * dt 00052 * \param engine engineid of the local engine where sender object belongs (used in multi-threaded case, otherwise 0). 00053 */ 00054 virtual void scheduleSpike(local_objectid_t senderid, float offsetFraction, engineid_t engine = 0); 00055 00057 00066 virtual void deliverSpikes(SpikeReceiverList &listActiveSynapses, engineid_t engine, double time, int stepOffset = 0); 00067 00069 virtual void reset(); 00070 00072 00078 virtual void advance(engineid_t engine = 0); 00079 00081 /* 00082 * Used to update the state of the propagated spike buffers etc. 00083 */ 00084 virtual void nextCycle(); 00085 00086 00087 protected: 00088 00090 SpikeScheduler &_localScheduler; 00091 00093 MPIOutputBufferVector &_mpiOutputBuffers; 00094 00096 TargetNodesMap & nodesMap; 00097 00099 00102 vector<int> engineClocks; 00103 00105 00108 int nLocalEngines; 00109 00110 }; 00111 00112 #endif /*DISTRIBUTEDSPIKESCHEDULER_H_*/