Skip to content

Commit

Permalink
References for 'BlueBrain/nmodl#1387'.
Browse files Browse the repository at this point in the history
  • Loading branch information
GitHub Actions Bot committed Aug 9, 2024
1 parent 9ebaf08 commit 8971a57
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 15 deletions.
3 changes: 3 additions & 0 deletions solve/neuron/cnexp_array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ namespace neuron {
auto v = node_data.node_voltages[node_id];
inst.v_unused[id] = v;
inst.x[id] = inst.global->x0;
for(size_t _i = 0; _i < 2; ++_i) {
(inst.s+id*2)[_i] = inst.global->s0;
}
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 Down
3 changes: 3 additions & 0 deletions solve/neuron/derivimplicit_array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,9 @@ namespace neuron {
auto v = node_data.node_voltages[node_id];
inst.v_unused[id] = v;
inst.x[id] = inst.global->x0;
for(size_t _i = 0; _i < 2; ++_i) {
(inst.s+id*2)[_i] = inst.global->s0;
}
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 Down
31 changes: 26 additions & 5 deletions state/coreneuron/default_values.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ namespace coreneuron {
"X_default_values",
"Y_default_values",
"Z_default_values",
"A_default_values[3]",
"B_default_values[2]",
0,
0
};
Expand All @@ -54,6 +56,8 @@ namespace coreneuron {
int mech_type{};
double X0{2};
double Z0{3};
double A0{4};
double B0{5};
};
static_assert(std::is_trivially_copy_constructible_v<default_values_Store>);
static_assert(std::is_trivially_move_constructible_v<default_values_Store>);
Expand All @@ -68,9 +72,13 @@ namespace coreneuron {
double* X{};
double* Y{};
double* Z{};
double* A{};
double* B{};
double* DX{};
double* DY{};
double* DZ{};
double* DA{};
double* DB{};
double* v_unused{};
default_values_Store* global{&default_values_global};
};
Expand All @@ -80,6 +88,8 @@ namespace coreneuron {
static DoubScal hoc_scalar_double[] = {
{"X0_default_values", &default_values_global.X0},
{"Z0_default_values", &default_values_global.Z0},
{"A0_default_values", &default_values_global.A0},
{"B0_default_values", &default_values_global.B0},
{nullptr, nullptr}
};

Expand All @@ -101,7 +111,7 @@ namespace coreneuron {


static inline int float_variables_size() {
return 7;
return 17;
}


Expand Down Expand Up @@ -179,10 +189,14 @@ namespace coreneuron {
inst->X = ml->data+0*pnodecount;
inst->Y = ml->data+1*pnodecount;
inst->Z = ml->data+2*pnodecount;
inst->DX = ml->data+3*pnodecount;
inst->DY = ml->data+4*pnodecount;
inst->DZ = ml->data+5*pnodecount;
inst->v_unused = ml->data+6*pnodecount;
inst->A = ml->data+3*pnodecount;
inst->B = ml->data+6*pnodecount;
inst->DX = ml->data+8*pnodecount;
inst->DY = ml->data+9*pnodecount;
inst->DZ = ml->data+10*pnodecount;
inst->DA = ml->data+11*pnodecount;
inst->DB = ml->data+14*pnodecount;
inst->v_unused = ml->data+16*pnodecount;
}


Expand Down Expand Up @@ -247,6 +261,13 @@ namespace coreneuron {
inst->X[id] = inst->global->X0;
inst->Y[id] = inst->global->Y0;
inst->Z[id] = inst->global->Z0;
(inst->A+id*3)[0] = inst->global->A0;
(inst->A+id*3)[1] = inst->global->A0;
(inst->A+id*3)[2] = inst->global->A0;
(inst->B+id*2)[0] = inst->global->B0;
(inst->B+id*2)[1] = inst->global->B0;
inst->Z[id] = 7.0;
(inst->B+id*2)[static_cast<int>(1)] = 8.0;
}
}
}
Expand Down
46 changes: 36 additions & 10 deletions state/neuron/default_values.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ NMODL Compiler : VERSION
#define NRN_VECTORIZED 1

static constexpr auto number_of_datum_variables = 0;
static constexpr auto number_of_floating_point_variables = 7;
static constexpr auto number_of_floating_point_variables = 11;

namespace {
template <typename T>
Expand Down Expand Up @@ -63,6 +63,8 @@ namespace neuron {
"X_default_values",
"Y_default_values",
"Z_default_values",
"A_default_values[3]",
"B_default_values[2]",
0,
0
};
Expand All @@ -82,6 +84,8 @@ namespace neuron {
double Y0{};
double X0{2};
double Z0{3};
double A0{4};
double B0{5};
};
static_assert(std::is_trivially_copy_constructible_v<default_values_Store>);
static_assert(std::is_trivially_move_constructible_v<default_values_Store>);
Expand All @@ -98,9 +102,13 @@ namespace neuron {
double* X{};
double* Y{};
double* Z{};
double* A{};
double* B{};
double* DX{};
double* DY{};
double* DZ{};
double* DA{};
double* DB{};
double* v_unused{};
default_values_Store* global{&default_values_global};
};
Expand All @@ -120,10 +128,14 @@ namespace neuron {
_lmc.template fpfield_ptr<0>(),
_lmc.template fpfield_ptr<1>(),
_lmc.template fpfield_ptr<2>(),
_lmc.template fpfield_ptr<3>(),
_lmc.template fpfield_ptr<4>(),
_lmc.template data_array_ptr<3, 3>(),
_lmc.template data_array_ptr<4, 2>(),
_lmc.template fpfield_ptr<5>(),
_lmc.template fpfield_ptr<6>()
_lmc.template fpfield_ptr<6>(),
_lmc.template fpfield_ptr<7>(),
_lmc.template data_array_ptr<8, 3>(),
_lmc.template data_array_ptr<9, 2>(),
_lmc.template fpfield_ptr<10>()
};
}

Expand All @@ -143,7 +155,7 @@ namespace neuron {
Datum *_ppvar = nullptr;
_nrn_mechanism_cache_instance _lmc{_prop};
size_t const _iml = 0;
assert(_nrn_mechanism_get_num_vars(_prop) == 7);
assert(_nrn_mechanism_get_num_vars(_prop) == 11);
/*initialize range parameters*/
}

Expand All @@ -166,6 +178,8 @@ namespace neuron {
static DoubScal hoc_scalar_double[] = {
{"X0_default_values", &default_values_global.X0},
{"Z0_default_values", &default_values_global.Z0},
{"A0_default_values", &default_values_global.A0},
{"B0_default_values", &default_values_global.B0},
{nullptr, nullptr}
};

Expand Down Expand Up @@ -203,6 +217,14 @@ namespace neuron {
inst.X[id] = inst.global->X0;
inst.Y[id] = inst.global->Y0;
inst.Z[id] = inst.global->Z0;
for(size_t _i = 0; _i < 3; ++_i) {
(inst.A+id*3)[_i] = inst.global->A0;
}
for(size_t _i = 0; _i < 2; ++_i) {
(inst.B+id*2)[_i] = inst.global->B0;
}
inst.Z[id] = 7.0;
(inst.B+id*2)[static_cast<int>(1)] = 8.0;
}
}

Expand Down Expand Up @@ -233,13 +255,17 @@ namespace neuron {
_nrn_mechanism_field<double>{"X"} /* 0 */,
_nrn_mechanism_field<double>{"Y"} /* 1 */,
_nrn_mechanism_field<double>{"Z"} /* 2 */,
_nrn_mechanism_field<double>{"DX"} /* 3 */,
_nrn_mechanism_field<double>{"DY"} /* 4 */,
_nrn_mechanism_field<double>{"DZ"} /* 5 */,
_nrn_mechanism_field<double>{"v_unused"} /* 6 */
_nrn_mechanism_field<double>{"A", 3} /* 3 */,
_nrn_mechanism_field<double>{"B", 2} /* 4 */,
_nrn_mechanism_field<double>{"DX"} /* 5 */,
_nrn_mechanism_field<double>{"DY"} /* 6 */,
_nrn_mechanism_field<double>{"DZ"} /* 7 */,
_nrn_mechanism_field<double>{"DA", 3} /* 8 */,
_nrn_mechanism_field<double>{"DB", 2} /* 9 */,
_nrn_mechanism_field<double>{"v_unused"} /* 10 */
);

hoc_register_prop_size(mech_type, 7, 0);
hoc_register_prop_size(mech_type, 17, 0);
hoc_register_var(hoc_scalar_double, hoc_vector_double, hoc_intfunc);
hoc_register_npy_direct(mech_type, npy_direct_func_proc);
}
Expand Down

0 comments on commit 8971a57

Please sign in to comment.