Skip to content

Commit

Permalink
saveat type is used not tspan
Browse files Browse the repository at this point in the history
  • Loading branch information
ivborissov committed Jul 23, 2024
1 parent a8bfe9f commit 8b71000
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/ode_problem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ function remake_prob(prob::ODEProblem, init_func::Function, params::NamedTuple;
end
end

function remake_saveat(prob, saveat; tspan=prob.tspan)
function remake_saveat(prob, saveat; tspan=prob.tspan, time_type::DataType=Float64)

_saveat = isnothing(saveat) ? time_type[] : time_type.(saveat)

scb_orig = prob.kwargs[:callback].discrete_callbacks[1].affect!
utype = eltype(prob.u0)
Expand All @@ -135,10 +137,10 @@ function remake_saveat(prob, saveat; tspan=prob.tspan)
=#
saved_values = SavedValues(
LArray{utype,1,Array{utype,1},observables(prob)},
eltype(tspan)
eltype(_saveat)
)
save_func = scb_orig.save_func
scb_new = saving_wrapper(save_func, saved_values; saveat, save_scope=save_scope)
scb_new = saving_wrapper(save_func, saved_values; saveat=_saveat, save_scope=save_scope)

cbs = list_callbacks(prob)
cb_set = CallbackSet(scb_new,cbs[1]...,cbs[2]...)
Expand Down

0 comments on commit 8b71000

Please sign in to comment.