Skip to content

Commit 763ca26

Browse files
JCGoran1uc
andauthored
Update references for nonspecific current (#9)
--------- Co-authored-by: Luc Grosheintz <[email protected]>
1 parent ed7a740 commit 763ca26

File tree

4 files changed

+23
-15
lines changed

4 files changed

+23
-15
lines changed

cnexp_array/coreneuron/leonhard.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ namespace coreneuron {
100100

101101

102102
static inline int float_variables_size() {
103-
return 7;
103+
return 11;
104104
}
105105

106106

cnexp_array/neuron/leonhard.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ namespace neuron {
250250
_nrn_mechanism_field<double>{"g_unused"} /* 6 */
251251
);
252252

253-
hoc_register_prop_size(mech_type, 7, 0);
253+
hoc_register_prop_size(mech_type, 11, 0);
254254
hoc_register_var(hoc_scalar_double, hoc_vector_double, hoc_intfunc);
255255
hoc_register_npy_direct(mech_type, npy_direct_func_proc);
256256
}

nonspecific_current/coreneuron/leonhard.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ namespace coreneuron {
3737
static const char *mechanism_info[] = {
3838
"7.7.0",
3939
"leonhard",
40+
"c_leonhard",
4041
0,
4142
"il_leonhard",
4243
0,
@@ -60,6 +61,7 @@ namespace coreneuron {
6061

6162
/** all mechanism instance variables and global variables */
6263
struct leonhard_Instance {
64+
const double* c{};
6365
double* il{};
6466
double* v_unused{};
6567
double* g_unused{};
@@ -90,7 +92,7 @@ namespace coreneuron {
9092

9193

9294
static inline int float_variables_size() {
93-
return 3;
95+
return 4;
9496
}
9597

9698

@@ -165,9 +167,10 @@ namespace coreneuron {
165167
assert(ml->global_variables_size == sizeof(leonhard_Store));
166168
int pnodecount = ml->_nodecount_padded;
167169
Datum* indexes = ml->pdata;
168-
inst->il = ml->data+0*pnodecount;
169-
inst->v_unused = ml->data+1*pnodecount;
170-
inst->g_unused = ml->data+2*pnodecount;
170+
inst->c = ml->data+0*pnodecount;
171+
inst->il = ml->data+1*pnodecount;
172+
inst->v_unused = ml->data+2*pnodecount;
173+
inst->g_unused = ml->data+3*pnodecount;
171174
}
172175

173176

@@ -236,7 +239,7 @@ namespace coreneuron {
236239

237240
inline double nrn_current_leonhard(int id, int pnodecount, leonhard_Instance* inst, double* data, const Datum* indexes, ThreadDatum* thread, NrnThread* nt, double v) {
238241
double current = 0.0;
239-
inst->il[id] = 0.005 * (v - 1.5);
242+
inst->il[id] = inst->c[id] * (v - 1.5);
240243
current += inst->il[id];
241244
return current;
242245
}

nonspecific_current/neuron/leonhard.cpp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ NMODL Compiler : VERSION
2424
#define NRN_VECTORIZED 1
2525

2626
static constexpr auto number_of_datum_variables = 0;
27-
static constexpr auto number_of_floating_point_variables = 3;
27+
static constexpr auto number_of_floating_point_variables = 4;
2828

2929
namespace {
3030
template <typename T>
@@ -54,6 +54,7 @@ namespace neuron {
5454
static const char *mechanism_info[] = {
5555
"7.7.0",
5656
"leonhard",
57+
"c_leonhard",
5758
0,
5859
"il_leonhard",
5960
0,
@@ -84,6 +85,7 @@ namespace neuron {
8485

8586
/** all mechanism instance variables and global variables */
8687
struct leonhard_Instance {
88+
double* c{};
8789
double* il{};
8890
double* v_unused{};
8991
double* g_unused{};
@@ -104,7 +106,8 @@ namespace neuron {
104106
return leonhard_Instance {
105107
_ml.template fpfield_ptr<0>(),
106108
_ml.template fpfield_ptr<1>(),
107-
_ml.template fpfield_ptr<2>()
109+
_ml.template fpfield_ptr<2>(),
110+
_ml.template fpfield_ptr<3>()
108111
};
109112
}
110113

@@ -126,8 +129,9 @@ namespace neuron {
126129
_nrn_mechanism_cache_instance _ml_real{_prop};
127130
auto* const _ml = &_ml_real;
128131
size_t const _iml{};
129-
assert(_nrn_mechanism_get_num_vars(_prop) == 3);
132+
assert(_nrn_mechanism_get_num_vars(_prop) == 4);
130133
/*initialize range parameters*/
134+
_ml->template fpfield<0>(_iml) = 0.005; /* c */
131135
}
132136

133137

@@ -184,7 +188,7 @@ namespace neuron {
184188

185189
inline double nrn_current_leonhard(size_t id, leonhard_Instance& inst, leonhard_NodeData& node_data, double v) {
186190
double current = 0.0;
187-
inst.il[id] = 0.005 * (v - 1.5);
191+
inst.il[id] = inst.c[id] * (v - 1.5);
188192
current += inst.il[id];
189193
return current;
190194
}
@@ -252,12 +256,13 @@ namespace neuron {
252256

253257
mech_type = nrn_get_mechtype(mechanism_info[1]);
254258
_nrn_mechanism_register_data_fields(mech_type,
255-
_nrn_mechanism_field<double>{"il"} /* 0 */,
256-
_nrn_mechanism_field<double>{"v_unused"} /* 1 */,
257-
_nrn_mechanism_field<double>{"g_unused"} /* 2 */
259+
_nrn_mechanism_field<double>{"c"} /* 0 */,
260+
_nrn_mechanism_field<double>{"il"} /* 1 */,
261+
_nrn_mechanism_field<double>{"v_unused"} /* 2 */,
262+
_nrn_mechanism_field<double>{"g_unused"} /* 3 */
258263
);
259264

260-
hoc_register_prop_size(mech_type, 3, 0);
265+
hoc_register_prop_size(mech_type, 4, 0);
261266
hoc_register_var(hoc_scalar_double, hoc_vector_double, hoc_intfunc);
262267
hoc_register_npy_direct(mech_type, npy_direct_func_proc);
263268
}

0 commit comments

Comments
 (0)