Skip to content

Commit

Permalink
handleDataPoint
Browse files Browse the repository at this point in the history
  • Loading branch information
dweindl committed Dec 11, 2023
1 parent 39fa42a commit 7e4ed05
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions include/amici/forwardproblem.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 6 additions & 7 deletions src/forwardproblem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -193,7 +192,7 @@ void ForwardProblem::workForwardProblem() {
}
}
}
handleDataPoint(it_);
handleDataPoint(next_t_out);
}

/* fill events */
Expand Down Expand Up @@ -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();
}
Expand Down

0 comments on commit 7e4ed05

Please sign in to comment.