Skip to content

Commit 9acffb0

Browse files
committed
Fix backward vector callback detection when step is exactly on event date
1 parent a98cc86 commit 9acffb0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/callbacks.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ has_continuous_callback(cb::DiscreteCallback) = false
5050
has_continuous_callback(cb::ContinuousCallback) = true
5151
has_continuous_callback(cb::VectorContinuousCallback) = true
5252
has_continuous_callback(cb::CallbackSet) = !isempty(cb.continuous_callbacks)
53-
has_continuous_callback(cb::Nothing) = false#======================================================##======================================================#
53+
has_continuous_callback(cb::Nothing) = false
5454

5555
# Callback handling
5656

@@ -478,7 +478,7 @@ function find_callback_time(integrator, callback::VectorContinuousCallback, coun
478478
bottom_t = integrator.tprev
479479
end
480480
if callback.rootfind != SciMLBase.NoRootFind && !isdiscrete(integrator.alg)
481-
min_t = nextfloat(top_t)
481+
min_t = isone(integrator.tdir) ? nextfloat(top_t) : prevfloat(top_t)
482482
min_event_idx = -1
483483
for idx in 1:length(event_idx)
484484
if ArrayInterface.allowed_getindex(event_idx, idx) != 0

0 commit comments

Comments
 (0)