Skip to content

Commit

Permalink
feat: add discrete saving functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
AayushSabharwal committed Mar 6, 2024
1 parent fa65baa commit 1b090e7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,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 @@ -100,6 +100,8 @@ PrecompileTools.@recompile_invalidations begin

import SciMLBase: AbstractDiffEqLinearOperator # deprecation path

import SymbolicIndexingInterface: parameter_values, current_time

import Tricks
end

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

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

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

SciMLBase.save_discrete_parameters_after_callback(integrator.sol, parameter_values(integrator), current_time(integrator))

Check warning on line 616 in src/callbacks.jl

View check run for this annotation

Codecov / codecov/patch

src/callbacks.jl#L616

Added line #L616 was not covered by tests
if integrator.u_modified
reeval_internals_due_to_modification!(integrator, false) # continuous_modification=false
end
Expand Down

0 comments on commit 1b090e7

Please sign in to comment.