Skip to content

Commit

Permalink
Update for '1uc/nonspecific_current'. (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
1uc authored Feb 28, 2024
1 parent b277a26 commit 9893f6e
Show file tree
Hide file tree
Showing 9 changed files with 695 additions and 0 deletions.
20 changes: 20 additions & 0 deletions cnexp_array/neuron/leonhard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ namespace neuron {
};


struct leonhard_NodeData {
int const * nodeindices;
double const * node_voltages;
double * node_rhs;
int nodecount;
};


static leonhard_Instance make_instance_leonhard(_nrn_mechanism_cache_range& _ml) {
return leonhard_Instance {
_ml.template data_array_ptr<0, 3>(),
Expand All @@ -113,6 +121,16 @@ namespace neuron {
}


static leonhard_NodeData make_node_data_leonhard(NrnThread& _nt, Memb_list& _ml_arg) {
return leonhard_NodeData {
_ml_arg.nodeindices,
_nt.node_voltage_storage(),
_nt.node_rhs_storage(),
_ml_arg.nodecount
};
}


static void nrn_alloc_leonhard(Prop* _prop) {
Prop *prop_ion{};
Datum *_ppvar{};
Expand Down Expand Up @@ -165,6 +183,7 @@ namespace neuron {
void nrn_init_leonhard(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto inst = make_instance_leonhard(_lmr);
auto node_data = make_node_data_leonhard(*_nt, *_ml_arg);
auto nodecount = _ml_arg->nodecount;
for (int id = 0; id < nodecount; id++) {
inst.x[id] = 42.0;
Expand All @@ -180,6 +199,7 @@ namespace neuron {
void nrn_state_leonhard(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto inst = make_instance_leonhard(_lmr);
auto node_data = make_node_data_leonhard(*_nt, *_ml_arg);
auto nodecount = _ml_arg->nodecount;
for (int id = 0; id < nodecount; 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
20 changes: 20 additions & 0 deletions cnexp_scalar/neuron/leonhard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ namespace neuron {
};


struct leonhard_NodeData {
int const * nodeindices;
double const * node_voltages;
double * node_rhs;
int nodecount;
};


static leonhard_Instance make_instance_leonhard(_nrn_mechanism_cache_range& _ml) {
return leonhard_Instance {
_ml.template fpfield_ptr<0>(),
Expand All @@ -104,6 +112,16 @@ namespace neuron {
}


static leonhard_NodeData make_node_data_leonhard(NrnThread& _nt, Memb_list& _ml_arg) {
return leonhard_NodeData {
_ml_arg.nodeindices,
_nt.node_voltage_storage(),
_nt.node_rhs_storage(),
_ml_arg.nodecount
};
}


static void nrn_alloc_leonhard(Prop* _prop) {
Prop *prop_ion{};
Datum *_ppvar{};
Expand Down Expand Up @@ -156,6 +174,7 @@ namespace neuron {
void nrn_init_leonhard(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto inst = make_instance_leonhard(_lmr);
auto node_data = make_node_data_leonhard(*_nt, *_ml_arg);
auto nodecount = _ml_arg->nodecount;
for (int id = 0; id < nodecount; id++) {
inst.x[id] = 42.0;
Expand All @@ -166,6 +185,7 @@ namespace neuron {
void nrn_state_leonhard(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto inst = make_instance_leonhard(_lmr);
auto node_data = make_node_data_leonhard(*_nt, *_ml_arg);
auto nodecount = _ml_arg->nodecount;
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]);
Expand Down
19 changes: 19 additions & 0 deletions func_proc/neuron/func_proc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ namespace neuron {
};


struct test_func_proc_NodeData {
int const * nodeindices;
double const * node_voltages;
double * node_rhs;
int nodecount;
};


static test_func_proc_Instance make_instance_test_func_proc(_nrn_mechanism_cache_range& _ml) {
return test_func_proc_Instance {
_ml.template fpfield_ptr<0>(),
Expand All @@ -98,6 +106,16 @@ namespace neuron {
}


static test_func_proc_NodeData make_node_data_test_func_proc(NrnThread& _nt, Memb_list& _ml_arg) {
return test_func_proc_NodeData {
_ml_arg.nodeindices,
_nt.node_voltage_storage(),
_nt.node_rhs_storage(),
_ml_arg.nodecount
};
}


static void nrn_alloc_test_func_proc(Prop* _prop) {
Prop *prop_ion{};
Datum *_ppvar{};
Expand Down Expand Up @@ -341,6 +359,7 @@ namespace neuron {
void nrn_init_test_func_proc(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
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;
for (int id = 0; id < nodecount; id++) {
}
Expand Down
19 changes: 19 additions & 0 deletions func_proc_pnt/neuron/func_proc_pnt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ namespace neuron {
};


struct test_func_proc_pnt_NodeData {
int const * nodeindices;
double const * node_voltages;
double * node_rhs;
int nodecount;
};


static test_func_proc_pnt_Instance make_instance_test_func_proc_pnt(_nrn_mechanism_cache_range& _ml) {
return test_func_proc_pnt_Instance {
_ml.template fpfield_ptr<0>(),
Expand All @@ -98,6 +106,16 @@ namespace neuron {
}


static test_func_proc_pnt_NodeData make_node_data_test_func_proc_pnt(NrnThread& _nt, Memb_list& _ml_arg) {
return test_func_proc_pnt_NodeData {
_ml_arg.nodeindices,
_nt.node_voltage_storage(),
_nt.node_rhs_storage(),
_ml_arg.nodecount
};
}


static void nrn_alloc_test_func_proc_pnt(Prop* _prop) {
Prop *prop_ion{};
Datum *_ppvar{};
Expand Down Expand Up @@ -267,6 +285,7 @@ namespace neuron {
void nrn_init_test_func_proc_pnt(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
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;
for (int id = 0; id < nodecount; id++) {
}
Expand Down
20 changes: 20 additions & 0 deletions global_breakpoint/neuron/leonhard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ namespace neuron {
};


struct leonhard_NodeData {
int const * nodeindices;
double const * node_voltages;
double * node_rhs;
int nodecount;
};


static leonhard_Instance make_instance_leonhard(_nrn_mechanism_cache_range& _ml) {
return leonhard_Instance {
_ml.template fpfield_ptr<0>(),
Expand All @@ -104,6 +112,16 @@ namespace neuron {
}


static leonhard_NodeData make_node_data_leonhard(NrnThread& _nt, Memb_list& _ml_arg) {
return leonhard_NodeData {
_ml_arg.nodeindices,
_nt.node_voltage_storage(),
_nt.node_rhs_storage(),
_ml_arg.nodecount
};
}


static void nrn_alloc_leonhard(Prop* _prop) {
Prop *prop_ion{};
Datum *_ppvar{};
Expand Down Expand Up @@ -157,6 +175,7 @@ namespace neuron {
void nrn_init_leonhard(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto inst = make_instance_leonhard(_lmr);
auto node_data = make_node_data_leonhard(*_nt, *_ml_arg);
auto nodecount = _ml_arg->nodecount;
for (int id = 0; id < nodecount; id++) {
inst.x[id] = 42.0;
Expand All @@ -167,6 +186,7 @@ namespace neuron {
void nrn_state_leonhard(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto inst = make_instance_leonhard(_lmr);
auto node_data = make_node_data_leonhard(*_nt, *_ml_arg);
auto nodecount = _ml_arg->nodecount;
for (int id = 0; id < nodecount; id++) {
inst.x[id] = inst.global->c;
Expand Down
Loading

0 comments on commit 9893f6e

Please sign in to comment.