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

Improve naming of LinEquation. #1509

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 5 additions & 5 deletions src/language/nmodl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1152,15 +1152,15 @@
type: Expression

- LinEquation:
brief: "TODO"
brief: "One equation in a system of equations tha collectively form a LINEAR block."
nmodl: "~ "
members:
- left_linxpression:
1uc marked this conversation as resolved.
Show resolved Hide resolved
brief: "TODO"
- lhs:
brief: "Left-hand-side of the equation."
type: Expression
suffix: {value: " = "}
- linxpression:
brief: "TODO"
- rhs:
brief: "Right-hand-side of the equation."
type: Expression

- FunctionCall:
Expand Down
4 changes: 2 additions & 2 deletions src/visitors/sympy_replace_solutions_visitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,11 @@ void SympyReplaceSolutionsVisitor::visit_diff_eq_expression(ast::DiffEqExpressio
void SympyReplaceSolutionsVisitor::visit_lin_equation(ast::LinEquation& node) {
logger->debug("SympyReplaceSolutionsVisitor :: visit {}", to_nmodl(node));
auto get_lhs = [](const ast::Node& node) -> std::shared_ptr<ast::Expression> {
return dynamic_cast<const ast::LinEquation&>(node).get_left_linxpression();
return dynamic_cast<const ast::LinEquation&>(node).get_lhs();
};

auto get_rhs = [](const ast::Node& node) -> std::shared_ptr<ast::Expression> {
return dynamic_cast<const ast::LinEquation&>(node).get_left_linxpression();
return dynamic_cast<const ast::LinEquation&>(node).get_rhs();
1uc marked this conversation as resolved.
Show resolved Hide resolved
};

try_replace_tagged_statement(node, get_lhs, get_rhs);
Expand Down
4 changes: 2 additions & 2 deletions src/visitors/sympy_solver_visitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,9 +577,9 @@ void SympySolverVisitor::visit_derivative_block(ast::DerivativeBlock& node) {

void SympySolverVisitor::visit_lin_equation(ast::LinEquation& node) {
check_expr_statements_in_same_block();
std::string lin_eq = to_nmodl_for_sympy(*node.get_left_linxpression());
std::string lin_eq = to_nmodl_for_sympy(*node.get_lhs());
lin_eq += " = ";
lin_eq += to_nmodl_for_sympy(*node.get_linxpression());
lin_eq += to_nmodl_for_sympy(*node.get_rhs());
eq_system.push_back(lin_eq);
expression_statements.insert(current_expression_statement);
last_expression_statement = current_expression_statement;
Expand Down
Loading