Skip to content
Snippets Groups Projects
Unverified Commit 6c489892 authored by Nora Abi Akar's avatar Nora Abi Akar Committed by GitHub
Browse files

modcc: exit solvers early if errors encountered (#1755)

Check for errors in the solvers before the `finalize` stage and return early if errors were encountered. 

Fixes #1722.
parent 9294e7d9
No related branches found
No related tags found
No related merge requests found
...@@ -448,6 +448,7 @@ void SparseSolverVisitor::visit(ConserveExpression *e) { ...@@ -448,6 +448,7 @@ void SparseSolverVisitor::visit(ConserveExpression *e) {
} }
void SparseSolverVisitor::finalize() { void SparseSolverVisitor::finalize() {
if (has_error()) return;
if (solve_variant_ == solverVariant::steadystate && !conserve_) { if (solve_variant_ == solverVariant::steadystate && !conserve_) {
error({"Conserve statement(s) missing in steady-state solver", {}}); error({"Conserve statement(s) missing in steady-state solver", {}});
...@@ -537,6 +538,8 @@ void LinearSolverVisitor::visit(LinearExpression *e) { ...@@ -537,6 +538,8 @@ void LinearSolverVisitor::visit(LinearExpression *e) {
} }
void LinearSolverVisitor::finalize() { void LinearSolverVisitor::finalize() {
if (has_error()) return;
system_.augment(rhs_); system_.augment(rhs_);
// Reduce the system // Reduce the system
...@@ -750,6 +753,7 @@ void SparseNonlinearSolverVisitor::visit(AssignmentExpression *e) { ...@@ -750,6 +753,7 @@ void SparseNonlinearSolverVisitor::visit(AssignmentExpression *e) {
} }
void SparseNonlinearSolverVisitor::finalize() { void SparseNonlinearSolverVisitor::finalize() {
if (has_error()) return;
// Create rhs of A_ // Create rhs of A_
std::vector<std::string> rhs; std::vector<std::string> rhs;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment