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

feat: add discrete saving functionality #1019

Closed
Closed
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
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3"
StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
SymbolicIndexingInterface = "2efcf032-c050-4f8e-a9bb-153293bab1f5"
Tricks = "410a4b4d-49e4-4fbc-ab6d-cb71b17b3775"
TruncatedStacktraces = "781d530d-4396-4725-bb49-402e4bee1e77"

Expand Down
2 changes: 2 additions & 0 deletions src/DiffEqBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ PrecompileTools.@recompile_invalidations begin

import SciMLBase: AbstractDiffEqLinearOperator # deprecation path

import SymbolicIndexingInterface: parameter_values, current_time

import Tricks
end

Expand Down
5 changes: 5 additions & 0 deletions src/callbacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,8 @@
callback.affect_neg!(integrator, event_idx) : callback.affect_neg!(integrator)
end
end
SciMLBase.save_discrete_parameters_after_callback(

Check warning on line 589 in src/callbacks.jl

View check run for this annotation

Codecov / codecov/patch

src/callbacks.jl#L589

Added line #L589 was not covered by tests
integrator.sol, parameter_values(integrator), current_time(integrator))

if integrator.u_modified
reeval_internals_due_to_modification!(integrator)
Expand All @@ -611,6 +613,9 @@
end
integrator.u_modified = true
callback.affect!(integrator)

SciMLBase.save_discrete_parameters_after_callback(

Check warning on line 617 in src/callbacks.jl

View check run for this annotation

Codecov / codecov/patch

src/callbacks.jl#L617

Added line #L617 was not covered by tests
integrator.sol, parameter_values(integrator), current_time(integrator))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so it would interpolate separately?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interpolation is independent of this. I haven't gotten around to it yet

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interpolation is implemented in SciML/SciMLBase.jl#645

if integrator.u_modified
reeval_internals_due_to_modification!(integrator, false) # continuous_modification=false
end
Expand Down
7 changes: 5 additions & 2 deletions test/downstream/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ MultiScaleArrays = "f9640e96-87f6-5992-9c3b-0743c6a49ffa"
NonlinearSolve = "8913a72c-1f9b-4ce2-8d82-65094dcecaec"
ODEProblemLibrary = "fdc4e326-1af4-4b90-96e7-779fcce2daa5"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
SciMLSensitivity = "1ed8b502-d754-442c-8d5d-10ac956f44a1"
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
SDEProblemLibrary = "c72e72a9-a271-4b2b-8966-303ed956772e"
Sundials = "c3572dad-4567-51f8-b174-8c6c989267f4"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
SciMLSensitivity = "1ed8b502-d754-442c-8d5d-10ac956f44a1"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
SteadyStateDiffEq = "9672c7b4-1e72-59bd-8a11-6ac3964bc41f"
StochasticDiffEq = "789caeaf-c7a9-5a7d-9973-96adeb23e2a0"
Sundials = "c3572dad-4567-51f8-b174-8c6c989267f4"
SymbolicIndexingInterface = "2efcf032-c050-4f8e-a9bb-153293bab1f5"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

Expand Down
22 changes: 11 additions & 11 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ end

if !is_APPVEYOR && GROUP == "Downstream"
activate_downstream_env()
@time @safetestset "Kwarg Warnings" include("downstream/kwarg_warn.jl")
@time @safetestset "Solve Error Handling" include("downstream/solve_error_handling.jl")
@time @safetestset "Null DE Handling" include("downstream/null_de.jl")
@time @safetestset "StaticArrays + AD" include("downstream/static_arrays_ad.jl")
@time @safetestset "Unitful" include("downstream/unitful.jl")
# @time @safetestset "Kwarg Warnings" include("downstream/kwarg_warn.jl")
# @time @safetestset "Solve Error Handling" include("downstream/solve_error_handling.jl")
# @time @safetestset "Null DE Handling" include("downstream/null_de.jl")
# @time @safetestset "StaticArrays + AD" include("downstream/static_arrays_ad.jl")
# @time @safetestset "Unitful" include("downstream/unitful.jl")
@time @safetestset "Dual Detection Solution" include("downstream/dual_detection_solution.jl")
@time @safetestset "Null Parameters" include("downstream/null_params_test.jl")
@time @safetestset "Ensemble Simulations" include("downstream/ensemble.jl")
Expand All @@ -60,12 +60,12 @@ end

if !is_APPVEYOR && GROUP == "Downstream2"
activate_downstream_env()
@time @safetestset "Prob Kwargs" include("downstream/prob_kwargs.jl")
@time @safetestset "Unwrapping" include("downstream/unwrapping.jl")
@time @safetestset "Callback BigFloats" include("downstream/bigfloat_events.jl")
@time @safetestset "DE stats" include("downstream/stats_tests.jl")
@time @safetestset "Ensemble AD Tests" include("downstream/ensemble_ad.jl")
@time @safetestset "Community Callback Tests" include("downstream/community_callback_tests.jl")
# @time @safetestset "Prob Kwargs" include("downstream/prob_kwargs.jl")
# @time @safetestset "Unwrapping" include("downstream/unwrapping.jl")
# @time @safetestset "Callback BigFloats" include("downstream/bigfloat_events.jl")
# @time @safetestset "DE stats" include("downstream/stats_tests.jl")
# @time @safetestset "Ensemble AD Tests" include("downstream/ensemble_ad.jl")
# @time @safetestset "Community Callback Tests" include("downstream/community_callback_tests.jl")
@time @safetestset "AD via ode with complex numbers" include("downstream/complex_number_ad.jl")
@time @testset "Distributed Ensemble Tests" include("downstream/distributed_ensemble.jl")
end
Expand Down
Loading