SciML / DiffEqCallbacks.jl

A library of useful callbacks for hybrid scientific machine learning (SciML) with augmented differential equation solvers
https://docs.sciml.ai/DiffEqCallbacks/stable/
Other
85 stars 44 forks source link

remove complication from PresetTimeCallback #212

Closed oscardssmith closed 4 months ago

oscardssmith commented 4 months ago

Previously this code was doing some fairly weird stuff with the closures relying on indices being passed around in spooky ways. This was (I believe) intended as an optimization, but was confusing both me and the compiler, so I deleted it, and am replacing the in calls with insorted to make it faster.

Checklist

Additional context

Add any other context about the problem here.

ChrisRackauckas commented 4 months ago

No, it's not an optimization. It's a correctness thing. We need to subset after a thing is used to prevent double using the same tstop.

oscardssmith commented 4 months ago

added a check to the condition to make this only fire when the last dt brought us to a new t value.