Skip to content

Commit 7fb06a6

Browse files
feat: implement SciMLBase.detect_cycles
1 parent 2db7f5f commit 7fb06a6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/systems/problem_utils.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -897,6 +897,13 @@ function Base.showerror(io::IO, e::InvalidKeyError)
897897
println(io, "pmap: $(join(e.params, ", "))")
898898
end
899899

900+
function SciMLBase.detect_cycles(sys::AbstractSystem, varmap::Dict{Any, Any}, vars)
901+
varmap = AnyDict(unwrap(k) => unwrap(v) for (k, v) in varmap)
902+
vars = map(unwrap, vars)
903+
cycles = check_substitution_cycles(varmap, vars)
904+
return !isempty(cycles)
905+
end
906+
900907
##############
901908
# Legacy functions for backward compatibility
902909
##############

0 commit comments

Comments
 (0)