Skip to content

Commit

Permalink
Merge pull request #545 from SciML/ap/print_retcode
Browse files Browse the repository at this point in the history
Print return code for NonTimeseries Solutions as well
  • Loading branch information
ChrisRackauckas authored Nov 24, 2023
2 parents a0a5505 + 912f3ca commit 82d6c62
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
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.9.0"
version = "2.9.1"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand Down
7 changes: 5 additions & 2 deletions src/solutions/nonlinear_solutions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,11 @@ function sensitivity_solution(sol::AbstractNonlinearSolution, u)
T = eltype(eltype(u))
N = ndims(u)

# Some of the subtypes might not have a trace field
trace = hasfield(typeof(sol), :trace) ? sol.trace : nothing

NonlinearSolution{T, N, typeof(u), typeof(sol.resid), typeof(sol.prob),
typeof(sol.alg), typeof(sol.original), typeof(sol.left),
typeof(sol.stats), trace(sol.trace)}(u, sol.resid, sol.prob, sol.alg, sol.retcode,
sol.original, sol.left, sol.right, sol.stats, sol.trace)
typeof(sol.stats), trace(trace)}(u, sol.resid, sol.prob, sol.alg, sol.retcode,
sol.original, sol.left, sol.right, sol.stats, trace)
end
6 changes: 5 additions & 1 deletion src/solutions/solution_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ Base.setindex!(A::AbstractNoTimeSolution, v, I::Vararg{Int, N}) where {N} = (A.u
Base.size(A::AbstractNoTimeSolution) = size(A.u)

function Base.show(io::IO, m::MIME"text/plain", A::AbstractNoTimeSolution)
(print(io, "u: "); show(io, m, A.u))
if hasfield(typeof(A), :retcode)
println(io, string("retcode: ", A.retcode))
end
print(io, "u: ")
show(io, m, A.u)
end

# For augmenting system information to enable symbol based indexing of interpolated solutions
Expand Down

0 comments on commit 82d6c62

Please sign in to comment.