From 58e9717e6cce8085e1664bc510e946923c655b63 Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Wed, 6 Nov 2024 17:01:54 +0530 Subject: [PATCH] refactor: use `SciMLBase.get_save_idxs_and_saved_subsystem` --- lib/OrdinaryDiffEqCore/src/solve.jl | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/lib/OrdinaryDiffEqCore/src/solve.jl b/lib/OrdinaryDiffEqCore/src/solve.jl index ef77e4c6b4..f2c9e2e087 100644 --- a/lib/OrdinaryDiffEqCore/src/solve.jl +++ b/lib/OrdinaryDiffEqCore/src/solve.jl @@ -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}