Skip to content

Commit

Permalink
fix: handle problems with no system in SavedSubsystem constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
AayushSabharwal committed Oct 28, 2024
1 parent bf913e7 commit 7c62e3a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/solutions/save_idxs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ function as_diffeq_array(vt::Vector{VectorTemplate}, t)
return DiffEqArray(typeof(TupleOfArraysWrapper(vt))[], t, (1, 1))
end

function is_empty_indp(indp)
isempty(variable_symbols(indp)) && isempty(parameter_symbols(indp)) &&
isempty(independent_variable_symbols(indp))
end

"""
$(TYPEDSIGNATURES)
Expand Down Expand Up @@ -104,6 +109,12 @@ function SavedSubsystem(indp, pobj, saved_idxs)
return nothing
end

# this is required because problems with no system have an empty `SymbolCache`
# as their symbolic container.
if is_empty_indp(indp)
return nothing
end

# array state symbolics must be scalarized
saved_idxs = collect(Iterators.flatten(map(saved_idxs) do sym
if symbolic_type(sym) == NotSymbolic()
Expand Down

0 comments on commit 7c62e3a

Please sign in to comment.