Skip to content

Commit 514e148

Browse files
committed
fixes interpolation for stripped solutions
1 parent 012ff4e commit 514e148

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/solutions/ode_solutions.jl

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -619,14 +619,23 @@ function Base.showerror(io::IO, e::LazyInterpolationException)
619619
" uses lazy interpolation, which is incompatible with `strip_solution`.")
620620
end
621621

622-
function strip_solution(sol::ODESolution)
622+
struct ODENullFunction <: SciMLBase.AbstractODEFunction{false} end
623+
624+
function strip_solution(sol::ODESolution; strip_alg = false)
623625
if has_lazy_interpolation(sol.alg)
624626
throw(LazyInterpolationException(nameof(typeof(sol.alg))))
625627
end
626628

627629
interp = strip_interpolation(sol.interp)
628630

629631
@reset sol.interp = interp
630-
@reset sol.prob = nothing
631-
return @set sol.alg = nothing
632+
633+
@reset sol.prob = ODEProblem(ODENullFunction(), sol.prob.u0, sol.prob.tspan, p = sol.prob.p,
634+
problem_type = sol.prob.problem_type, sol.prob.kwargs...)
635+
636+
if strip_alg
637+
@reset sol.alg = nothing
638+
end
639+
640+
return sol
632641
end

0 commit comments

Comments
 (0)