Skip to content

Commit 2d9271d

Browse files
committed
Check the existence of solvable_graph before pushing
1 parent f6452d6 commit 2d9271d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/structural_transformation/symbolics_tearing.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function var_derivative!(ts::TearingState{ODESystem}, v::Int)
3333
sys = ts.sys
3434
s = ts.structure
3535
D = Differential(get_iv(sys))
36-
add_vertex!(s.solvable_graph, DST)
36+
s.solvable_graph === nothing || add_vertex!(s.solvable_graph, DST)
3737
push!(ts.fullvars, D(ts.fullvars[v]))
3838
end
3939

@@ -43,7 +43,7 @@ function eq_derivative!(ts::TearingState{ODESystem}, ieq::Int)
4343
D = Differential(get_iv(sys))
4444
eq = equations(ts)[ieq]
4545
eq = ModelingToolkit.expand_derivatives(0 ~ D(eq.rhs - eq.lhs))
46-
add_vertex!(s.solvable_graph, SRC)
46+
s.solvable_graph === nothing || add_vertex!(s.solvable_graph, SRC)
4747
push!(equations(ts), eq)
4848
# Analyze the new equation and update the graph/solvable_graph
4949
# First, copy the previous incidence and add the derivative terms.
@@ -54,7 +54,7 @@ function eq_derivative!(ts::TearingState{ODESystem}, ieq::Int)
5454
add_edge!(s.graph, eq_diff, var)
5555
add_edge!(s.graph, eq_diff, s.var_to_diff[var])
5656
end
57-
find_eq_solvables!(ts, eq_diff; may_be_zero=true, allow_symbolic=true)
57+
s.solvable_graph === nothing || find_eq_solvables!(ts, eq_diff; may_be_zero=true, allow_symbolic=true)
5858
end
5959

6060
function tearing_sub(expr, dict, s)

0 commit comments

Comments
 (0)