Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow storing a trace object in NonlinearSolution #544

Merged
merged 1 commit into from
Nov 23, 2023
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.8.2"
version = "2.9.0"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand Down
13 changes: 7 additions & 6 deletions src/solutions/nonlinear_solutions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ or the steady state solution to a differential equation defined by a SteadyState
- `right`: if the solver is bracketing method, this is the final right bracket value.
- `stats`: statistics of the solver, such as the number of function evaluations required.
"""
struct NonlinearSolution{T, N, uType, R, P, A, O, uType2, S} <:
struct NonlinearSolution{T, N, uType, R, P, A, O, uType2, S, Tr} <:
AbstractNonlinearSolution{T, N}
u::uType
resid::R
Expand All @@ -63,6 +63,7 @@ struct NonlinearSolution{T, N, uType, R, P, A, O, uType2, S} <:
left::uType2
right::uType2
stats::S
trace::Tr
end

TruncatedStacktraces.@truncate_stacktrace NonlinearSolution 1 2
Expand All @@ -78,14 +79,14 @@ function build_solution(prob::AbstractNonlinearProblem,
left = nothing,
right = nothing,
stats = nothing,
trace = nothing,
kwargs...)
T = eltype(eltype(u))
N = ndims(u)

NonlinearSolution{T, N, typeof(u), typeof(resid), typeof(prob), typeof(alg),
typeof(original), typeof(left), typeof(stats)}(u, resid, prob, alg,
retcode, original,
left, right, stats)
typeof(original), typeof(left), typeof(stats), typeof(trace)}(u, resid, prob, alg,
retcode, original, left, right, stats, trace)
end

function sensitivity_solution(sol::AbstractNonlinearSolution, u)
Expand All @@ -94,6 +95,6 @@ function sensitivity_solution(sol::AbstractNonlinearSolution, u)

NonlinearSolution{T, N, typeof(u), typeof(sol.resid), typeof(sol.prob),
typeof(sol.alg), typeof(sol.original), typeof(sol.left),
typeof(sol.stats)}(u, sol.resid, sol.prob, sol.alg, sol.retcode,
sol.original, sol.left, sol.right, sol.stats)
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)
end
Loading