Skip to content

Commit

Permalink
Fix mech_type in NEURON codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
iomaganaris committed Nov 30, 2023
1 parent bc0d148 commit 959d32c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/codegen/codegen_neuron_cpp_visitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,12 +391,11 @@ void CodegenNeuronCppVisitor::print_mechanism_register() {
printer->fmt_push_block("void _{}_reg()", info.mod_file);
print_sdlists_init(true);
// type related information
auto suffix = add_escape_quote(info.mod_suffix);
printer->add_newline();
printer->fmt_line("int mech_type = nrn_get_mechtype({});", suffix);
printer->fmt_line("int mech_type = nrn_get_mechtype({}[1]);", get_channel_info_var_name());

// More things to add here
printer->add_line("_nrn_mechanism_register_data_fields(_mechtype,");
printer->add_line("_nrn_mechanism_register_data_fields(mech_type,");
printer->increase_indent();
const auto codegen_float_variables_size = codegen_float_variables.size();
for (int i = 0; i < codegen_float_variables_size; ++i) {
Expand Down
4 changes: 2 additions & 2 deletions test/unit/codegen/codegen_neuron_cpp_visitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ void _nrn_mechanism_register_data_fields(Args&&... args) {
/* Ds */
_dlist1[0] = {7, 0};
int mech_type = nrn_get_mechtype("pas_test");
_nrn_mechanism_register_data_fields(_mechtype,
int mech_type = nrn_get_mechtype(mechanism_info[1]);
_nrn_mechanism_register_data_fields(mech_type,
_nrn_mechanism_field<double>{"g"} /* 0 */,
_nrn_mechanism_field<double>{"e"} /* 1 */,
_nrn_mechanism_field<double>{"i"} /* 2 */,
Expand Down

0 comments on commit 959d32c

Please sign in to comment.