Skip to content

Commit

Permalink
refactor: use SciMLBase.get_save_idxs_and_saved_subsystem
Browse files Browse the repository at this point in the history
  • Loading branch information
AayushSabharwal committed Nov 11, 2024
1 parent 6f18857 commit 58e9717
Showing 1 changed file with 1 addition and 23 deletions.
24 changes: 1 addition & 23 deletions lib/OrdinaryDiffEqCore/src/solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -264,29 +264,7 @@ function DiffEqBase.__init(
end

### Algorithm-specific defaults ###
if save_idxs === nothing
saved_subsystem = nothing
else
if !(save_idxs isa AbstractArray) || symbolic_type(save_idxs) != NotSymbolic()
_save_idxs = [save_idxs]
else
_save_idxs = save_idxs
end
saved_subsystem = SciMLBase.SavedSubsystem(prob, parameter_values(prob), _save_idxs)
if saved_subsystem !== nothing
_save_idxs = SciMLBase.get_saved_state_idxs(saved_subsystem)
if isempty(_save_idxs)
# no states to save
save_idxs = Int[]
elseif !(save_idxs isa AbstractArray) || symbolic_type(save_idxs) != NotSymbolic()
# only a single state to save, and save it as a scalar timeseries instead of
# single-element array
save_idxs = only(_save_idxs)
else
save_idxs = _save_idxs
end
end
end
save_idxs, saved_subsystem = SciMLBase.get_save_idxs_and_saved_subsystem(prob, save_idxs)

if save_idxs === nothing
ksEltype = Vector{rateType}
Expand Down

0 comments on commit 58e9717

Please sign in to comment.