Skip to content

Commit

Permalink
Add subsolutions
Browse files Browse the repository at this point in the history
Ref #901
  • Loading branch information
YingboMa committed Apr 4, 2023
1 parent 3583407 commit 321238b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/ensemble/ensemble_solutions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ function EnsembleSolution(sim::T, elapsedTime,
typeof(sim)}(sim, elapsedTime, converged)
end

Base.reverse(sim::EnsembleSolution) = EnsembleSolution(reverse(sim.u), sim.elapsedTime, sim.converged)
function Base.reverse(sim::EnsembleSolution)
EnsembleSolution(reverse(sim.u), sim.elapsedTime, sim.converged)
end

"""
$(TYPEDEF)
Expand Down
2 changes: 1 addition & 1 deletion src/problems/problem_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,4 @@ function Base.summary(io::IO, prob::AbstractPDEProblem)
no_color)
end

Base.copy(p::SciMLBase.NullParameters) = p
Base.copy(p::SciMLBase.NullParameters) = p
13 changes: 9 additions & 4 deletions src/solutions/ode_solutions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ https://docs.sciml.ai/DiffEqDocs/stable/basics/solution/
[the return code documentation](https://docs.sciml.ai/SciMLBase/stable/interfaces/Solutions/#retcodes).
"""
struct ODESolution{T, N, uType, uType2, DType, tType, rateType, P, A, IType, S,
AC <: Union{Nothing, Vector{Int}}} <:
AC <: Union{Nothing, Vector{Int}}, SSS} <:
AbstractODESolution{T, N, uType}
u::uType
u_analytic::uType2
Expand All @@ -42,6 +42,7 @@ struct ODESolution{T, N, uType, uType2, DType, tType, rateType, P, A, IType, S,
stats::S
alg_choice::AC
retcode::ReturnCode.T
subsolutions::Union{SSS, Nothing}
end

Base.@propagate_inbounds function Base.getproperty(x::AbstractODESolution, s::Symbol)
Expand All @@ -53,12 +54,16 @@ Base.@propagate_inbounds function Base.getproperty(x::AbstractODESolution, s::Sy
end

function ODESolution{T, N}(u, u_analytic, errors, t, k, prob, alg, interp, dense,
tslocation, stats, alg_choice, retcode) where {T, N}
tslocation, stats, alg_choice, retcode,
subsolutions = nothing) where {T, N}
return ODESolution{T, N, typeof(u), typeof(u_analytic), typeof(errors), typeof(t),
typeof(k), typeof(prob), typeof(alg), typeof(interp),
typeof(stats),
typeof(alg_choice)}(u, u_analytic, errors, t, k, prob, alg, interp,
dense, tslocation, stats, alg_choice, retcode)
typeof(alg_choice), typeof(subsolutions)}(u, u_analytic, errors, t,
k, prob, alg, interp,
dense, tslocation, stats,
alg_choice, retcode,
subsolutions)
end

function (sol::AbstractODESolution)(t, ::Type{deriv} = Val{0}; idxs = nothing,
Expand Down
2 changes: 1 addition & 1 deletion src/solutions/pde_solutions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ struct PDENoTimeSolution{T, N, uType, Disc, Sol, domType, ivType, dvType, P, A,
retcode::ReturnCode.T
stats::S
end

TruncatedStacktraces.@truncate_stacktrace PDENoTimeSolution 1 2

const PDESolution{T, N, S, D} = Union{PDETimeSeriesSolution{T, N, S, D},
Expand Down

0 comments on commit 321238b

Please sign in to comment.