Skip to content

Commit 4a20a10

Browse files
committed
Add error when calling solution with dense=false
1 parent d6a1841 commit 4a20a10

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/integrator/taylorsolution.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,26 +195,30 @@ Evaluate `sol.x` at time `t`.
195195
196196
See also [`timeindex`](@ref).
197197
"""
198-
function (sol::TaylorSolution{T, U, 1})(t::T) where {T, U}
198+
(sol::TaylorSolution)(t) = sol(Val(isnothing(sol.p)), t)
199+
200+
(sol::TaylorSolution{T, U, N})(::Val{true}, t::TT) where {T, U, N, TT<:TaylorSolutionCallingArgs{T,U}} = error("`TaylorSolution` objects computed from calls to `taylorinteg` with `dense=false` are not callable.")
201+
202+
function (sol::TaylorSolution{T, U, 1})(::Val{false}, t::T) where {T, U}
199203
# Get index of sol.x that interpolates at time t
200204
ind::Int, δt::T = timeindex(sol, t)
201205
# Evaluate sol.x[ind] at δt
202206
return (sol.p[ind])(δt)::U
203207
end
204-
function (sol::TaylorSolution{T, U, 1})(t::TT) where {T, U, TT<:TaylorSolutionCallingArgs{T,U}}
208+
function (sol::TaylorSolution{T, U, 1})(::Val{false}, t::TT) where {T, U, TT<:TaylorSolutionCallingArgs{T,U}}
205209
# Get index of sol.x that interpolates at time t
206210
ind::Int, δt::TT = timeindex(sol, t)
207211
# Evaluate sol.x[ind] at δt
208212
return (sol.p[ind])(δt)::TT
209213
end
210214

211-
function (sol::TaylorSolution{T, U, 2})(t::T) where {T, U}
215+
function (sol::TaylorSolution{T, U, 2})(::Val{false}, t::T) where {T, U}
212216
# Get index of sol.x that interpolates at time t
213217
ind::Int, δt::T = timeindex(sol, t)
214218
# Evaluate sol.x[ind] at δt
215219
return view(sol.p, ind, :)(δt)::Vector{U}
216220
end
217-
function (sol::TaylorSolution{T, U, 2})(t::TT) where {T, U, TT<:TaylorSolutionCallingArgs{T,U}}
221+
function (sol::TaylorSolution{T, U, 2})(::Val{false}, t::TT) where {T, U, TT<:TaylorSolutionCallingArgs{T,U}}
218222
# Get index of sol.x that interpolates at time t
219223
ind::Int, δt::TT = timeindex(sol, t)
220224
# Evaluate sol.x[ind] at δt

0 commit comments

Comments
 (0)