Skip to content

Commit 2674a15

Browse files
committed
Fix some confusion
1 parent b65d759 commit 2674a15

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

src/structural_transformation/partial_state_selection.jl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,12 +291,13 @@ function dummy_derivative_graph!(structure::SystemStructure, var_eq_matching, ja
291291
end
292292
end
293293

294+
is_not_present = v -> isempty(𝑑neighbors(graph, v)) &&
295+
(ag === nothing || (haskey(ag, v) && !(v in irreducible_set)))
294296
# Derivatives that are either in the dummy derivatives set or ended up not
295297
# participating in the system at all are not considered differential
296298
is_some_diff = let dummy_derivatives_set = dummy_derivatives_set
297299
v -> !(v in dummy_derivatives_set) &&
298-
!(var_to_diff[v] === nothing && isempty(𝑑neighbors(graph, v)) &&
299-
(ag === nothing || !(v in irreducible_set)))
300+
!(var_to_diff[v] === nothing && is_not_present(v))
300301
end
301302

302303
# We don't want tearing to give us `y_t ~ D(y)`, so we skip equations with
@@ -324,9 +325,7 @@ function dummy_derivative_graph!(structure::SystemStructure, var_eq_matching, ja
324325
Union{Unassigned, SelectedState};
325326
varfilter = can_eliminate)
326327
for v in eachindex(var_eq_matching)
327-
if ag !== nothing && haskey(ag, v) && iszero(ag[v][1])
328-
continue
329-
end
328+
is_not_present(v) && continue
330329
dv = var_to_diff[v]
331330
(dv === nothing || !is_some_diff(dv)) && continue
332331
var_eq_matching[v] = SelectedState()

src/structural_transformation/symbolics_tearing.jl

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ function tearing_reassemble(state::TearingState, var_eq_matching, ag = nothing;
319319
var -> diff_to_var[var] !== nothing
320320
end
321321

322-
retear = BitSet()
322+
#retear = BitSet()
323323
# There are three cases where we want to generate new variables to convert
324324
# the system into first order (semi-implicit) ODEs.
325325
#
@@ -480,27 +480,27 @@ function tearing_reassemble(state::TearingState, var_eq_matching, ag = nothing;
480480
# This removes the assignment of the variable `idx`, so we
481481
# should consider assign them again later.
482482
var_eq_matching[x_t_idx] = original_assigned_eq
483-
if !isempty(𝑑neighbors(graph, idx))
484-
push!(retear, idx)
485-
end
483+
#if !isempty(𝑑neighbors(graph, idx))
484+
# push!(retear, idx)
485+
#end
486486
end
487487
end
488488
end
489489
empty!(subinfo)
490490
empty!(subs)
491491
end
492492

493-
ict = IncrementalCycleTracker(DiCMOBiGraph{true}(graph, var_eq_matching); dir = :in)
494-
for idx in retear
495-
for alternative_eq in 𝑑neighbors(solvable_graph, idx)
496-
# skip actually differentiated variables
497-
any(𝑠neighbors(graph, alternative_eq)) do alternative_v
498-
((vv = diff_to_var[alternative_v]) !== nothing &&
499-
var_eq_matching[vv] === SelectedState())
500-
end && continue
501-
try_assign_eq!(ict, idx, alternative_eq) && break
502-
end
503-
end
493+
#ict = IncrementalCycleTracker(DiCMOBiGraph{true}(graph, var_eq_matching); dir = :in)
494+
#for idx in retear
495+
# for alternative_eq in 𝑑neighbors(solvable_graph, idx)
496+
# # skip actually differentiated variables
497+
# any(𝑠neighbors(graph, alternative_eq)) do alternative_v
498+
# ((vv = diff_to_var[alternative_v]) !== nothing &&
499+
# var_eq_matching[vv] === SelectedState())
500+
# end && continue
501+
# try_assign_eq!(ict, idx, alternative_eq) && break
502+
# end
503+
#end
504504

505505
# Will reorder equations and states to be:
506506
# [diffeqs; ...]

0 commit comments

Comments
 (0)