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

Remove local copy of state in solver functions #639

Merged
merged 1 commit into from
Aug 30, 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
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
Loading