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