From ed7a7401f27bab1363a72042acd7f42e0e233ee4 Mon Sep 17 00:00:00 2001 From: JCGoran Date: Mon, 6 May 2024 12:00:15 +0200 Subject: [PATCH] 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. --- cnexp_scalar/neuron/leonhard.cpp | 5 +++++ func_proc/coreneuron/func_proc.cpp | 1 + func_proc/neuron/func_proc.cpp | 4 ++++ func_proc_pnt/neuron/func_proc_pnt.cpp | 3 +++ global_breakpoint/neuron/leonhard.cpp | 5 +++++ nonspecific_current/neuron/leonhard.cpp | 7 +++++++ parameter/neuron/neuron_variables.cpp | 5 +++++ parameter/neuron/test_parameter.cpp | 3 +++ point_process/neuron/test_pp.cpp | 3 +++ 9 files changed, 36 insertions(+) diff --git a/cnexp_scalar/neuron/leonhard.cpp b/cnexp_scalar/neuron/leonhard.cpp index c3048b2..7b5820d 100644 --- a/cnexp_scalar/neuron/leonhard.cpp +++ b/cnexp_scalar/neuron/leonhard.cpp @@ -178,7 +178,10 @@ namespace neuron { auto inst = make_instance_leonhard(_lmr); auto node_data = make_node_data_leonhard(*_nt, *_ml_arg); auto nodecount = _ml_arg->nodecount; + auto* const _ml = &_lmr; + auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { + auto& _ppvar = _ml_arg->pdata[id]; inst.x[id] = 42.0; } } @@ -189,6 +192,8 @@ namespace neuron { auto inst = make_instance_leonhard(_lmr); auto node_data = make_node_data_leonhard(*_nt, *_ml_arg); auto nodecount = _ml_arg->nodecount; + auto* const _ml = &_lmr; + auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { inst.x[id] = inst.x[id] + (1.0 - exp(_nt->_dt * ( -1.0))) * ( -(0.0) / ( -1.0) - inst.x[id]); } diff --git a/func_proc/coreneuron/func_proc.cpp b/func_proc/coreneuron/func_proc.cpp index 4c87abc..60871f2 100644 --- a/func_proc/coreneuron/func_proc.cpp +++ b/func_proc/coreneuron/func_proc.cpp @@ -262,6 +262,7 @@ namespace coreneuron { #if NRN_PRCELLSTATE inst->v_unused[id] = v; #endif + set_a_x_test_func_proc(id, pnodecount, inst, data, indexes, thread, nt, v); } } } diff --git a/func_proc/neuron/func_proc.cpp b/func_proc/neuron/func_proc.cpp index 08e19ab..d6a7fcc 100644 --- a/func_proc/neuron/func_proc.cpp +++ b/func_proc/neuron/func_proc.cpp @@ -363,7 +363,11 @@ namespace neuron { auto inst = make_instance_test_func_proc(_lmr); auto node_data = make_node_data_test_func_proc(*_nt, *_ml_arg); auto nodecount = _ml_arg->nodecount; + auto* const _ml = &_lmr; + auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { + auto& _ppvar = _ml_arg->pdata[id]; + set_a_x_test_func_proc(_ml, inst, id, _ppvar, _thread, _nt); } } diff --git a/func_proc_pnt/neuron/func_proc_pnt.cpp b/func_proc_pnt/neuron/func_proc_pnt.cpp index 9ef393b..6570453 100644 --- a/func_proc_pnt/neuron/func_proc_pnt.cpp +++ b/func_proc_pnt/neuron/func_proc_pnt.cpp @@ -289,7 +289,10 @@ namespace neuron { auto inst = make_instance_test_func_proc_pnt(_lmr); auto node_data = make_node_data_test_func_proc_pnt(*_nt, *_ml_arg); auto nodecount = _ml_arg->nodecount; + auto* const _ml = &_lmr; + auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { + auto& _ppvar = _ml_arg->pdata[id]; } } diff --git a/global_breakpoint/neuron/leonhard.cpp b/global_breakpoint/neuron/leonhard.cpp index 55c7ed2..148b5b7 100644 --- a/global_breakpoint/neuron/leonhard.cpp +++ b/global_breakpoint/neuron/leonhard.cpp @@ -179,7 +179,10 @@ namespace neuron { auto inst = make_instance_leonhard(_lmr); auto node_data = make_node_data_leonhard(*_nt, *_ml_arg); auto nodecount = _ml_arg->nodecount; + auto* const _ml = &_lmr; + auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { + auto& _ppvar = _ml_arg->pdata[id]; inst.x[id] = 42.0; } } @@ -190,6 +193,8 @@ namespace neuron { auto inst = make_instance_leonhard(_lmr); auto node_data = make_node_data_leonhard(*_nt, *_ml_arg); auto nodecount = _ml_arg->nodecount; + auto* const _ml = &_lmr; + auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { inst.x[id] = inst.global->c; } diff --git a/nonspecific_current/neuron/leonhard.cpp b/nonspecific_current/neuron/leonhard.cpp index f52e8a3..732dd52 100644 --- a/nonspecific_current/neuron/leonhard.cpp +++ b/nonspecific_current/neuron/leonhard.cpp @@ -174,7 +174,10 @@ namespace neuron { auto inst = make_instance_leonhard(_lmr); auto node_data = make_node_data_leonhard(*_nt, *_ml_arg); auto nodecount = _ml_arg->nodecount; + auto* const _ml = &_lmr; + auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { + auto& _ppvar = _ml_arg->pdata[id]; } } @@ -193,6 +196,8 @@ namespace neuron { auto inst = make_instance_leonhard(_lmr); auto node_data = make_node_data_leonhard(*_nt, *_ml_arg); auto nodecount = _ml_arg->nodecount; + auto* const _ml = &_lmr; + auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { int node_id = node_data.nodeindices[id]; double v = node_data.node_voltages[node_id]; @@ -212,6 +217,8 @@ namespace neuron { auto inst = make_instance_leonhard(_lmr); auto node_data = make_node_data_leonhard(*_nt, *_ml_arg); auto nodecount = _ml_arg->nodecount; + auto* const _ml = &_lmr; + auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { } } diff --git a/parameter/neuron/neuron_variables.cpp b/parameter/neuron/neuron_variables.cpp index 55eb84b..56187f6 100644 --- a/parameter/neuron/neuron_variables.cpp +++ b/parameter/neuron/neuron_variables.cpp @@ -177,7 +177,10 @@ namespace neuron { auto inst = make_instance_NeuronVariables(_lmr); auto node_data = make_node_data_NeuronVariables(*_nt, *_ml_arg); auto nodecount = _ml_arg->nodecount; + auto* const _ml = &_lmr; + auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { + auto& _ppvar = _ml_arg->pdata[id]; } } @@ -187,6 +190,8 @@ namespace neuron { auto inst = make_instance_NeuronVariables(_lmr); auto node_data = make_node_data_NeuronVariables(*_nt, *_ml_arg); auto nodecount = _ml_arg->nodecount; + auto* const _ml = &_lmr; + auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { inst.range_celsius[id] = *(inst.celsius); } diff --git a/parameter/neuron/test_parameter.cpp b/parameter/neuron/test_parameter.cpp index fe11229..6a56379 100644 --- a/parameter/neuron/test_parameter.cpp +++ b/parameter/neuron/test_parameter.cpp @@ -198,7 +198,10 @@ namespace neuron { auto inst = make_instance_test_parameter(_lmr); auto node_data = make_node_data_test_parameter(*_nt, *_ml_arg); auto nodecount = _ml_arg->nodecount; + auto* const _ml = &_lmr; + auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { + auto& _ppvar = _ml_arg->pdata[id]; } } diff --git a/point_process/neuron/test_pp.cpp b/point_process/neuron/test_pp.cpp index fc6a849..713b846 100644 --- a/point_process/neuron/test_pp.cpp +++ b/point_process/neuron/test_pp.cpp @@ -194,7 +194,10 @@ namespace neuron { auto inst = make_instance_test_pp(_lmr); auto node_data = make_node_data_test_pp(*_nt, *_ml_arg); auto nodecount = _ml_arg->nodecount; + auto* const _ml = &_lmr; + auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { + auto& _ppvar = _ml_arg->pdata[id]; } }