@@ -44,6 +44,13 @@ function as_diffeq_array(vt::Vector{VectorTemplate}, t)
4444 return DiffEqArray (typeof (TupleOfArraysWrapper (vt))[], t, (1 , 1 ))
4545end
4646
47+ function is_empty_indp (indp)
48+ isempty (variable_symbols (indp)) && isempty (parameter_symbols (indp)) &&
49+ isempty (independent_variable_symbols (indp))
50+ end
51+
52+ # Everything from this point on is public API
53+
4754"""
4855 $(TYPEDSIGNATURES)
4956
@@ -104,6 +111,12 @@ function SavedSubsystem(indp, pobj, saved_idxs)
104111 return nothing
105112 end
106113
114+ # this is required because problems with no system have an empty `SymbolCache`
115+ # as their symbolic container.
116+ if is_empty_indp (indp)
117+ return nothing
118+ end
119+
107120 # array state symbolics must be scalarized
108121 saved_idxs = collect (Iterators. flatten (map (saved_idxs) do sym
109122 if symbolic_type (sym) == NotSymbolic ()
@@ -226,6 +239,20 @@ function SavedSubsystem(indp, pobj, saved_idxs)
226239 timeseries_partition_templates, indexes_in_partition, ts_idx_to_count)
227240end
228241
242+ """
243+ $(TYPEDSIGNATURES)
244+
245+ Given a `SavedSubsystem`, return the subset of state indexes of the original system that are
246+ saved, in the order they are saved.
247+ """
248+ function get_saved_state_idxs (ss:: SavedSubsystem )
249+ idxs = Vector {valtype(ss.state_map)} (undef, length (ss. state_map))
250+ for (k, v) in ss. state_map
251+ idxs[v] = k
252+ end
253+ return idxs
254+ end
255+
229256"""
230257 $(TYPEDEF)
231258
0 commit comments