Skip to content

Commit eb43fef

Browse files
authored
Merge pull request #690 from UWB-Biocomputing/issue-659-add-registerVariableForVectorRecordableBaseForHdf5Recorder
Implement Hdf5Recorder::registerVariable() for vector of RecordableBase
2 parents ed26362 + 8951a9c commit eb43fef

File tree

14 files changed

+75
-518
lines changed

14 files changed

+75
-518
lines changed

Simulator/Core/Model.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ void Model::setupSim()
104104
// Init radii and rates history matrices with default values
105105
if (recorder_ != nullptr) {
106106
recorder_->init();
107-
recorder_->initDefaultValues();
108107
}
109108

110109
// Creates all the vertices and generates data for them.

Simulator/Recorders/Hdf5Recorder.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,22 @@ void Hdf5Recorder::compileHistories()
225225
void Hdf5Recorder::registerVariable(const string &varName, RecordableBase &recordVar,
226226
UpdatedType variableType)
227227
{
228-
// Create a singleVariableInfo object for the variable
229-
singleVariableInfo hdf5VarInfo(varName, recordVar, variableType);
228+
// Create a hdf5VariableInfo object for the variable
229+
hdf5VariableInfo hdf5VarInfo(varName, recordVar, variableType);
230230

231231
// Add the variable information to the variableTable_
232232
variableTable_.push_back(hdf5VarInfo);
233233
}
234+
235+
/// Register a vector of instance of a class derived from RecordableBase
236+
void Hdf5Recorder::registerVariable(const string &varName, vector<RecordableBase *> &recordVars,
237+
UpdatedType variableType)
238+
{
239+
for (int i = 0; i < recordVars.size(); i++) {
240+
string variableID = varName + to_string(i);
241+
RecordableBase &address = *recordVars[i];
242+
// add a new variable into the table
243+
variableTable_.push_back(hdf5VariableInfo(variableID, address, variableType));
244+
}
245+
}
234246
#endif // HDF5

Simulator/Recorders/Hdf5Recorder.h

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,6 @@ class Hdf5Recorder : public Recorder {
4040
/// @param[in] stateOutputFileName File name to save histories
4141
virtual void init() override;
4242

43-
/// Init radii and rates history matrices with default values
44-
virtual void initDefaultValues() override
45-
{
46-
}
47-
48-
/// Init radii and rates history matrices with current radii and rates
49-
virtual void initValues() override
50-
{
51-
}
52-
53-
/// Get the current radii and rates vlaues
54-
virtual void getValues() override
55-
{
56-
}
57-
5843
/// Terminate process
5944
virtual void term() override;
6045

@@ -85,15 +70,10 @@ class Hdf5Recorder : public Recorder {
8570

8671
/// Register a vector of instance of a class derived from RecordableBase.
8772
virtual void registerVariable(const string &varName, vector<RecordableBase *> &recordVars,
88-
UpdatedType variableType) override
89-
{
90-
}
73+
UpdatedType variableType) override;
9174

92-
virtual void initDataSet()
93-
{
94-
}
9575

96-
struct singleVariableInfo {
76+
struct hdf5VariableInfo {
9777
/// the name of each variable
9878
string variableName_;
9979

@@ -114,7 +94,7 @@ class Hdf5Recorder : public Recorder {
11494
RecordableBase &variableLocation_;
11595

11696
// Constructor accepting the variable name, the address of recorded variable, the updated type
117-
singleVariableInfo(const string &name, RecordableBase &location, UpdatedType variableType) :
97+
hdf5VariableInfo(const string &name, RecordableBase &location, UpdatedType variableType) :
11898
variableLocation_(location), variableName_(name), variableType_(variableType)
11999
{
120100
dataType_ = location.getDataType();
@@ -184,7 +164,7 @@ class Hdf5Recorder : public Recorder {
184164
}
185165

186166
// Accessor method to retrieve variableTable_
187-
const vector<singleVariableInfo> &getVariableTable() const
167+
const vector<hdf5VariableInfo> &getVariableTable() const
188168
{
189169
return variableTable_;
190170
}
@@ -201,15 +181,8 @@ class Hdf5Recorder : public Recorder {
201181
// Member variables for HDF5 datasets
202182
H5File *resultOut_;
203183

204-
// Keep track of where we are in incrementally writing spikes
205-
vector<hsize_t> offsetSpikesProbedNeurons_;
206-
// spikes history - history of accumulated spikes count of all neurons (10 ms bin)
207-
vector<int> spikesHistory_;
208-
// track spikes count of probed neurons
209-
vector<vector<uint64_t>> spikesProbedNeurons_;
210-
211184
/// List of registered variables for recording
212-
vector<singleVariableInfo> variableTable_;
185+
vector<hdf5VariableInfo> variableTable_;
213186
// Other member functions...
214187
};
215188

Simulator/Recorders/NG911/Xml911Recorder.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,6 @@
1515
#include "Connections911.h"
1616
// #include "Global.h"
1717

18-
/// Init radii and rates history matrices with default values
19-
void Xml911Recorder::initDefaultValues()
20-
{
21-
}
22-
23-
/// Init radii and rates history matrices with current radii and rates
24-
void Xml911Recorder::initValues()
25-
{
26-
}
27-
28-
/// Get the current radii and rates vlaues
29-
void Xml911Recorder::getValues()
30-
{
31-
}
32-
3318
/// Compile history information in every epoch
3419
///
3520
/// @param[in] vertices The entire list of vertices.

Simulator/Recorders/NG911/Xml911Recorder.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,6 @@ class Xml911Recorder : public XmlRecorder {
2828
return new Xml911Recorder();
2929
}
3030

31-
/// Init radii and rates history matrices with default values
32-
virtual void initDefaultValues() override;
33-
34-
/// Init radii and rates history matrices with current radii and rates
35-
virtual void initValues() override;
36-
37-
/// Get the current radii and rates vlaues
38-
virtual void getValues() override;
39-
4031
/// Compile history information in every epoch
4132
///
4233
/// @param[in] vertices The entire list of vertices.

Simulator/Recorders/Neuro/Hdf5GrowthRecorder.cpp

Lines changed: 0 additions & 218 deletions
This file was deleted.

0 commit comments

Comments
 (0)