Skip to content

Commit

Permalink
feat: add new all-symbols methods from SII
Browse files Browse the repository at this point in the history
  • Loading branch information
AayushSabharwal committed Dec 27, 2023
1 parent f61f83f commit 5cae853
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ SimpleNonlinearSolve = "0.1.0, 1"
SparseArrays = "1"
SpecialFunctions = "0.7, 0.8, 0.9, 0.10, 1.0, 2"
StaticArrays = "0.10, 0.11, 0.12, 1.0"
SymbolicIndexingInterface = "0.3"
SymbolicIndexingInterface = "0.3.1"
SymbolicUtils = "1.0"
Symbolics = "5.7"
URIs = "1"
Expand Down
14 changes: 14 additions & 0 deletions src/systems/abstractsystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,20 @@ SymbolicIndexingInterface.is_time_dependent(::AbstractTimeIndependentSystem) = f

SymbolicIndexingInterface.constant_structure(::AbstractSystem) = true

function SymbolicIndexingInterface.all_variable_symbols(sys::AbstractSystem)
syms = variable_symbols(sys)
obs = getproperty.(observed(sys), :lhs)
return isempty(obs) ? syms : vcat(syms, obs)

Check warning on line 292 in src/systems/abstractsystem.jl

View check run for this annotation

Codecov / codecov/patch

src/systems/abstractsystem.jl#L289-L292

Added lines #L289 - L292 were not covered by tests
end

function SymbolicIndexingInterface.all_symbols(sys::AbstractSystem)
syms = all_variable_symbols(sys)
for other in (parameter_symbols(sys), independent_variable_symbols(sys))
isempty(other) || (syms = vcat(syms, other))
end
return syms

Check warning on line 300 in src/systems/abstractsystem.jl

View check run for this annotation

Codecov / codecov/patch

src/systems/abstractsystem.jl#L295-L300

Added lines #L295 - L300 were not covered by tests
end

iscomplete(sys::AbstractSystem) = isdefined(sys, :complete) && getfield(sys, :complete)

"""
Expand Down

0 comments on commit 5cae853

Please sign in to comment.