Skip to content

Commit

Permalink
Remove local copy of state in solver functions (#639)
Browse files Browse the repository at this point in the history
remove local copy of state in solver functions
  • Loading branch information
mattldawson authored Aug 30, 2024
1 parent 5f0f7a1 commit 89d9ee5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions include/micm/solver/backward_euler.inl
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ namespace micm
bool singular = false;

auto Yn = state.variables_;
auto Yn1 = state.variables_;
auto& Yn1 = state.variables_; // Yn1 will hold the new solution at the end of the solve
auto forcing = state.variables_;

while (t < time_step)
Expand Down Expand Up @@ -162,7 +162,6 @@ namespace micm
H = std::min(H, time_step - t);
}

state.variables_ = Yn1;
result.final_time_ = t;
return result;
}
Expand Down
3 changes: 1 addition & 2 deletions include/micm/solver/rosenbrock.inl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace micm

SolverResult result{};
result.state_ = SolverState::Running;
MatrixPolicy Y = state.variables_;
MatrixPolicy& Y = state.variables_; // Y will hold the new solution at the end of the solve
std::size_t num_rows = Y.NumRows();
std::size_t num_cols = Y.NumColumns();
MatrixPolicy Ynew(num_rows, num_cols);
Expand Down Expand Up @@ -192,7 +192,6 @@ namespace micm

result.final_time_ = present_time;
result.stats_ = stats;
state.variables_ = Y;

return result;
}
Expand Down

0 comments on commit 89d9ee5

Please sign in to comment.