Skip to content

Commit

Permalink
Merge pull request #218 from oscardssmith/os/preset-time-allocations-…
Browse files Browse the repository at this point in the history
…redux

fix remaining allocations in `PresetTimeCallback`
  • Loading branch information
ChrisRackauckas authored Apr 29, 2024
2 parents 1a02294 + b311715 commit afff8e3
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/preset_time.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,23 @@ function PresetTimeCallback(tstops, user_affect!;
else
tstops = sort(tstops)
end
condition = function (u, t, integrator)
if hasproperty(integrator, :dt)
insorted(t, tstops) && (integrator.t - integrator.dt) != integrator.t
else
insorted(t, tstops)
condition = let tstops = tstops
function (u, t, integrator)
if hasproperty(integrator, :dt)
insorted(t, tstops) && (integrator.t - integrator.dt) != integrator.t
else
insorted(t, tstops)
end
end
end
elseif tstops isa Number
condition = function (u, t, integrator)
if hasproperty(integrator, :dt)
t == tstops && (integrator.t - integrator.dt) != integrator.t
else
t == tstops
condition = let tstops = tstops
function (u, t, integrator)
if hasproperty(integrator, :dt)
t == tstops && (integrator.t - integrator.dt) != integrator.t
else
t == tstops
end
end
end
else
Expand Down

0 comments on commit afff8e3

Please sign in to comment.