Skip to content

Commit e5bd789

Browse files
feat: integrate callback saving into integrator init and finalize
1 parent e4787e4 commit e5bd789

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

lib/OrdinaryDiffEqCore/src/integrators/integrator_utils.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ function solution_endpoint_match_cur_integrator!(integrator)
240240
copyat_or_push!(integrator.sol.alg_choice, integrator.saveiter,
241241
integrator.cache.current)
242242
end
243+
SciMLBase.save_final_discretes!(integrator, integrator.opts.callback)
243244
end
244245
end
245246

lib/OrdinaryDiffEqCore/src/solve.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,4 +745,8 @@ function initialize_callbacks!(integrator, initialize_save = true)
745745

746746
# reset this as it is now handled so the integrators should proceed as normal
747747
integrator.u_modified = false
748+
749+
if initialize_save
750+
SciMLBase.save_discretes_if_enabled!(integrator, integrator.opts.callback; skip_duplicates = true)
751+
end
748752
end

0 commit comments

Comments
 (0)