206
206
# ## Structural and symbolic utilities
207
207
# ##
208
208
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 ;
210
210
may_be_zero = false ,
211
- allow_symbolic = false , allow_parameter = true ,
211
+ allow_symbolic = false , allow_parameter = true , allow_algebraic = true ,
212
212
conservative = false ,
213
213
kwargs... )
214
214
fullvars = state. fullvars
@@ -218,6 +218,7 @@ function find_eq_solvables!(state::TearingState, ieq, to_rm = Int[], coeffs = no
218
218
all_int_vars = true
219
219
coeffs === nothing || empty! (coeffs)
220
220
empty! (to_rm)
221
+ varsbuf = Set ()
221
222
for j in 𝑠neighbors (graph, ieq)
222
223
var = fullvars[j]
223
224
isirreducible (var) && (all_int_vars = false ; continue )
@@ -229,13 +230,18 @@ function find_eq_solvables!(state::TearingState, ieq, to_rm = Int[], coeffs = no
229
230
if a isa Symbolic
230
231
all_int_vars = false
231
232
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)
237
242
continue
238
243
end
244
+ state. structure. denominators[ieq => j] = denomvars
239
245
end
240
246
add_edge! (solvable_graph, ieq, j)
241
247
continue
0 commit comments