Skip to content

Commit cb27db3

Browse files
Merge pull request #491 from SciML/kg/cbfix3
Adds is_integrator_adaptive to integrator interface
2 parents a69144b + d930620 commit cb27db3

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/callbacks.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ end
765765

766766
function apply_callback!(integrator,callback::Union{ContinuousCallback,VectorContinuousCallback},cb_time,prev_sign,event_idx)
767767

768-
if integrator.opts.adaptive
768+
if isadaptive(integrator)
769769
set_proposed_dt!(integrator, max(nextfloat(integrator.opts.dtmin), callback.dtrelax * integrator.dt))
770770
end
771771

src/integrator_interface.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,3 +574,11 @@ function step!(integ::DEIntegrator, dt::Real, stop_at_tdt = false)
574574
end
575575

576576
has_destats(i::DEIntegrator) = false
577+
578+
"""
579+
is_integrator_adaptive(i::DEIntegrator)
580+
581+
Checks if the integrator is adaptive
582+
"""
583+
isadaptive(integrator::DEIntegrator) =
584+
isdefined(integrator.opts, :adaptive) ? integrator.opts.adaptive : false

0 commit comments

Comments
 (0)