Skip to content

Commit

Permalink
Update references for working hh.mod (#13)
Browse files Browse the repository at this point in the history
* Update references for working hh.mod

---------

Co-authored-by: Luc Grosheintz <[email protected]>
  • Loading branch information
JCGoran and 1uc authored May 10, 2024
1 parent 247abd6 commit 00978a5
Show file tree
Hide file tree
Showing 11 changed files with 104 additions and 9 deletions.
13 changes: 13 additions & 0 deletions cnexp_array/neuron/leonhard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,14 @@ 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];
auto* _ppvar = _ml_arg->pdata[id];
auto v = node_data.node_voltages[node_id];
inst.v_unused[id] = v;
inst.x[id] = 42.0;
(inst.s+id*2)[static_cast<int>(0)] = 0.1;
(inst.s+id*2)[static_cast<int>(1)] = -1.0;
Expand All @@ -203,7 +210,13 @@ 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];
auto* _ppvar = _ml_arg->pdata[id];
auto v = node_data.node_voltages[node_id];
inst.x[id] = inst.x[id] + (1.0 - exp(_nt->_dt * ((((inst.s+id*2)[static_cast<int>(0)] + (inst.s+id*2)[static_cast<int>(1)]) * ((inst.z+id*3)[static_cast<int>(0)] * (inst.z+id*3)[static_cast<int>(1)] * (inst.z+id*3)[static_cast<int>(2)])) * (1.0)))) * ( -(0.0) / (((((inst.s+id*2)[static_cast<int>(0)] + (inst.s+id*2)[static_cast<int>(1)])) * (((((inst.z+id*3)[static_cast<int>(0)]) * ((inst.z+id*3)[static_cast<int>(1)])) * ((inst.z+id*3)[static_cast<int>(2)])))) * (1.0)) - inst.x[id]);
}
}
Expand Down
10 changes: 9 additions & 1 deletion cnexp_scalar/neuron/leonhard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,11 @@ namespace neuron {
auto* const _ml = &_lmr;
auto* _thread = _ml_arg->_thread;
for (int id = 0; id < nodecount; id++) {
auto& _ppvar = _ml_arg->pdata[id];

int node_id = node_data.nodeindices[id];
auto* _ppvar = _ml_arg->pdata[id];
auto v = node_data.node_voltages[node_id];
inst.v_unused[id] = v;
inst.x[id] = 42.0;
}
}
Expand All @@ -195,6 +199,10 @@ namespace neuron {
auto* const _ml = &_lmr;
auto* _thread = _ml_arg->_thread;
for (int id = 0; id < nodecount; id++) {

int node_id = node_data.nodeindices[id];
auto* _ppvar = _ml_arg->pdata[id];
auto v = node_data.node_voltages[node_id];
inst.x[id] = inst.x[id] + (1.0 - exp(_nt->_dt * ( -1.0))) * ( -(0.0) / ( -1.0) - inst.x[id]);
}
}
Expand Down
10 changes: 9 additions & 1 deletion func_proc/neuron/func_proc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,20 +331,23 @@ namespace neuron {

inline int set_x_42_test_func_proc(_nrn_mechanism_cache_range* _ml, test_func_proc_Instance& inst, size_t id, Datum* _ppvar, Datum* _thread, NrnThread* _nt) {
int ret_set_x_42 = 0;
auto v = inst.v_unused[id];
set_x_a_test_func_proc(_ml, inst, id, _ppvar, _thread, _nt, 42.0);
return ret_set_x_42;
}


inline int set_x_a_test_func_proc(_nrn_mechanism_cache_range* _ml, test_func_proc_Instance& inst, size_t id, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double a) {
int ret_set_x_a = 0;
auto v = inst.v_unused[id];
inst.x[id] = a;
return ret_set_x_a;
}


inline int set_a_x_test_func_proc(_nrn_mechanism_cache_range* _ml, test_func_proc_Instance& inst, size_t id, Datum* _ppvar, Datum* _thread, NrnThread* _nt) {
int ret_set_a_x = 0;
auto v = inst.v_unused[id];
double a;
a = inst.x[id];
return ret_set_a_x;
Expand All @@ -353,6 +356,7 @@ namespace neuron {

inline double x_plus_a_test_func_proc(_nrn_mechanism_cache_range* _ml, test_func_proc_Instance& inst, size_t id, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double a) {
double ret_x_plus_a = 0.0;
auto v = inst.v_unused[id];
ret_x_plus_a = inst.x[id] + a;
return ret_x_plus_a;
}
Expand All @@ -366,7 +370,11 @@ namespace neuron {
auto* const _ml = &_lmr;
auto* _thread = _ml_arg->_thread;
for (int id = 0; id < nodecount; id++) {
auto& _ppvar = _ml_arg->pdata[id];

int node_id = node_data.nodeindices[id];
auto* _ppvar = _ml_arg->pdata[id];
auto v = node_data.node_voltages[node_id];
inst.v_unused[id] = v;
set_a_x_test_func_proc(_ml, inst, id, _ppvar, _thread, _nt);
}
}
Expand Down
9 changes: 8 additions & 1 deletion func_proc_pnt/neuron/func_proc_pnt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,20 +265,23 @@ namespace neuron {

inline int set_x_42_test_func_proc_pnt(_nrn_mechanism_cache_range* _ml, test_func_proc_pnt_Instance& inst, size_t id, Datum* _ppvar, Datum* _thread, NrnThread* _nt) {
int ret_set_x_42 = 0;
auto v = inst.v_unused[id];
inst.x[id] = 42.0;
return ret_set_x_42;
}


inline int set_x_a_test_func_proc_pnt(_nrn_mechanism_cache_range* _ml, test_func_proc_pnt_Instance& inst, size_t id, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double a) {
int ret_set_x_a = 0;
auto v = inst.v_unused[id];
inst.x[id] = a;
return ret_set_x_a;
}


inline double x_plus_a_test_func_proc_pnt(_nrn_mechanism_cache_range* _ml, test_func_proc_pnt_Instance& inst, size_t id, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double a) {
double ret_x_plus_a = 0.0;
auto v = inst.v_unused[id];
ret_x_plus_a = inst.x[id] + a;
return ret_x_plus_a;
}
Expand All @@ -292,7 +295,11 @@ namespace neuron {
auto* const _ml = &_lmr;
auto* _thread = _ml_arg->_thread;
for (int id = 0; id < nodecount; id++) {
auto& _ppvar = _ml_arg->pdata[id];

int node_id = node_data.nodeindices[id];
auto* _ppvar = _ml_arg->pdata[id];
auto v = node_data.node_voltages[node_id];
inst.v_unused[id] = v;
}
}

Expand Down
10 changes: 9 additions & 1 deletion global_breakpoint/neuron/leonhard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,11 @@ namespace neuron {
auto* const _ml = &_lmr;
auto* _thread = _ml_arg->_thread;
for (int id = 0; id < nodecount; id++) {
auto& _ppvar = _ml_arg->pdata[id];

int node_id = node_data.nodeindices[id];
auto* _ppvar = _ml_arg->pdata[id];
auto v = node_data.node_voltages[node_id];
inst.v_unused[id] = v;
inst.x[id] = 42.0;
}
}
Expand All @@ -196,6 +200,10 @@ namespace neuron {
auto* const _ml = &_lmr;
auto* _thread = _ml_arg->_thread;
for (int id = 0; id < nodecount; id++) {

int node_id = node_data.nodeindices[id];
auto* _ppvar = _ml_arg->pdata[id];
auto v = node_data.node_voltages[node_id];
inst.x[id] = inst.global->c;
}
}
Expand Down
19 changes: 19 additions & 0 deletions hodgkin_huxley/neuron/hodhux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,12 @@ namespace neuron {
Prop * na_prop = need_memb(na_sym);
_ppvar[0] = _nrn_mechanism_get_param_handle(na_prop, 0);
_ppvar[1] = _nrn_mechanism_get_param_handle(na_prop, 3);
_ppvar[2] = _nrn_mechanism_get_param_handle(na_prop, 4);
Symbol * k_sym = hoc_lookup("k_ion");
Prop * k_prop = need_memb(k_sym);
_ppvar[3] = _nrn_mechanism_get_param_handle(k_prop, 0);
_ppvar[4] = _nrn_mechanism_get_param_handle(k_prop, 3);
_ppvar[5] = _nrn_mechanism_get_param_handle(k_prop, 4);
}


Expand Down Expand Up @@ -377,6 +379,7 @@ namespace neuron {

inline int states_hodhux(_nrn_mechanism_cache_range* _ml, hodhux_Instance& inst, size_t id, Datum* _ppvar, Datum* _thread, NrnThread* _nt) {
int ret_states = 0;
auto v = inst.v_unused[id];
rates_hodhux(_ml, inst, id, _ppvar, _thread, _nt, v);
inst.m[id] = inst.m[id] + inst.mexp[id] * (inst.minf[id] - inst.m[id]);
inst.h[id] = inst.h[id] + inst.hexp[id] * (inst.hinf[id] - inst.h[id]);
Expand Down Expand Up @@ -411,6 +414,7 @@ namespace neuron {

inline double vtrap_hodhux(_nrn_mechanism_cache_range* _ml, hodhux_Instance& inst, size_t id, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double x, double y) {
double ret_vtrap = 0.0;
auto v = inst.v_unused[id];
if (fabs(x / y) < 1e-6) {
ret_vtrap = y * (1.0 - x / y / 2.0);
} else {
Expand All @@ -425,7 +429,14 @@ namespace neuron {
auto inst = make_instance_hodhux(_lmr);
auto node_data = make_node_data_hodhux(*_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];
auto* _ppvar = _ml_arg->pdata[id];
auto v = node_data.node_voltages[node_id];
inst.v_unused[id] = v;
inst.ena[id] = (*inst.ion_ena[id]);
inst.ek[id] = (*inst.ion_ek[id]);
rates_hodhux(_ml, inst, id, _ppvar, _thread, _nt, v);
Expand Down Expand Up @@ -454,6 +465,8 @@ namespace neuron {
auto inst = make_instance_hodhux(_lmr);
auto node_data = make_node_data_hodhux(*_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];
Expand Down Expand Up @@ -481,7 +494,13 @@ namespace neuron {
auto inst = make_instance_hodhux(_lmr);
auto node_data = make_node_data_hodhux(*_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];
auto* _ppvar = _ml_arg->pdata[id];
auto v = node_data.node_voltages[node_id];
inst.ena[id] = (*inst.ion_ena[id]);
inst.ek[id] = (*inst.ion_ek[id]);
rates_hodhux(_ml, inst, id, _ppvar, _thread, _nt, v);
Expand Down
10 changes: 9 additions & 1 deletion net_receive/neuron/snapsyn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,11 @@ namespace neuron {
auto* const _ml = &_lmr;
auto* _thread = _ml_arg->_thread;
for (int id = 0; id < nodecount; id++) {
auto& _ppvar = _ml_arg->pdata[id];

int node_id = node_data.nodeindices[id];
auto* _ppvar = _ml_arg->pdata[id];
auto v = node_data.node_voltages[node_id];
inst.v_unused[id] = v;
inst.g[id] = 0.0;
}
}
Expand Down Expand Up @@ -257,6 +261,10 @@ namespace neuron {
auto* const _ml = &_lmr;
auto* _thread = _ml_arg->_thread;
for (int id = 0; id < nodecount; id++) {

int node_id = node_data.nodeindices[id];
auto* _ppvar = _ml_arg->pdata[id];
auto v = node_data.node_voltages[node_id];
}
}

Expand Down
10 changes: 9 additions & 1 deletion nonspecific_current/neuron/leonhard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,11 @@ namespace neuron {
auto* const _ml = &_lmr;
auto* _thread = _ml_arg->_thread;
for (int id = 0; id < nodecount; id++) {
auto& _ppvar = _ml_arg->pdata[id];

int node_id = node_data.nodeindices[id];
auto* _ppvar = _ml_arg->pdata[id];
auto v = node_data.node_voltages[node_id];
inst.v_unused[id] = v;
}
}

Expand Down Expand Up @@ -224,6 +228,10 @@ namespace neuron {
auto* const _ml = &_lmr;
auto* _thread = _ml_arg->_thread;
for (int id = 0; id < nodecount; id++) {

int node_id = node_data.nodeindices[id];
auto* _ppvar = _ml_arg->pdata[id];
auto v = node_data.node_voltages[node_id];
}
}

Expand Down
10 changes: 9 additions & 1 deletion parameter/neuron/neuron_variables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,11 @@ namespace neuron {
auto* const _ml = &_lmr;
auto* _thread = _ml_arg->_thread;
for (int id = 0; id < nodecount; id++) {
auto& _ppvar = _ml_arg->pdata[id];

int node_id = node_data.nodeindices[id];
auto* _ppvar = _ml_arg->pdata[id];
auto v = node_data.node_voltages[node_id];
inst.v_unused[id] = v;
}
}

Expand All @@ -193,6 +197,10 @@ namespace neuron {
auto* const _ml = &_lmr;
auto* _thread = _ml_arg->_thread;
for (int id = 0; id < nodecount; id++) {

int node_id = node_data.nodeindices[id];
auto* _ppvar = _ml_arg->pdata[id];
auto v = node_data.node_voltages[node_id];
inst.range_celsius[id] = *(inst.celsius);
}
}
Expand Down
6 changes: 5 additions & 1 deletion parameter/neuron/test_parameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,11 @@ namespace neuron {
auto* const _ml = &_lmr;
auto* _thread = _ml_arg->_thread;
for (int id = 0; id < nodecount; id++) {
auto& _ppvar = _ml_arg->pdata[id];

int node_id = node_data.nodeindices[id];
auto* _ppvar = _ml_arg->pdata[id];
auto v = node_data.node_voltages[node_id];
inst.v_unused[id] = v;
}
}

Expand Down
6 changes: 5 additions & 1 deletion point_process/neuron/test_pp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,11 @@ namespace neuron {
auto* const _ml = &_lmr;
auto* _thread = _ml_arg->_thread;
for (int id = 0; id < nodecount; id++) {
auto& _ppvar = _ml_arg->pdata[id];

int node_id = node_data.nodeindices[id];
auto* _ppvar = _ml_arg->pdata[id];
auto v = node_data.node_voltages[node_id];
inst.v_unused[id] = v;
}
}

Expand Down

0 comments on commit 00978a5

Please sign in to comment.