DistributedSpikeScheduler.cpp

Go to the documentation of this file.
00001 #include "DistributedSpikeScheduler.h"
00002 
00003 #include <iostream>
00004 
00005 using std::cout;
00006 using std::endl;
00007 using std::cerr;
00008 
00009 DistributedSpikeScheduler::DistributedSpikeScheduler(SpikeScheduler &localScheduler,
00010         TargetNodesMap & targetNodesMap,
00011         MPIOutputBufferVector &mpiOutputBuffers,
00012         int numLocalEngines) :
00013         _localScheduler(localScheduler), _mpiOutputBuffers(mpiOutputBuffers),
00014         nodesMap(targetNodesMap), nLocalEngines(numLocalEngines)
00015 {
00016     engineClocks.resize(nLocalEngines, int(0));
00017 }
00018 
00019 DistributedSpikeScheduler::~DistributedSpikeScheduler()
00020 {}
00021 
00022 void DistributedSpikeScheduler::scheduleSpike(local_objectid_t senderid, float offsetFraction, engineid_t engine)
00023 {
00024 
00025     TargetNodesMap::const_iterator node_it;
00026     if ( nodesMap.hasNodes(senderid, engine) )
00027         for ( node_it = nodesMap.begin(senderid, engine) ; node_it != nodesMap.end(senderid, engine) ; ++node_it)  {            
00028             _mpiOutputBuffers[*node_it].spikeBuf().appendSpike(senderid, engineClocks[engine], engine);
00029         }
00030 
00031     _localScheduler.scheduleSpike(senderid, offsetFraction, engine);
00032 }
00033 
00034 void DistributedSpikeScheduler::deliverSpikes(SpikeReceiverList &listActiveSynapses, engineid_t engine, double time, int stepOffset)
00035 {
00036     _localScheduler.deliverSpikes(listActiveSynapses, engine, time, stepOffset);
00037 }
00038 
00039 void DistributedSpikeScheduler::reset()
00040 {
00041     _localScheduler.reset();
00042     for (int i = 0; i < nLocalEngines; ++i) {
00043         engineClocks[i] = 0;
00044     }
00045 }
00046 
00047 void DistributedSpikeScheduler::advance(engineid_t engine)
00048 {
00049     _localScheduler.advance(engine);
00050     engineClocks[engine]++;
00051 }
00052 
00053 void DistributedSpikeScheduler::nextCycle()
00054 {
00055     _localScheduler.nextCycle();
00056     for (int i = 0 ; i < nLocalEngines ; ++i) {
00057         engineClocks[i] = 0;
00058     }
00059 }

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