Skip to content

Commit

Permalink
model
Browse files Browse the repository at this point in the history
  • Loading branch information
dweindl committed Oct 20, 2024
1 parent cd20bf7 commit 1618466
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions include/amici/forwardproblem.h
Original file line number Diff line number Diff line change
Expand Up @@ -444,16 +444,15 @@ class FinalStateStorer : public ContextManager {
~FinalStateStorer() {
if (fwd_) {
fwd_->final_state_ = fwd_->getSimulationState();
// if there is an associated data point, also store it in
// if there is an associated output timepoint, also store it in
// timepoint_states if it's not present there.
// this may happen if there is an error just at
// (or indistinguishably before) an output timepoint
auto final_time = fwd_->getFinalTime();
if (!fwd_->timepoint_states_.count(final_time) && fwd_->edata
&& std::find(
fwd_->edata->ts_.cbegin(), fwd_->edata->ts_.cend(),
final_time
) != fwd_->edata->ts_.cend()) {
auto const timepoints = fwd_->model->getTimepoints();
if (!fwd_->timepoint_states_.count(final_time)
&& std::find(timepoints.cbegin(), timepoints.cend(), final_time)
!= timepoints.cend()) {
fwd_->timepoint_states_[final_time] = fwd_->final_state_;
}
}
Expand Down

0 comments on commit 1618466

Please sign in to comment.