Skip to content

Commit 9ad9134

Browse files
feat: add support for save_discretes in integrator.opts
1 parent 596c603 commit 9ad9134

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/callbacks.jl

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -596,10 +596,12 @@ function apply_callback!(integrator,
596596

597597
@inbounds if callback.save_positions[2]
598598
savevalues!(integrator, true)
599-
if callback isa VectorContinuousCallback
600-
SciMLBase.save_discretes!(integrator, callback, event_idx)
601-
else
602-
SciMLBase.save_discretes!(integrator, callback)
599+
if isdefined(integrator.opts, :save_discretes) && integrator.opts.save_discretes
600+
if callback isa VectorContinuousCallback
601+
SciMLBase.save_discretes!(integrator, callback, event_idx)
602+
else
603+
SciMLBase.save_discretes!(integrator, callback)
604+
end
603605
end
604606
saved_in_cb = true
605607
end
@@ -627,7 +629,9 @@ end
627629
end
628630
@inbounds if callback.save_positions[2]
629631
savevalues!(integrator, true)
630-
SciMLBase.save_discretes!(integrator, callback)
632+
if isdefined(integrator.opts, :save_discretes) && integrator.opts.save_discretes
633+
SciMLBase.save_discretes!(integrator, callback)
634+
end
631635
saved_in_cb = true
632636
end
633637
end

0 commit comments

Comments
 (0)