Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix: allow presettime callback on integrators without a dt #213

Merged
merged 2 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ NonlinearSolve = "3.7.2"
ODEProblemLibrary = "0.1.5"
OrdinaryDiffEq = "6.68"
Parameters = "0.12"
QuadGK = "2.4"
QuadGK = "2.9"
RecipesBase = "1.3.4"
RecursiveArrayTools = "3.9"
SciMLBase = "2.26"
Expand Down
12 changes: 10 additions & 2 deletions src/preset_time.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,19 @@
tstops = sort(tstops)
end
condition = function (u, t, integrator)
insorted(t, tstops) && (integrator.t - integrator.dt) != integrator.t
if hasproperty(integrator, :dt)
insorted(t, tstops) && (integrator.t - integrator.dt) != integrator.t
else
insorted(t, tstops)

Check warning on line 37 in src/preset_time.jl

View check run for this annotation

Codecov / codecov/patch

src/preset_time.jl#L37

Added line #L37 was not covered by tests
end
end
elseif tstops isa Number
condition = function (u, t, integrator)
t == tstops && (integrator.t - integrator.dt) != integrator.t
if hasproperty(integrator, :dt)
t == tstops && (integrator.t - integrator.dt) != integrator.t
else
t == tstops

Check warning on line 45 in src/preset_time.jl

View check run for this annotation

Codecov / codecov/patch

src/preset_time.jl#L45

Added line #L45 was not covered by tests
end
end
else
throw(ArgumentError("tstops must either be a number or a Vector. Was $tstops"))
Expand Down
Loading