Skip to content

Commit 6c3b7df

Browse files
feat: add specialized observed for solutions of DDEProblems
1 parent 06864fd commit 6c3b7df

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/solutions/ode_solutions.jl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,28 @@ function (sol::AbstractODESolution)(t::AbstractVector{<:Number}, ::Type{deriv},
354354
return DiffEqArray(u, t, p, sol; discretes)
355355
end
356356

357+
struct DDESolutionHistoryWrapper{T}
358+
sol::T
359+
end
360+
361+
function (w::DDESolutionHistoryWrapper)(p, t; idxs = nothing)
362+
w.sol(t; idxs)
363+
end
364+
function (w::DDESolutionHistoryWrapper)(out, p, t; idxs = nothing)
365+
w.sol(out, t; idxs)
366+
end
367+
function (w::DDESolutionHistoryWrapper)(p, t, deriv::Type{Val{i}}; idxs = nothing) where {i}
368+
w.sol(t, deriv; idxs)
369+
end
370+
function (w::DDESolutionHistoryWrapper)(
371+
out, p, t, deriv::Type{Val{i}}; idxs = nothing) where {i}
372+
w.sol(out, t, deriv; idxs)
373+
end
374+
375+
function SymbolicIndexingInterface.get_history_function(sol::ODESolution)
376+
DDESolutionHistoryWrapper(sol)
377+
end
378+
357379
# public API, used by MTK
358380
"""
359381
create_parameter_timeseries_collection(sys, ps, tspan)

0 commit comments

Comments
 (0)