summaryrefslogtreecommitdiff
path: root/core/index_randomspike.hpp
diff options
context:
space:
mode:
authorJan Huwald <jh@sotun.de>2012-05-07 20:01:51 (GMT)
committerJan Huwald <jh@sotun.de>2012-05-07 20:01:51 (GMT)
commit420d2ef464d4a741028e132e662d5626806a41f5 (patch)
tree1aca6eb512e4ed0fb5f3c10c528cb998b6ffd695 /core/index_randomspike.hpp
Initial commitHEADmaster
Diffstat (limited to 'core/index_randomspike.hpp')
-rw-r--r--core/index_randomspike.hpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/core/index_randomspike.hpp b/core/index_randomspike.hpp
new file mode 100644
index 0000000..a40a99b
--- /dev/null
+++ b/core/index_randomspike.hpp
@@ -0,0 +1,52 @@
+#ifndef zpkaBa96qijSBV6tlRldSMrZ3N0
+#define zpkaBa96qijSBV6tlRldSMrZ3N0
+
+#include "index_spike_base.hpp"
+
+template<>
+struct Index<RandomSpike> : CommonSpikeIndex<Ptr<RandomSpike>::ptr_t> {
+ typedef boost::tuple<> con_arg_t;
+ Index() :
+ CommonSpikeIndex("randomspike"),
+ eventTime("index_randomspike_eventtime", maxSpikes),
+ maxEventTime("index_randomspike_maxeventtime", Time::beforeAll())
+ {}
+ Index(const con_arg_t &) :
+ CommonSpikeIndex("randomspike"),
+ eventTime("index_randomspike_eventtime", maxSpikes),
+ maxEventTime("index_randomspike_maxeventtime", Time::beforeAll())
+ {}
+
+ // using Index<SpikeBaseCase>::first;
+
+ // write
+ template<typename SrcQuant>
+ inline ptr_t add(Time time, Time eventTime, SrcQuant src);
+
+ virtual void sync() {
+ CommonSpikeIndex::sync();
+ eventTime.barrierRead() = eventTime.barrierWrite() = time.barrierWrite();
+ eventTime.sync();
+ maxEventTime.sync();
+ }
+
+ // data
+ Vector<Time> eventTime;
+ Checkpoint<Time, maxNeurons> maxEventTime;
+};
+
+template<typename IllegalImpl>
+Index<RandomSpike>::ptr_t Index<RandomSpike>::
+add(Time, Time, IllegalImpl) DO_NOT_CALL
+
+template<>
+Index<RandomSpike>::ptr_t Index<RandomSpike>::
+add(Time t_in, Time t_out, neuron_ptr_t aSrc) {
+ ptr_t ptr(CommonSpikeIndex::add(t_in, t_out, aSrc));
+ eventTime.set(ptr, t_out);
+ maxEventTime.set(t_in, aSrc(),
+ std::max(t_out, maxEventTime.getValue(t_in, aSrc())));
+ return ptr;
+}
+
+#endif // zpkaBa96qijSBV6tlRldSMrZ3N0
contact: Jan Huwald // Impressum