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

Improve caching and dispatch of LinearizingSavingCallback #195

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Sundials = "c3572dad-4567-51f8-b174-8c6c989267f4"

[extensions]
DiffEqCallbacksSundialsExt = "Sundials"

[compat]
Aqua = "0.8"
DataInterpolations = "4"
Expand Down
12 changes: 12 additions & 0 deletions ext/DiffEqCallbacksSundialsExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module DiffEqCallbacksSundialsExt

using Sundials: NVector, IDA
import DiffEqCallbacks: solver_state_alloc, solver_state_type

# Allocator; `U` is typically something like `Vector{Float64}`
solver_state_alloc(solver::IDA, U::DataType, num_us::Int) = () -> NVector(U(undef, num_us))

Check warning on line 7 in ext/DiffEqCallbacksSundialsExt.jl

View check run for this annotation

Codecov / codecov/patch

ext/DiffEqCallbacksSundialsExt.jl#L7

Added line #L7 was not covered by tests

# Type of `solver_state_alloc`, which is just `NVector`
solver_state_type(solver::IDA, U::DataType) = NVector

Check warning on line 10 in ext/DiffEqCallbacksSundialsExt.jl

View check run for this annotation

Codecov / codecov/patch

ext/DiffEqCallbacksSundialsExt.jl#L10

Added line #L10 was not covered by tests

end # module
2 changes: 1 addition & 1 deletion src/domain.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function affect!(integrator, f::AbstractDomainAffect{T, S, uType}) where {T, S,
if dtcache == dt
if integrator.opts.verbose
@warn("Could not restrict values to domain. Iteration was canceled since ",
"proposed time step dt = ", dt," could not be reduced.")
"proposed time step dt = ", dt, " could not be reduced.")
end
break
end
Expand Down
Loading
Loading