Skip to content

Commit

Permalink
template updated to handle events at the same time
Browse files Browse the repository at this point in the history
  • Loading branch information
Siel committed Mar 19, 2024
1 parent 77c4c6a commit 3e1ed74
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions inst/Rust/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,11 @@ impl<'a> Predict<'a> for Ode {
// Perform a "step" of the model, i.e. solve the ODEs from the current time to the next time
// In the next step, we use this result as the initial state
fn state_step(&self, x: &mut Self::State, system: &Self::Model, time: f64, next_time: f64) {
// if time >= next_time {
// panic!("time error")
// }
if time > next_time {
panic!("time error")
} else if time == next_time {
return;
}
let mut stepper = Dopri5::new(system.clone(), time, next_time, 1e-3, *x, RTOL, ATOL);
let _res = stepper.integrate();
let y = stepper.y_out();
Expand Down

0 comments on commit 3e1ed74

Please sign in to comment.