diff --git a/include/amici/forwardproblem.h b/include/amici/forwardproblem.h index 9b5252c243..8c500bf73c 100644 --- a/include/amici/forwardproblem.h +++ b/include/amici/forwardproblem.h @@ -274,9 +274,9 @@ class ForwardProblem { /** * @brief Execute everything necessary for the handling of data points * - * @param it index of data point + * @param t measurement timepoint */ - void handleDataPoint(int it); + void handleDataPoint(realtype t); /** * @brief Applies the event bolus to the current state diff --git a/src/forwardproblem.cpp b/src/forwardproblem.cpp index 67ccd455f3..c090f51280 100644 --- a/src/forwardproblem.cpp +++ b/src/forwardproblem.cpp @@ -152,9 +152,8 @@ void ForwardProblem::workForwardProblem() { // Solve for next output timepoint while (t_ < next_t_out) { if (is_next_t_too_close(t_, next_t_out)) { - // next timepoint is too close to current timepoint - // update `t_`, required by `handleDataPoint` - t_ = next_t_out; + // next timepoint is too close to current timepoint. + // we use the state of the current timepoint. break; } @@ -193,7 +192,7 @@ void ForwardProblem::workForwardProblem() { } } } - handleDataPoint(it_); + handleDataPoint(next_t_out); } /* fill events */ @@ -381,11 +380,11 @@ void ForwardProblem::handle_secondary_event(realtype* tlastroot) { } } -void ForwardProblem::handleDataPoint(int /*it*/) { +void ForwardProblem::handleDataPoint(realtype t) { /* We only store the simulation state if it's not the initial state, as the initial state is stored anyway and we want to avoid storing it twice */ - if (t_ != model->t0() && timepoint_states_.count(t_) == 0) - timepoint_states_[t_] = getSimulationState(); + if (t != model->t0() && timepoint_states_.count(t) == 0) + timepoint_states_[t] = getSimulationState(); /* store diagnosis information for debugging */ solver->storeDiagnosis(); }