Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load 'morphology' symbol during registration #1393

Merged
merged 3 commits into from
Aug 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/codegen/codegen_neuron_cpp_visitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,10 @@
// throw std::runtime_error("Not implemented, global vectorize something else.");
}

if (info.diam_used) {
printer->fmt_line("Symbol* morphology_sym;");

Check warning on line 936 in src/codegen/codegen_neuron_cpp_visitor.cpp

View check run for this annotation

Codecov / codecov/patch

src/codegen/codegen_neuron_cpp_visitor.cpp#L936

Added line #L936 was not covered by tests
}

printer->pop_block(";");

print_global_var_struct_assertions();
Expand Down Expand Up @@ -1234,6 +1238,10 @@
printer->add_line("_nrn_thread_reg(mech_type, 0, thread_mem_cleanup);");
}

if (info.diam_used) {
printer->fmt_line("{}.morphology_sym = hoc_lookup(\"morphology\");", global_struct_instance());
}

printer->pop_block();
}

Expand Down Expand Up @@ -1272,7 +1280,7 @@
}


void CodegenNeuronCppVisitor::print_neuron_global_variable_declarations() {

Check warning on line 1283 in src/codegen/codegen_neuron_cpp_visitor.cpp

View workflow job for this annotation

GitHub Actions / { "flag_warnings": "ON", "glibc_asserts": "ON", "os": "ubuntu-22.04" }

unused variable ‘int_type’ [-Wunused-variable]

Check warning on line 1283 in src/codegen/codegen_neuron_cpp_visitor.cpp

View workflow job for this annotation

GitHub Actions / { "flag_warnings": "ON", "os": "ubuntu-22.04", "sanitizer": "undefined" }

unused variable 'int_type' [-Wunused-variable]
for (auto const& [var, type]: info.neuron_global_variables) {
auto const name = var->get_name();
printer->fmt_line("extern {} {};", type, name);
Expand Down Expand Up @@ -1587,7 +1595,7 @@
fmt::format("_parameter_defaults[{}]", i_param),
var_name);
}
}

Check warning on line 1598 in src/codegen/codegen_neuron_cpp_visitor.cpp

View workflow job for this annotation

GitHub Actions / { "flag_warnings": "ON", "glibc_asserts": "ON", "os": "ubuntu-22.04" }

unused variable ‘var_value’ [-Wunused-variable]

Check warning on line 1598 in src/codegen/codegen_neuron_cpp_visitor.cpp

View workflow job for this annotation

GitHub Actions / { "flag_warnings": "ON", "os": "ubuntu-22.04", "sanitizer": "undefined" }

unused variable 'var_value' [-Wunused-variable]
if (info.point_process) {
printer->pop_block();
}
Expand All @@ -1602,9 +1610,7 @@
for (size_t i = 0; i < codegen_int_variables.size(); ++i) {
auto var_info = codegen_int_variables[i];
if (var_info.symbol->get_name() == naming::DIAM_VARIABLE) {
printer->add_line("Symbol * morphology_sym = hoc_lookup(\"morphology\");");
printer->fmt_line("Prop * morphology_prop = need_memb(morphology_sym);");

printer->fmt_line("Prop * morphology_prop = need_memb({}.morphology_sym);", global_struct_instance());
printer->fmt_line(
"_ppvar[{}] = _nrn_mechanism_get_param_handle(morphology_prop, 0);", i);
}
Expand Down
Loading