Skip to content

Commit

Permalink
Update integrator_utils.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas authored Feb 15, 2024
1 parent 97bcd0c commit 3fcbd2a
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/integrators/integrator_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -474,21 +474,24 @@ function handle_tstop!(integrator)
return nothing
end

handle_callback_modifiers!(integrator::ODEIntegrator) = nothing

function reset_fsal!(integrator)
# Under these conditions, these algorithms are not FSAL anymore
integrator.stats.nf += 1

if integrator.sol.prob isa DAEProblem
DiffEqBase.initialize_dae!(integrator)
handle_callback_modifiers!(integrator) # Hook for DDEs to add discontinuities

# Ignore DAEs but they already re-ran initialization
# Mass matrix DAEs do need to reset FSAL if available
if !(integrator.sol.prob isa DAEProblem) && (integrator.cache isa OrdinaryDiffEqMutableCache ||
(integrator.cache isa CompositeCache &&
integrator.cache.caches[1] isa OrdinaryDiffEqMutableCache)
integrator.f(integrator.fsalfirst, integrator.u, integrator.p, integrator.t))
else
if integrator.cache isa OrdinaryDiffEqMutableCache ||
(integrator.cache isa CompositeCache &&
integrator.cache.caches[1] isa OrdinaryDiffEqMutableCache)
integrator.f(integrator.fsalfirst, integrator.u, integrator.p, integrator.t)
else
integrator.fsalfirst = integrator.f(integrator.u, integrator.p, integrator.t)
end
integrator.fsalfirst = integrator.f(integrator.u, integrator.p, integrator.t)
end

# Do not set false here so it can be checked in the algorithm
# integrator.reeval_fsal = false
end
Expand Down

0 comments on commit 3fcbd2a

Please sign in to comment.