Skip to content

Commit 1cb6b6a

Browse files
fix: fix incorrect incidence graph after tearing
1 parent e822248 commit 1cb6b6a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/structural_transformation/symbolics_tearing.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,8 +773,14 @@ function codegen_equation!(eg::EquationGenerator,
773773
dx = D(simplify_shifts(fullvars[lv]))
774774

775775
neweq = make_differential_equation(var, dx, eq, total_sub)
776+
# We will add `neweq.lhs` to `total_sub`, so any equation involving it won't be
777+
# incident on it. Remove the edges incident on `iv` from the graph, and add
778+
# the replacement vertices from `ieq` so that the incidence is still correct.
776779
for e in 𝑑neighbors(graph, iv)
777780
e == ieq && continue
781+
for v in 𝑠neighbors(graph, ieq)
782+
add_edge!(graph, e, v)
783+
end
778784
rem_edge!(graph, e, iv)
779785
end
780786

0 commit comments

Comments
 (0)