Skip to content

Commit

Permalink
Merge pull request #240 from albertomercurio/master
Browse files Browse the repository at this point in the history
Simplify definition of `affect!` function in `PresetTimeCallback`
  • Loading branch information
ChrisRackauckas authored Nov 17, 2024
2 parents 6cbe81b + 8cf92fb commit 2f4b10f
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/preset_time.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ function PresetTimeCallback(tstops, user_affect!;
end
end

# Call f, update tnext, and make sure we stop at the new tnext
affect! = function (integrator)
user_affect!(integrator)
nothing
end

# Initialization: first call to `f` should be *before* any time steps have been taken:
initialize_preset = function (c, u, t, integrator)
initialize(c, u, t, integrator)
Expand All @@ -64,7 +58,7 @@ function PresetTimeCallback(tstops, user_affect!;
user_affect!(integrator)
end
end
DiscreteCallback(condition, affect!; initialize = initialize_preset, kwargs...)
DiscreteCallback(condition, user_affect!; initialize = initialize_preset, kwargs...)
end

export PresetTimeCallback

0 comments on commit 2f4b10f

Please sign in to comment.