CARLsim  6.1.0
CARLsim: a GPU-accelerated SNN simulator
neuron_monitor_core.h
Go to the documentation of this file.
1 
51 #ifndef _NEURON_MON_CORE_H_
52 #define _NEURON_MON_CORE_H_
53 
54 
55 #include <carlsim_datastructures.h> // NeuronMonMode
56 #include <stdio.h> // FILE
57 #include <vector> // std::vector
58 
59 class SNN; // forward declaration of SNN class
60 
62 public:
64  NeuronMonitorCore(SNN* snn, int monitorId, int grpId);
65 
68 
70  std::vector<std::vector<float> > getVectorV();
71  std::vector<std::vector<float> > getVectorU();
72  std::vector<std::vector<float> > getVectorI();
73 
75  bool isRecording() { return recordSet_; }
76 
78  void pushNeuronState(int neurId, float V, float U, float I);
79 
81  void startRecording();
82 
84  void stopRecording();
85 
87  void clear();
88 
90  void setNeuronFileId(FILE* neuronFileId);
91 
93  FILE* getNeuronFileId() { return neuronFileId_; }
94 
95 
96  //{ LN20201118 extensions
97 
99  bool getPersistentData() { return persistentData_; }
100 
102  void setPersistentData(bool persistentData) { persistentData_ = persistentData; }
103 
104  // }
105 
106 
108  long int getLastUpdated() { return neuronMonLastUpdated_; }
109 
111  void setLastUpdated(long int lastUpdate) { neuronMonLastUpdated_ = lastUpdate; }
112 
114  bool isBufferBig();
115 
117  long int getBufferSize();
118 
120  long int getAccumTime();
121 
122  void writeNeuronFileHeader();
123 
125  void print(bool meanOnly);
126 
127  private:
129  void init();
130 
132  bool needToWriteFileHeader_;
133 
134  SNN* snn_;
135  int monitorId_;
136  int grpId_;
137  int nNeurons_;
138 
139  FILE* neuronFileId_;
140  int neuronFileSignature_;
141  float neuronFileVersion_;
142 
144  std::vector<std::vector<float> > vectorV_;
145  std::vector<std::vector<float> > vectorU_;
146  std::vector<std::vector<float> > vectorI_;
147 
148  bool recordSet_;
149  long int startTime_;
150  long int startTimeLast_;
151  long int stopTime_;
152  long int totalTime_;
153  long int accumTime_;
154 
155  long int neuronMonLastUpdated_;
156 
158  bool persistentData_;
159 
161  bool userHasBeenWarned_;
162 
163  // file pointers for error logging
164  const FILE* fpInf_;
165  const FILE* fpErr_;
166  const FILE* fpDeb_;
167  const FILE* fpLog_;
168 };
169 #endif
void pushNeuronState(int neurId, float V, float U, float I)
inserts a (time,neurId) tupel into the D Neuron State vector
FILE * getNeuronFileId()
returns a pointer to the neuron state file
~NeuronMonitorCore()
destructor, cleans up all the memory upon object deletion
bool isRecording()
returns recording status
NeuronMonitorCore(SNN *snn, int monitorId, int grpId)
constructor (called by CARLsim::setNeuronMonitor)
void print(bool meanOnly)
prints neuron states in human-readable format
long int getBufferSize()
returns the approximate size of the state vectors in bytes
std::vector< std::vector< float > > getVectorV()
returns the Neuron state vector
long int getLastUpdated()
returns timestamp of last NeuronMonitor update
void stopRecording()
stops recording Neuron state
bool getPersistentData()
returns status of PersistentData mode
std::vector< std::vector< float > > getVectorU()
std::vector< std::vector< float > > getVectorI()
void setPersistentData(bool persistentData)
sets status of PersistentData mode
void setNeuronFileId(FILE *neuronFileId)
sets pointer to Neuron file
void clear()
deletes data from the neuron state vector
Contains all of CARLsim&#39;s core functionality.
Definition: snn.h:138
void startRecording()
starts recording Neuron state
bool isBufferBig()
returns true if state buffers are close to maxAllowedBufferSize
void setLastUpdated(long int lastUpdate)
sets timestamp of last NeuronMonitor update
long int getAccumTime()
returns the total accumulated time