Skip to content

Commit

Permalink
Set conductances when using NONSPECIFIC_CURRENT (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
JCGoran authored Apr 8, 2024
1 parent e9e4ca9 commit c6624df
Show file tree
Hide file tree
Showing 9 changed files with 107 additions and 9 deletions.
14 changes: 13 additions & 1 deletion cnexp_array/neuron/leonhard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ namespace neuron {
struct leonhard_NodeData {
int const * nodeindices;
double const * node_voltages;
double * node_diagonal;
double * node_rhs;
int nodecount;
};
Expand All @@ -125,6 +126,7 @@ namespace neuron {
return leonhard_NodeData {
_ml_arg.nodeindices,
_nt.node_voltage_storage(),
_nt.node_d_storage(),
_nt.node_rhs_storage(),
_ml_arg.nodecount
};
Expand Down Expand Up @@ -208,7 +210,17 @@ namespace neuron {


/** nrn_jacob function */
static void nrn_jacob_leonhard(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {}
static void nrn_jacob_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++) {
// set conductances properly
int node_id = node_data.nodeindices[id];
node_data.node_diagonal[node_id] += inst.g_unused[id];
}
}


static void _initlists() {
Expand Down
14 changes: 13 additions & 1 deletion cnexp_scalar/neuron/leonhard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ namespace neuron {
struct leonhard_NodeData {
int const * nodeindices;
double const * node_voltages;
double * node_diagonal;
double * node_rhs;
int nodecount;
};
Expand All @@ -116,6 +117,7 @@ namespace neuron {
return leonhard_NodeData {
_ml_arg.nodeindices,
_nt.node_voltage_storage(),
_nt.node_d_storage(),
_nt.node_rhs_storage(),
_ml_arg.nodecount
};
Expand Down Expand Up @@ -194,7 +196,17 @@ namespace neuron {


/** nrn_jacob function */
static void nrn_jacob_leonhard(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {}
static void nrn_jacob_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++) {
// set conductances properly
int node_id = node_data.nodeindices[id];
node_data.node_diagonal[node_id] += inst.g_unused[id];
}
}


static void _initlists() {
Expand Down
11 changes: 10 additions & 1 deletion func_proc/neuron/func_proc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ namespace neuron {
struct test_func_proc_NodeData {
int const * nodeindices;
double const * node_voltages;
double * node_diagonal;
double * node_rhs;
int nodecount;
};
Expand All @@ -110,6 +111,7 @@ namespace neuron {
return test_func_proc_NodeData {
_ml_arg.nodeindices,
_nt.node_voltage_storage(),
_nt.node_d_storage(),
_nt.node_rhs_storage(),
_ml_arg.nodecount
};
Expand Down Expand Up @@ -367,7 +369,14 @@ namespace neuron {


/** nrn_jacob function */
static void nrn_jacob_test_func_proc(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {}
static void nrn_jacob_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++) {
}
}


static void _initlists() {
Expand Down
11 changes: 10 additions & 1 deletion func_proc_pnt/neuron/func_proc_pnt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ namespace neuron {
struct test_func_proc_pnt_NodeData {
int const * nodeindices;
double const * node_voltages;
double * node_diagonal;
double * node_rhs;
int nodecount;
};
Expand All @@ -110,6 +111,7 @@ namespace neuron {
return test_func_proc_pnt_NodeData {
_ml_arg.nodeindices,
_nt.node_voltage_storage(),
_nt.node_d_storage(),
_nt.node_rhs_storage(),
_ml_arg.nodecount
};
Expand Down Expand Up @@ -293,7 +295,14 @@ namespace neuron {


/** nrn_jacob function */
static void nrn_jacob_test_func_proc_pnt(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {}
static void nrn_jacob_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++) {
}
}


static void _initlists() {
Expand Down
14 changes: 13 additions & 1 deletion global_breakpoint/neuron/leonhard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ namespace neuron {
struct leonhard_NodeData {
int const * nodeindices;
double const * node_voltages;
double * node_diagonal;
double * node_rhs;
int nodecount;
};
Expand All @@ -116,6 +117,7 @@ namespace neuron {
return leonhard_NodeData {
_ml_arg.nodeindices,
_nt.node_voltage_storage(),
_nt.node_d_storage(),
_nt.node_rhs_storage(),
_ml_arg.nodecount
};
Expand Down Expand Up @@ -195,7 +197,17 @@ namespace neuron {


/** nrn_jacob function */
static void nrn_jacob_leonhard(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {}
static void nrn_jacob_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++) {
// set conductances properly
int node_id = node_data.nodeindices[id];
node_data.node_diagonal[node_id] += inst.g_unused[id];
}
}


static void _initlists() {
Expand Down
16 changes: 15 additions & 1 deletion nonspecific_current/neuron/leonhard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ namespace neuron {
struct leonhard_NodeData {
int const * nodeindices;
double const * node_voltages;
double * node_diagonal;
double * node_rhs;
int nodecount;
};
Expand All @@ -112,6 +113,7 @@ namespace neuron {
return leonhard_NodeData {
_ml_arg.nodeindices,
_nt.node_voltage_storage(),
_nt.node_d_storage(),
_nt.node_rhs_storage(),
_ml_arg.nodecount
};
Expand Down Expand Up @@ -199,6 +201,8 @@ namespace neuron {
double rhs = I0;
double g = (I1-I0)/0.001;
node_data.node_rhs[node_id] -= rhs;
// remember the conductances so we can set them later
inst.g_unused[id] = g;
}
}

Expand All @@ -214,7 +218,17 @@ namespace neuron {


/** nrn_jacob function */
static void nrn_jacob_leonhard(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {}
static void nrn_jacob_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++) {
// set conductances properly
int node_id = node_data.nodeindices[id];
node_data.node_diagonal[node_id] += inst.g_unused[id];
}
}


static void _initlists() {
Expand Down
14 changes: 13 additions & 1 deletion parameter/neuron/neuron_variables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ namespace neuron {
struct NeuronVariables_NodeData {
int const * nodeindices;
double const * node_voltages;
double * node_diagonal;
double * node_rhs;
int nodecount;
};
Expand All @@ -115,6 +116,7 @@ namespace neuron {
return NeuronVariables_NodeData {
_ml_arg.nodeindices,
_nt.node_voltage_storage(),
_nt.node_d_storage(),
_nt.node_rhs_storage(),
_ml_arg.nodecount
};
Expand Down Expand Up @@ -192,7 +194,17 @@ namespace neuron {


/** nrn_jacob function */
static void nrn_jacob_NeuronVariables(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {}
static void nrn_jacob_NeuronVariables(_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_NeuronVariables(_lmr);
auto node_data = make_node_data_NeuronVariables(*_nt, *_ml_arg);
auto nodecount = _ml_arg->nodecount;
for (int id = 0; id < nodecount; id++) {
// set conductances properly
int node_id = node_data.nodeindices[id];
node_data.node_diagonal[node_id] += inst.g_unused[id];
}
}


static void _initlists() {
Expand Down
11 changes: 10 additions & 1 deletion parameter/neuron/test_parameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ namespace neuron {
struct test_parameter_NodeData {
int const * nodeindices;
double const * node_voltages;
double * node_diagonal;
double * node_rhs;
int nodecount;
};
Expand All @@ -110,6 +111,7 @@ namespace neuron {
return test_parameter_NodeData {
_ml_arg.nodeindices,
_nt.node_voltage_storage(),
_nt.node_d_storage(),
_nt.node_rhs_storage(),
_ml_arg.nodecount
};
Expand Down Expand Up @@ -202,7 +204,14 @@ namespace neuron {


/** nrn_jacob function */
static void nrn_jacob_test_parameter(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {}
static void nrn_jacob_test_parameter(_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_parameter(_lmr);
auto node_data = make_node_data_test_parameter(*_nt, *_ml_arg);
auto nodecount = _ml_arg->nodecount;
for (int id = 0; id < nodecount; id++) {
}
}


static void _initlists() {
Expand Down
11 changes: 10 additions & 1 deletion point_process/neuron/test_pp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ namespace neuron {
struct test_pp_NodeData {
int const * nodeindices;
double const * node_voltages;
double * node_diagonal;
double * node_rhs;
int nodecount;
};
Expand All @@ -107,6 +108,7 @@ namespace neuron {
return test_pp_NodeData {
_ml_arg.nodeindices,
_nt.node_voltage_storage(),
_nt.node_d_storage(),
_nt.node_rhs_storage(),
_ml_arg.nodecount
};
Expand Down Expand Up @@ -198,7 +200,14 @@ namespace neuron {


/** nrn_jacob function */
static void nrn_jacob_test_pp(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {}
static void nrn_jacob_test_pp(_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_pp(_lmr);
auto node_data = make_node_data_test_pp(*_nt, *_ml_arg);
auto nodecount = _ml_arg->nodecount;
for (int id = 0; id < nodecount; id++) {
}
}


static void _initlists() {
Expand Down

0 comments on commit c6624df

Please sign in to comment.