Please, help us to better know about our user community by answering the following short survey: https://forms.gle/wpyrxWi18ox9Z5ae9
Spike.h
Go to the documentation of this file.
1 /* @author János Végh (jvegh)
2 * @bug No known bugs.
3 */
8 #ifndef SPIKE_H
9 #define SPIKE_H
10 //#include <iostream> // for bit fields
11 //#include <sstream>
12 //#include <bitset> // std::bitset
13 
14 #include "NeurerConfig.h"
15 #include "Utils.h"
16 using namespace std;
17 
28 struct SpikePoint{unsigned int Time; signed int Amplitude;};
29 typedef vector<SpikePoint> SpikeVector;
30 
31 
44 /*
45  * Performing floating calculations is a serious limiting factor of computing simulation.
46  * This class uses a special method that the factors are in units of THOUSAND
47  * The integer values to be scaled are multiplied by that factor, then divided by THOUSAND
48  * If THOUSAND=1024 was selected in the config file, the division is replaced by shifting
49  * This leads to 2.4% deviation from the 'true' value, and much quicker operation.
50  *
51  * Spikes may have two forms, depending on a configurable variable.
52  * If SPIKE_DETAILED is true:
53  * a real current pulse is delivered, which is integrated in the synapses,
54  * (a broken line, with adjustable time and aplitude factors)
55  * otherwise only the major information is delived
56  *
57  * In both cases the arrival time is delivered, per synapses to the spikes
58  * (this is the logical time: the message
59  * A spike is sent by AbstractNeurer#Fire to all (postsynaptic) neurons, the synapses of which are listed
60  * in AbstractNeurer#m_Axons. The spike message is delivered immediately, but it is put
61  * by the destination neuron in a time-ordered queue, where it will seemingly arrive
62  * exactly at the wanted time, and will be delivered to the correct synapsys, where
63  * it will be processed as described at scSynapticConnect.
64  */
65 
66 class Spike
67 {
68  public:
69  Spike(const SpikeVector& SpikeForm, uint16_t AmplitudeFactor=THOUSAND, uint16_t TimeFactor=THOUSAND ):
70  mSpikeTable(SpikeForm)
71  ,mAmplitudeFactor(AmplitudeFactor)
72  ,mTimeFactor(TimeFactor)
73  ,mSpikeLength(SpikeForm.size())
74  {
75  }
76  uint16_t AmplitudeFactor_Get(void) {return mAmplitudeFactor;}
77  uint16_t TimeFactor_Get(void) {return mTimeFactor;}
78  uint16_t Time_Get(int n){assert(n<mSpikeLength); return (mSpikeTable[n].Time * mTimeFactor)/THOUSAND;}
79  uint16_t Amplitude_Get(int n){assert(n<mSpikeLength); return (mSpikeTable[n].Amplitude * mAmplitudeFactor)/THOUSAND;}
80 // void NextSpikePoint_Get(SpikePoint& P);
81  virtual
82  ~Spike(){}
83 
84 protected:
85  const SpikeVector& mSpikeTable; // Points to a spike table
86  uint16_t mAmplitudeFactor;
87  uint16_t mTimeFactor;
88  int mSpikeIndex;
89  int mSpikeLength; // Just to know size
90  };
91 
92 #endif // SPIKE_H
Spike::mAmplitudeFactor
uint16_t mAmplitudeFactor
Amplitude multiplier of the current spike.
Definition: Spike.h:86
SpikePoint
The form of an action potential is stored in 2-item vectors, a simple X-Y value pair The time is give...
Definition: Spike.h:28
Spike::mTimeFactor
uint16_t mTimeFactor
Time multiplier of the current spike.
Definition: Spike.h:87
NeurerConfig.h
Topology information for the Neurer simulator.
Spike
Handles spike tables for the neurons.
Definition: Spike.h:66