Skip to content

Commit 00c1482

Browse files
add_tstop! error
1 parent 8af219c commit 00c1482

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/integrators/integrator_interface.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ u_cache(integrator::ODEIntegrator) = u_cache(integrator.cache)
4040
du_cache(integrator::ODEIntegrator)= du_cache(integrator.cache)
4141
full_cache(integrator::ODEIntegrator) = chain(user_cache(integrator),u_cache(integrator),du_cache(integrator.cache))
4242
default_non_user_cache(integrator::ODEIntegrator) = chain(u_cache(integrator),du_cache(integrator.cache))
43-
@inline add_tstop!(integrator::ODEIntegrator,t) = push!(integrator.opts.tstops,t)
43+
@inline function add_tstop!(integrator::ODEIntegrator,t)
44+
t < integrator.t && error("Tried to add a tstop that is behind the current time. This is strictly forbidden")
45+
push!(integrator.opts.tstops,t)
46+
end
4447
user_cache(cache::OrdinaryDiffEqCache) = (cache.u,cache.uprev,cache.tmp)
4548

4649
resize!(integrator::ODEIntegrator,i::Int) = resize!(integrator,integrator.cache,i)

0 commit comments

Comments
 (0)