CARLsim  5.0.0
CARLsim: a GPU-accelerated SNN simulator
neuron_monitor_core.h
Go to the documentation of this file.
1 
50 #ifndef _NEURON_MON_CORE_H_
51 #define _NEURON_MON_CORE_H_
52 
53 #include <carlsim_datastructures.h> // NeuronMonMode
54 #include <stdio.h> // FILE
55 #include <vector> // std::vector
56 
57 class SNN; // forward declaration of SNN class
58 
60 public:
62  NeuronMonitorCore(SNN* snn, int monitorId, int grpId);
63 
66 
68  std::vector<std::vector<float> > getVectorV();
69  std::vector<std::vector<float> > getVectorU();
70  std::vector<std::vector<float> > getVectorI();
71 
73  bool isRecording() { return recordSet_; }
74 
76  void pushNeuronState(int neurId, float V, float U, float I);
77 
79  void startRecording();
80 
82  void stopRecording();
83 
85  void clear();
86 
88  void setNeuronFileId(FILE* neuronFileId);
89 
91  FILE* getNeuronFileId() { return neuronFileId_; }
92 
94  long int getLastUpdated() { return neuronMonLastUpdated_; }
95 
97  void setLastUpdated(long int lastUpdate) { neuronMonLastUpdated_ = lastUpdate; }
98 
100  bool isBufferBig();
101 
103  long int getBufferSize();
104 
106  long int getAccumTime();
107 
108  void writeNeuronFileHeader();
109 
111  void print();
112 
113  private:
115  void init();
116 
118  bool needToWriteFileHeader_;
119 
120  SNN* snn_;
121  int monitorId_;
122  int grpId_;
123  int nNeurons_;
124 
125  FILE* neuronFileId_;
126  int neuronFileSignature_;
127  float neuronFileVersion_;
128 
130  std::vector<std::vector<float> > vectorV_;
131  std::vector<std::vector<float> > vectorU_;
132  std::vector<std::vector<float> > vectorI_;
133 
134  bool recordSet_;
135  long int startTime_;
136  long int startTimeLast_;
137  long int stopTime_;
138  long int totalTime_;
139  long int accumTime_;
140 
141  long int neuronMonLastUpdated_;
142 
144  bool persistentData_;
145 
147  bool userHasBeenWarned_;
148 
149  // file pointers for error logging
150  const FILE* fpInf_;
151  const FILE* fpErr_;
152  const FILE* fpDeb_;
153  const FILE* fpLog_;
154 };
155 #endif
NeuronMonitorCore::~NeuronMonitorCore
~NeuronMonitorCore()
destructor, cleans up all the memory upon object deletion
Definition: neuron_monitor_core.cpp:94
NeuronMonitorCore::NeuronMonitorCore
NeuronMonitorCore(SNN *snn, int monitorId, int grpId)
constructor (called by CARLsim::setNeuronMonitor)
Definition: neuron_monitor_core.cpp:57
carlsim_datastructures.h
NeuronMonitorCore::writeNeuronFileHeader
void writeNeuronFileHeader()
Definition: neuron_monitor_core.cpp:200
NeuronMonitorCore::getLastUpdated
long int getLastUpdated()
returns timestamp of last NeuronMonitor update
Definition: neuron_monitor_core.h:94
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:118
NeuronMonitorCore::stopRecording
void stopRecording()
stops recording Neuron state
Definition: neuron_monitor_core.cpp:156
NeuronMonitorCore::isRecording
bool isRecording()
returns recording status
Definition: neuron_monitor_core.h:73
NeuronMonitorCore::getBufferSize
long int getBufferSize()
returns the approximate size of the state vectors in bytes
Definition: neuron_monitor_core.cpp:230
NeuronMonitorCore::getVectorV
std::vector< std::vector< float > > getVectorV()
returns the Neuron state vector
Definition: neuron_monitor_core.cpp:255
NeuronMonitorCore::setNeuronFileId
void setNeuronFileId(FILE *neuronFileId)
sets pointer to Neuron file
Definition: neuron_monitor_core.cpp:178
NeuronMonitorCore::print
void print()
prints neuron states in human-readable format
Definition: neuron_monitor_core.cpp:270
NeuronMonitorCore
Definition: neuron_monitor_core.h:59
NeuronMonitorCore::isBufferBig
bool isBufferBig()
returns true if state buffers are close to maxAllowedBufferSize
Definition: neuron_monitor_core.cpp:240
NeuronMonitorCore::setLastUpdated
void setLastUpdated(long int lastUpdate)
sets timestamp of last NeuronMonitor update
Definition: neuron_monitor_core.h:97
NeuronMonitorCore::getVectorU
std::vector< std::vector< float > > getVectorU()
Definition: neuron_monitor_core.cpp:260
NeuronMonitorCore::getVectorI
std::vector< std::vector< float > > getVectorI()
Definition: neuron_monitor_core.cpp:265
SNN
Contains all of CARLsim's core functionality.
Definition: snn.h:115
NeuronMonitorCore::getAccumTime
long int getAccumTime()
returns the total accumulated time
Definition: neuron_monitor_core.cpp:174
NeuronMonitorCore::getNeuronFileId
FILE * getNeuronFileId()
returns a pointer to the neuron state file
Definition: neuron_monitor_core.h:91
NeuronMonitorCore::clear
void clear()
deletes data from the neuron state vector
Definition: neuron_monitor_core.cpp:101
NeuronMonitorCore::startRecording
void startRecording()
starts recording Neuron state
Definition: neuron_monitor_core.cpp:126