Skip to content

Commit c6624df

Browse files
authored
Set conductances when using NONSPECIFIC_CURRENT (#7)
1 parent e9e4ca9 commit c6624df

File tree

9 files changed

+107
-9
lines changed

9 files changed

+107
-9
lines changed

cnexp_array/neuron/leonhard.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ namespace neuron {
103103
struct leonhard_NodeData {
104104
int const * nodeindices;
105105
double const * node_voltages;
106+
double * node_diagonal;
106107
double * node_rhs;
107108
int nodecount;
108109
};
@@ -125,6 +126,7 @@ namespace neuron {
125126
return leonhard_NodeData {
126127
_ml_arg.nodeindices,
127128
_nt.node_voltage_storage(),
129+
_nt.node_d_storage(),
128130
_nt.node_rhs_storage(),
129131
_ml_arg.nodecount
130132
};
@@ -208,7 +210,17 @@ namespace neuron {
208210

209211

210212
/** nrn_jacob function */
211-
static void nrn_jacob_leonhard(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {}
213+
static void nrn_jacob_leonhard(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
214+
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
215+
auto inst = make_instance_leonhard(_lmr);
216+
auto node_data = make_node_data_leonhard(*_nt, *_ml_arg);
217+
auto nodecount = _ml_arg->nodecount;
218+
for (int id = 0; id < nodecount; id++) {
219+
// set conductances properly
220+
int node_id = node_data.nodeindices[id];
221+
node_data.node_diagonal[node_id] += inst.g_unused[id];
222+
}
223+
}
212224

213225

214226
static void _initlists() {

cnexp_scalar/neuron/leonhard.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ namespace neuron {
9797
struct leonhard_NodeData {
9898
int const * nodeindices;
9999
double const * node_voltages;
100+
double * node_diagonal;
100101
double * node_rhs;
101102
int nodecount;
102103
};
@@ -116,6 +117,7 @@ namespace neuron {
116117
return leonhard_NodeData {
117118
_ml_arg.nodeindices,
118119
_nt.node_voltage_storage(),
120+
_nt.node_d_storage(),
119121
_nt.node_rhs_storage(),
120122
_ml_arg.nodecount
121123
};
@@ -194,7 +196,17 @@ namespace neuron {
194196

195197

196198
/** nrn_jacob function */
197-
static void nrn_jacob_leonhard(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {}
199+
static void nrn_jacob_leonhard(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
200+
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
201+
auto inst = make_instance_leonhard(_lmr);
202+
auto node_data = make_node_data_leonhard(*_nt, *_ml_arg);
203+
auto nodecount = _ml_arg->nodecount;
204+
for (int id = 0; id < nodecount; id++) {
205+
// set conductances properly
206+
int node_id = node_data.nodeindices[id];
207+
node_data.node_diagonal[node_id] += inst.g_unused[id];
208+
}
209+
}
198210

199211

200212
static void _initlists() {

func_proc/neuron/func_proc.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ namespace neuron {
9393
struct test_func_proc_NodeData {
9494
int const * nodeindices;
9595
double const * node_voltages;
96+
double * node_diagonal;
9697
double * node_rhs;
9798
int nodecount;
9899
};
@@ -110,6 +111,7 @@ namespace neuron {
110111
return test_func_proc_NodeData {
111112
_ml_arg.nodeindices,
112113
_nt.node_voltage_storage(),
114+
_nt.node_d_storage(),
113115
_nt.node_rhs_storage(),
114116
_ml_arg.nodecount
115117
};
@@ -367,7 +369,14 @@ namespace neuron {
367369

368370

369371
/** nrn_jacob function */
370-
static void nrn_jacob_test_func_proc(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {}
372+
static void nrn_jacob_test_func_proc(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
373+
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
374+
auto inst = make_instance_test_func_proc(_lmr);
375+
auto node_data = make_node_data_test_func_proc(*_nt, *_ml_arg);
376+
auto nodecount = _ml_arg->nodecount;
377+
for (int id = 0; id < nodecount; id++) {
378+
}
379+
}
371380

372381

373382
static void _initlists() {

func_proc_pnt/neuron/func_proc_pnt.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ namespace neuron {
9292
struct test_func_proc_pnt_NodeData {
9393
int const * nodeindices;
9494
double const * node_voltages;
95+
double * node_diagonal;
9596
double * node_rhs;
9697
int nodecount;
9798
};
@@ -110,6 +111,7 @@ namespace neuron {
110111
return test_func_proc_pnt_NodeData {
111112
_ml_arg.nodeindices,
112113
_nt.node_voltage_storage(),
114+
_nt.node_d_storage(),
113115
_nt.node_rhs_storage(),
114116
_ml_arg.nodecount
115117
};
@@ -293,7 +295,14 @@ namespace neuron {
293295

294296

295297
/** nrn_jacob function */
296-
static void nrn_jacob_test_func_proc_pnt(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {}
298+
static void nrn_jacob_test_func_proc_pnt(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
299+
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
300+
auto inst = make_instance_test_func_proc_pnt(_lmr);
301+
auto node_data = make_node_data_test_func_proc_pnt(*_nt, *_ml_arg);
302+
auto nodecount = _ml_arg->nodecount;
303+
for (int id = 0; id < nodecount; id++) {
304+
}
305+
}
297306

298307

299308
static void _initlists() {

global_breakpoint/neuron/leonhard.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ namespace neuron {
9797
struct leonhard_NodeData {
9898
int const * nodeindices;
9999
double const * node_voltages;
100+
double * node_diagonal;
100101
double * node_rhs;
101102
int nodecount;
102103
};
@@ -116,6 +117,7 @@ namespace neuron {
116117
return leonhard_NodeData {
117118
_ml_arg.nodeindices,
118119
_nt.node_voltage_storage(),
120+
_nt.node_d_storage(),
119121
_nt.node_rhs_storage(),
120122
_ml_arg.nodecount
121123
};
@@ -195,7 +197,17 @@ namespace neuron {
195197

196198

197199
/** nrn_jacob function */
198-
static void nrn_jacob_leonhard(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {}
200+
static void nrn_jacob_leonhard(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
201+
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
202+
auto inst = make_instance_leonhard(_lmr);
203+
auto node_data = make_node_data_leonhard(*_nt, *_ml_arg);
204+
auto nodecount = _ml_arg->nodecount;
205+
for (int id = 0; id < nodecount; id++) {
206+
// set conductances properly
207+
int node_id = node_data.nodeindices[id];
208+
node_data.node_diagonal[node_id] += inst.g_unused[id];
209+
}
210+
}
199211

200212

201213
static void _initlists() {

nonspecific_current/neuron/leonhard.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ namespace neuron {
9494
struct leonhard_NodeData {
9595
int const * nodeindices;
9696
double const * node_voltages;
97+
double * node_diagonal;
9798
double * node_rhs;
9899
int nodecount;
99100
};
@@ -112,6 +113,7 @@ namespace neuron {
112113
return leonhard_NodeData {
113114
_ml_arg.nodeindices,
114115
_nt.node_voltage_storage(),
116+
_nt.node_d_storage(),
115117
_nt.node_rhs_storage(),
116118
_ml_arg.nodecount
117119
};
@@ -199,6 +201,8 @@ namespace neuron {
199201
double rhs = I0;
200202
double g = (I1-I0)/0.001;
201203
node_data.node_rhs[node_id] -= rhs;
204+
// remember the conductances so we can set them later
205+
inst.g_unused[id] = g;
202206
}
203207
}
204208

@@ -214,7 +218,17 @@ namespace neuron {
214218

215219

216220
/** nrn_jacob function */
217-
static void nrn_jacob_leonhard(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {}
221+
static void nrn_jacob_leonhard(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
222+
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
223+
auto inst = make_instance_leonhard(_lmr);
224+
auto node_data = make_node_data_leonhard(*_nt, *_ml_arg);
225+
auto nodecount = _ml_arg->nodecount;
226+
for (int id = 0; id < nodecount; id++) {
227+
// set conductances properly
228+
int node_id = node_data.nodeindices[id];
229+
node_data.node_diagonal[node_id] += inst.g_unused[id];
230+
}
231+
}
218232

219233

220234
static void _initlists() {

parameter/neuron/neuron_variables.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ namespace neuron {
9696
struct NeuronVariables_NodeData {
9797
int const * nodeindices;
9898
double const * node_voltages;
99+
double * node_diagonal;
99100
double * node_rhs;
100101
int nodecount;
101102
};
@@ -115,6 +116,7 @@ namespace neuron {
115116
return NeuronVariables_NodeData {
116117
_ml_arg.nodeindices,
117118
_nt.node_voltage_storage(),
119+
_nt.node_d_storage(),
118120
_nt.node_rhs_storage(),
119121
_ml_arg.nodecount
120122
};
@@ -192,7 +194,17 @@ namespace neuron {
192194

193195

194196
/** nrn_jacob function */
195-
static void nrn_jacob_NeuronVariables(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {}
197+
static void nrn_jacob_NeuronVariables(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
198+
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
199+
auto inst = make_instance_NeuronVariables(_lmr);
200+
auto node_data = make_node_data_NeuronVariables(*_nt, *_ml_arg);
201+
auto nodecount = _ml_arg->nodecount;
202+
for (int id = 0; id < nodecount; id++) {
203+
// set conductances properly
204+
int node_id = node_data.nodeindices[id];
205+
node_data.node_diagonal[node_id] += inst.g_unused[id];
206+
}
207+
}
196208

197209

198210
static void _initlists() {

parameter/neuron/test_parameter.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ namespace neuron {
9292
struct test_parameter_NodeData {
9393
int const * nodeindices;
9494
double const * node_voltages;
95+
double * node_diagonal;
9596
double * node_rhs;
9697
int nodecount;
9798
};
@@ -110,6 +111,7 @@ namespace neuron {
110111
return test_parameter_NodeData {
111112
_ml_arg.nodeindices,
112113
_nt.node_voltage_storage(),
114+
_nt.node_d_storage(),
113115
_nt.node_rhs_storage(),
114116
_ml_arg.nodecount
115117
};
@@ -202,7 +204,14 @@ namespace neuron {
202204

203205

204206
/** nrn_jacob function */
205-
static void nrn_jacob_test_parameter(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {}
207+
static void nrn_jacob_test_parameter(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
208+
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
209+
auto inst = make_instance_test_parameter(_lmr);
210+
auto node_data = make_node_data_test_parameter(*_nt, *_ml_arg);
211+
auto nodecount = _ml_arg->nodecount;
212+
for (int id = 0; id < nodecount; id++) {
213+
}
214+
}
206215

207216

208217
static void _initlists() {

point_process/neuron/test_pp.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ namespace neuron {
9090
struct test_pp_NodeData {
9191
int const * nodeindices;
9292
double const * node_voltages;
93+
double * node_diagonal;
9394
double * node_rhs;
9495
int nodecount;
9596
};
@@ -107,6 +108,7 @@ namespace neuron {
107108
return test_pp_NodeData {
108109
_ml_arg.nodeindices,
109110
_nt.node_voltage_storage(),
111+
_nt.node_d_storage(),
110112
_nt.node_rhs_storage(),
111113
_ml_arg.nodecount
112114
};
@@ -198,7 +200,14 @@ namespace neuron {
198200

199201

200202
/** nrn_jacob function */
201-
static void nrn_jacob_test_pp(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {}
203+
static void nrn_jacob_test_pp(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
204+
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
205+
auto inst = make_instance_test_pp(_lmr);
206+
auto node_data = make_node_data_test_pp(*_nt, *_ml_arg);
207+
auto nodecount = _ml_arg->nodecount;
208+
for (int id = 0; id < nodecount; id++) {
209+
}
210+
}
202211

203212

204213
static void _initlists() {

0 commit comments

Comments
 (0)