Skip to content

Commit ed7a740

Browse files
authored
Add missing variables in INITIAL block (#14)
When calling functions or procedures in the INITIAL block, we need to define additional variables in `nrn_init` so the compilation succeeds.
1 parent d171027 commit ed7a740

File tree

9 files changed

+36
-0
lines changed

9 files changed

+36
-0
lines changed

cnexp_scalar/neuron/leonhard.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,10 @@ namespace neuron {
178178
auto inst = make_instance_leonhard(_lmr);
179179
auto node_data = make_node_data_leonhard(*_nt, *_ml_arg);
180180
auto nodecount = _ml_arg->nodecount;
181+
auto* const _ml = &_lmr;
182+
auto* _thread = _ml_arg->_thread;
181183
for (int id = 0; id < nodecount; id++) {
184+
auto& _ppvar = _ml_arg->pdata[id];
182185
inst.x[id] = 42.0;
183186
}
184187
}
@@ -189,6 +192,8 @@ namespace neuron {
189192
auto inst = make_instance_leonhard(_lmr);
190193
auto node_data = make_node_data_leonhard(*_nt, *_ml_arg);
191194
auto nodecount = _ml_arg->nodecount;
195+
auto* const _ml = &_lmr;
196+
auto* _thread = _ml_arg->_thread;
192197
for (int id = 0; id < nodecount; id++) {
193198
inst.x[id] = inst.x[id] + (1.0 - exp(_nt->_dt * ( -1.0))) * ( -(0.0) / ( -1.0) - inst.x[id]);
194199
}

func_proc/coreneuron/func_proc.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ namespace coreneuron {
262262
#if NRN_PRCELLSTATE
263263
inst->v_unused[id] = v;
264264
#endif
265+
set_a_x_test_func_proc(id, pnodecount, inst, data, indexes, thread, nt, v);
265266
}
266267
}
267268
}

func_proc/neuron/func_proc.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,11 @@ namespace neuron {
363363
auto inst = make_instance_test_func_proc(_lmr);
364364
auto node_data = make_node_data_test_func_proc(*_nt, *_ml_arg);
365365
auto nodecount = _ml_arg->nodecount;
366+
auto* const _ml = &_lmr;
367+
auto* _thread = _ml_arg->_thread;
366368
for (int id = 0; id < nodecount; id++) {
369+
auto& _ppvar = _ml_arg->pdata[id];
370+
set_a_x_test_func_proc(_ml, inst, id, _ppvar, _thread, _nt);
367371
}
368372
}
369373

func_proc_pnt/neuron/func_proc_pnt.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,10 @@ namespace neuron {
289289
auto inst = make_instance_test_func_proc_pnt(_lmr);
290290
auto node_data = make_node_data_test_func_proc_pnt(*_nt, *_ml_arg);
291291
auto nodecount = _ml_arg->nodecount;
292+
auto* const _ml = &_lmr;
293+
auto* _thread = _ml_arg->_thread;
292294
for (int id = 0; id < nodecount; id++) {
295+
auto& _ppvar = _ml_arg->pdata[id];
293296
}
294297
}
295298

