Skip to content

Commit

Permalink
feat: support observed for SciMLFunctions containing a SymbolCache
Browse files Browse the repository at this point in the history
  • Loading branch information
AayushSabharwal committed Mar 28, 2024
1 parent e1f5bfc commit e796596
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/scimlfunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4083,13 +4083,18 @@ function SymbolicIndexingInterface.is_observed(fn::AbstractSciMLFunction, sym)
end

function SymbolicIndexingInterface.observed(fn::AbstractSciMLFunction, sym)
if has_observed(fn)
if has_observed(fn) && fn.observed !== DEFAULT_OBSERVED &&
fn.observed !== DEFAULT_OBSERVED_NO_TIME
if hasmethod(fn.observed, Tuple{Any})
return fn.observed(sym)
else
return (args...) -> fn.observed(sym, args...)
end
end
if has_sys(fn) &&
hasmethod(SymbolicIndexingInterface.observed, Tuple{typeof(fn.sys), typeof(sym)})
return SymbolicIndexingInterface.observed(fn.sys, sym)
end
error("SciMLFunction does not have observed")
end

Expand Down

0 comments on commit e796596

Please sign in to comment.