Skip to content

Commit 0f7073f

Browse files
Merge pull request SciML#629 from AayushSabharwal/as/fix-disc-save
feat: integrate callback saving into integrator init and finalize
2 parents d360e82 + f3a767a commit 0f7073f

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

Project.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ ADTypes = "1"
3838
Adapt = "3, 4"
3939
ArrayInterface = "6, 7"
4040
DataStructures = "0.18, 0.19"
41-
DiffEqBase = "6.154"
41+
DiffEqBase = "6.187"
4242
DiffEqNoiseProcess = "5.13"
4343
DocStringExtensions = "0.8, 0.9"
4444
FastPower = "1"
@@ -48,17 +48,18 @@ JumpProcesses = "9"
4848
LevyArea = "1.0.0"
4949
LinearAlgebra = "1.6"
5050
Logging = "1.6"
51+
ModelingToolkit = "10"
5152
MuladdMacro = "0.2.1"
5253
NLsolve = "4"
5354
OrdinaryDiffEq = "6.87"
54-
OrdinaryDiffEqCore = "1.12.1"
55+
OrdinaryDiffEqCore = "1.32.0"
5556
OrdinaryDiffEqDifferentiation = "1.9"
5657
OrdinaryDiffEqNonlinearSolve = "1"
5758
Random = "1.6"
5859
RandomNumbers = "1.5.3"
5960
RecursiveArrayTools = "2, 3"
6061
Reexport = "0.2, 1.0"
61-
SciMLBase = "2.71"
62+
SciMLBase = "2.115"
6263
SciMLOperators = "0.2.9, 0.3, 0.4, 1"
6364
SparseArrays = "1.6"
6465
StaticArrays = "0.11, 0.12, 1.0"

src/integrators/integrator_utils.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ end
234234
copyat_or_push!(integrator.sol.u, integrator.saveiter,
235235
integrator.u[integrator.opts.save_idxs], Val{false})
236236
end
237+
SciMLBase.save_final_discretes!(integrator, integrator.opts.callback)
237238
end
238239
if (!isnothing(integrator.W) && integrator.W.curt != integrator.t) ||
239240
(!isnothing(integrator.P) && integrator.P.curt != integrator.t)

src/solve.jl

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

792792
# reset this as it is now handled so the integrators should proceed as normal
793793
integrator.u_modified = false
794+
795+
if initialize_save
796+
SciMLBase.save_discretes_if_enabled!(integrator, integrator.opts.callback; skip_duplicates = true)
797+
end
794798
end

test/reversal_tests.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@ end
124124
else
125125
prob_forward = remake(prob, noise = W_forward, u0 = vec(prob.u0))
126126
end
127-
sys = modelingtoolkitize(prob_forward)
127+
sys = complete(modelingtoolkitize(prob_forward))
128128
sys2 = stochastic_integral_transform(sys, -1 // 1)
129-
fdrift = eval(generate_rhs(sys2)[i])
130-
fdif = eval(generate_diffusion_function(sys2)[i])
129+
fdrift = generate_rhs(sys2; expression = Val{false})[i]
130+
fdif = generate_diffusion_function(sys2; expression = Val{false})[i]
131131

132132
for solver in Ito_solver
133133
println("solver: ", solver)

0 commit comments

Comments
 (0)