Skip to content

Commit

Permalink
Leave out KINETIC block for now
Browse files Browse the repository at this point in the history
Due to the CONSERVE statement (among others), the KINETIC block needs
special handling when generating code for CVODE.
  • Loading branch information
JCGoran committed Oct 2, 2024
1 parent 09b4ee7 commit e0c087c
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,19 @@ int run_nmodl(int argc, const char* argv[]) {
ast_to_nmodl(*ast, filepath("unroll"));
SymtabVisitor(update_symtab).visit_program(*ast);
}
if (neuron_code) {
nmodl::pybind_wrappers::EmbeddedPythonLoader::get_instance()
.api()
.initialize_interpreter();
logger->info("Running CVODE visitor");
CvodeVisitor().visit_program(*ast);
SymtabVisitor(update_symtab).visit_program(*ast);
ast_to_nmodl(*ast, filepath("cvode"));
nmodl::pybind_wrappers::EmbeddedPythonLoader::get_instance()
.api()
.finalize_interpreter();
}


/// note that we can not symtab visitor in update mode as we
/// replace kinetic block with derivative block of same name
Expand Down Expand Up @@ -499,18 +512,11 @@ int run_nmodl(int argc, const char* argv[]) {
const bool sympy_sparse = solver_exists(*ast, "sparse");

if (sympy_conductance || sympy_analytic || sympy_sparse || sympy_derivimplicit ||
sympy_linear || neuron_code) {
sympy_linear) {
nmodl::pybind_wrappers::EmbeddedPythonLoader::get_instance()
.api()
.initialize_interpreter();

if (neuron_code) {
logger->info("Running CVODE visitor");
CvodeVisitor().visit_program(*ast);
SymtabVisitor(update_symtab).visit_program(*ast);
ast_to_nmodl(*ast, filepath("cvode"));
}

if (sympy_conductance) {
logger->info("Running sympy conductance visitor");
SympyConductanceVisitor().visit_program(*ast);
Expand Down

0 comments on commit e0c087c

Please sign in to comment.