Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SciMLBase"
uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
authors = ["Chris Rackauckas <[email protected]> and contributors"]
version = "2.53.1"
version = "2.53.2"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand Down
12 changes: 9 additions & 3 deletions src/solutions/ode_solutions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -619,14 +619,20 @@ function Base.showerror(io::IO, e::LazyInterpolationException)
" uses lazy interpolation, which is incompatible with `strip_solution`.")
end

function strip_solution(sol::ODESolution)
function strip_solution(sol::ODESolution; strip_alg = false)
if has_lazy_interpolation(sol.alg)
throw(LazyInterpolationException(nameof(typeof(sol.alg))))
end

interp = strip_interpolation(sol.interp)

@reset sol.interp = interp
@reset sol.prob = nothing
return @set sol.alg = nothing

@reset sol.prob = (; p = nothing)

if strip_alg
@reset sol.alg = nothing
end

return sol
end
10 changes: 5 additions & 5 deletions test/downstream/ode_stripping.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ prob = ODEProblem(lorenz!, u0, tspan)
# implicit solver so we can test cache stripping worked
sol = solve(prob, Rosenbrock23())

@test isnothing(SciMLBase.strip_solution(sol).prob)
stripped_sol = SciMLBase.strip_solution(sol)

@test isnothing(SciMLBase.strip_solution(sol).alg)
@test isnothing(SciMLBase.strip_solution(sol, strip_alg = true).alg)

@test isnothing(SciMLBase.strip_solution(sol).interp.f)
@test isnothing(stripped_sol.interp.f)

@test isnothing(SciMLBase.strip_solution(sol).interp.cache.jac_config)
@test isnothing(stripped_sol.interp.cache.jac_config)

@test isnothing(SciMLBase.strip_solution(sol).interp.cache.grad_config)
@test isnothing(stripped_sol.interp.cache.grad_config)
Loading