Skip to content

Commit 74f4958

Browse files
compatibility with multiple continuous callbacks
1 parent b603567 commit 74f4958

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/callbacks.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ end
1313
function find_first_continuous_callback(integrator,tmin::Number,upcrossing::Float64,idx::Int,counter::Int,callback2)
1414
counter += 1 # counter is idx for callback2.
1515
tmin2,upcrossing2 = find_callback_time(integrator,callback2)
16-
if tmin < tmin2
17-
return tmin,upcrossing,idx,counter
18-
else
16+
17+
if (tmin2 < tmin && tmin2 != zero(typeof(tmin))) || tmin == zero(typeof(tmin))
1918
return tmin2,upcrossing,counter,counter
19+
else
20+
return tmin,upcrossing,idx,counter
2021
end
2122
end
2223

0 commit comments

Comments
 (0)