Skip to content

Commit 82d6c62

Browse files
Merge pull request #545 from SciML/ap/print_retcode
Print return code for NonTimeseries Solutions as well
2 parents a0a5505 + 912f3ca commit 82d6c62

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "SciMLBase"
22
uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
33
authors = ["Chris Rackauckas <accounts@chrisrackauckas.com> and contributors"]
4-
version = "2.9.0"
4+
version = "2.9.1"
55

66
[deps]
77
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"

src/solutions/nonlinear_solutions.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,11 @@ function sensitivity_solution(sol::AbstractNonlinearSolution, u)
9393
T = eltype(eltype(u))
9494
N = ndims(u)
9595

96+
# Some of the subtypes might not have a trace field
97+
trace = hasfield(typeof(sol), :trace) ? sol.trace : nothing
98+
9699
NonlinearSolution{T, N, typeof(u), typeof(sol.resid), typeof(sol.prob),
97100
typeof(sol.alg), typeof(sol.original), typeof(sol.left),
98-
typeof(sol.stats), trace(sol.trace)}(u, sol.resid, sol.prob, sol.alg, sol.retcode,
99-
sol.original, sol.left, sol.right, sol.stats, sol.trace)
101+
typeof(sol.stats), trace(trace)}(u, sol.resid, sol.prob, sol.alg, sol.retcode,
102+
sol.original, sol.left, sol.right, sol.stats, trace)
100103
end

src/solutions/solution_interface.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ Base.setindex!(A::AbstractNoTimeSolution, v, I::Vararg{Int, N}) where {N} = (A.u
1414
Base.size(A::AbstractNoTimeSolution) = size(A.u)
1515

1616
function Base.show(io::IO, m::MIME"text/plain", A::AbstractNoTimeSolution)
17-
(print(io, "u: "); show(io, m, A.u))
17+
if hasfield(typeof(A), :retcode)
18+
println(io, string("retcode: ", A.retcode))
19+
end
20+
print(io, "u: ")
21+
show(io, m, A.u)
1822
end
1923

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

0 commit comments

Comments
 (0)