@@ -500,6 +500,19 @@ function Base.showerror(io::IO, e::IncompatibleMassMatrixError)
500
500
println (io, TruncatedStacktraces. VERBOSE_MSG)
501
501
end
502
502
503
+ const LATE_BINDING_TSTOPS_ERROR_MESSAGE = """
504
+ This solver does not support providing `tstops` as a function.
505
+ Consider using a different solver or providing `tstops` as an array
506
+ of times.
507
+ """
508
+
509
+ struct LateBindingTstopsNotSupportedError <: Exception end
510
+
511
+ function Base. showerror (io:: IO , e:: LateBindingTstopsNotSupportedError )
512
+ println (io, LATE_BINDING_TSTOPS_ERROR_MESSAGE)
513
+ println (io, TruncatedStacktraces. VERBOSE_MSG)
514
+ end
515
+
503
516
function init_call (_prob, args... ; merge_callbacks = true , kwargshandle = nothing ,
504
517
kwargs... )
505
518
kwargshandle = kwargshandle === nothing ? KeywordArgError : kwargshandle
@@ -555,6 +568,13 @@ function init_up(prob::AbstractDEProblem, sensealg, u0, p, args...; kwargs...)
555
568
p = p, kwargs... )
556
569
init_call (_prob, args... ; kwargs... )
557
570
else
571
+ tstops = get (kwargs, :tstops , nothing )
572
+ if tstops === nothing && has_kwargs (prob)
573
+ tstops = get (prob. kwargs, :tstops , nothing )
574
+ end
575
+ if ! (tstops isa Union{Nothing, AbstractArray, Tuple, Real}) && ! SciMLBase. allows_late_binding_tstops (alg)
576
+ throw (LateBindingTstopsNotSupportedError ())
577
+ end
558
578
_prob = get_concrete_problem (prob, isadaptive (alg); u0 = u0, p = p, kwargs... )
559
579
_alg = prepare_alg (alg, _prob. u0, _prob. p, _prob)
560
580
check_prob_alg_pairing (_prob, alg) # alg for improved inference
@@ -1084,6 +1104,13 @@ function solve_up(prob::Union{AbstractDEProblem, NonlinearProblem}, sensealg, u0
1084
1104
p = p, kwargs... )
1085
1105
solve_call (_prob, args... ; kwargs... )
1086
1106
else
1107
+ tstops = get (kwargs, :tstops , nothing )
1108
+ if tstops === nothing && has_kwargs (prob)
1109
+ tstops = get (prob. kwargs, :tstops , nothing )
1110
+ end
1111
+ if ! (tstops isa Union{Nothing, AbstractArray, Tuple, Real}) && ! SciMLBase. allows_late_binding_tstops (alg)
1112
+ throw (LateBindingTstopsNotSupportedError ())
1113
+ end
1087
1114
_prob = get_concrete_problem (prob, isadaptive (alg); u0 = u0, p = p, kwargs... )
1088
1115
_alg = prepare_alg (alg, _prob. u0, _prob. p, _prob)
1089
1116
check_prob_alg_pairing (_prob, alg) # use alg for improved inference
0 commit comments