global_breakpoint/neuron/leonhard.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,10 @@ namespace neuron {
179179
auto inst = make_instance_leonhard(_lmr);
180180
auto node_data = make_node_data_leonhard(*_nt, *_ml_arg);
181181
auto nodecount = _ml_arg->nodecount;
182+
auto* const _ml = &_lmr;
183+
auto* _thread = _ml_arg->_thread;
182184
for (int id = 0; id < nodecount; id++) {
185+
auto& _ppvar = _ml_arg->pdata[id];
183186
inst.x[id] = 42.0;
184187
}
185188
}
@@ -190,6 +193,8 @@ namespace neuron {
190193
auto inst = make_instance_leonhard(_lmr);
191194
auto node_data = make_node_data_leonhard(*_nt, *_ml_arg);
192195
auto nodecount = _ml_arg->nodecount;
196+
auto* const _ml = &_lmr;
197+
auto* _thread = _ml_arg->_thread;
193198
for (int id = 0; id < nodecount; id++) {
194199
inst.x[id] = inst.global->c;
195200
}

nonspecific_current/neuron/leonhard.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,10 @@ namespace neuron {
174174
auto inst = make_instance_leonhard(_lmr);
175175
auto node_data = make_node_data_leonhard(*_nt, *_ml_arg);
176176
auto nodecount = _ml_arg->nodecount;
177+
auto* const _ml = &_lmr;
178+
auto* _thread = _ml_arg->_thread;
177179
for (int id = 0; id < nodecount; id++) {
180+
auto& _ppvar = _ml_arg->pdata[id];
178181
}
179182
}
180183

@@ -193,6 +196,8 @@ namespace neuron {
193196
auto inst = make_instance_leonhard(_lmr);
194197
auto node_data = make_node_data_leonhard(*_nt, *_ml_arg);
195198
auto nodecount = _ml_arg->nodecount;
199+
auto* const _ml = &_lmr;
200+
auto* _thread = _ml_arg->_thread;
196201
for (int id = 0; id < nodecount; id++) {
197202
int node_id = node_data.nodeindices[id];
198203
double v = node_data.node_voltages[node_id];
@@ -212,6 +217,8 @@ namespace neuron {
212217
auto inst = make_instance_leonhard(_lmr);
213218
auto node_data = make_node_data_leonhard(*_nt, *_ml_arg);
214219
auto nodecount = _ml_arg->nodecount;
220+
auto* const _ml = &_lmr;
221+
auto* _thread = _ml_arg->_thread;
215222
for (int id = 0; id < nodecount; id++) {
216223
}
217224
}

parameter/neuron/neuron_variables.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,10 @@ namespace neuron {
177177
auto inst = make_instance_NeuronVariables(_lmr);
178178
auto node_data = make_node_data_NeuronVariables(*_nt, *_ml_arg);
179179
auto nodecount = _ml_arg->nodecount;
180+
auto* const _ml = &_lmr;
181+
auto* _thread = _ml_arg->_thread;
180182
for (int id = 0; id < nodecount; id++) {
183+
auto& _ppvar = _ml_arg->pdata[id];
181184
}
182185
}
183186

@@ -187,6 +190,8 @@ namespace neuron {
187190
auto inst = make_instance_NeuronVariables(_lmr);
188191
auto node_data = make_node_data_NeuronVariables(*_nt, *_ml_arg);
189192
auto nodecount = _ml_arg->nodecount;
193+
auto* const _ml = &_lmr;
194+
auto* _thread = _ml_arg->_thread;
190195
for (int id = 0; id < nodecount; id++) {
191196
inst.range_celsius[id] = *(inst.celsius);
192197
}

parameter/neuron/test_parameter.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,10 @@ namespace neuron {
198198
auto inst = make_instance_test_parameter(_lmr);
199199
auto node_data = make_node_data_test_parameter(*_nt, *_ml_arg);
200200
auto nodecount = _ml_arg->nodecount;
201+
auto* const _ml = &_lmr;
202+
auto* _thread = _ml_arg->_thread;
201203
for (int id = 0; id < nodecount; id++) {
204+
auto& _ppvar = _ml_arg->pdata[id];
202205
}
203206
}
204207

point_process/neuron/test_pp.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,10 @@ namespace neuron {
194194
auto inst = make_instance_test_pp(_lmr);
195195
auto node_data = make_node_data_test_pp(*_nt, *_ml_arg);
196196
auto nodecount = _ml_arg->nodecount;
197+
auto* const _ml = &_lmr;
198+
auto* _thread = _ml_arg->_thread;
197199
for (int id = 0; id < nodecount; id++) {
200+
auto& _ppvar = _ml_arg->pdata[id];
198201
}
199202
}
200203

0 commit comments

Comments
 (0)