206206# ## Structural and symbolic utilities
207207# ##
208208
209- function find_eq_solvables! (state:: TearingState , ieq, to_rm = Int[], coeffs = nothing ;
209+ function find_eq_solvables! (state:: TearingState , ieq:: Int , to_rm = Int[], coeffs = nothing ;
210210 may_be_zero = false ,
211- allow_symbolic = false , allow_parameter = true ,
211+ allow_symbolic = false , allow_parameter = true , allow_algebraic = true ,
212212 conservative = false ,
213213 kwargs... )
214214 fullvars = state. fullvars
@@ -218,6 +218,7 @@ function find_eq_solvables!(state::TearingState, ieq, to_rm = Int[], coeffs = no
218218 all_int_vars = true
219219 coeffs === nothing || empty! (coeffs)
220220 empty! (to_rm)
221+ varsbuf = Set ()
221222 for j in 𝑠neighbors (graph, ieq)
222223 var = fullvars[j]
223224 isirreducible (var) && (all_int_vars = false ; continue )
@@ -229,13 +230,18 @@ function find_eq_solvables!(state::TearingState, ieq, to_rm = Int[], coeffs = no
229230 if a isa Symbolic
230231 all_int_vars = false
231232 if ! allow_symbolic
232- if allow_parameter
233- all (
234- x -> ModelingToolkit. isparameter (x) || ModelingToolkit. isconstant (x),
235- vars (a)) || continue
236- else
233+ allow_parameter || allow_algebraic || continue
234+ empty! (varsbuf)
235+ vars! (varsbuf, a)
236+ denomvars = Int[]
237+ for v in varsbuf
238+ idx = findfirst (isequal (v), fullvars)
239+ idx === nothing || push! (denomvars, idx)
240+ end
241+ if ! allow_algebraic && ! isempty (denomvars)
237242 continue
238243 end
244+ state. structure. denominators[ieq => j] = denomvars
239245 end
240246 add_edge! (solvable_graph, ieq, j)
241247 continue
0 commit comments