Skip to content

Commit ff1382a

Browse files
refactor: rename SelectedState to SelectedUnknown
1 parent 3150dab commit ff1382a

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

src/structural_transformation/partial_state_selection.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function pss_graph_modia!(structure::SystemStructure, maximal_top_matching, varl
3535
# Find Strongly connected components. Note that after pantelides, we expect
3636
# a balanced system, so a maximal matching should be possible.
3737
var_sccs::Vector{Union{Vector{Int}, Int}} = find_var_sccs(graph, maximal_top_matching)
38-
var_eq_matching = Matching{Union{Unassigned, SelectedState}}(ndsts(graph))
38+
var_eq_matching = Matching{Union{Unassigned, SelectedUnknown}}(ndsts(graph))
3939
for vars in var_sccs
4040
# TODO: We should have a way to not have the scc code look at unassigned vars.
4141
if length(vars) == 1 && maximal_top_matching[vars[1]] === unassigned
@@ -71,7 +71,7 @@ function pss_graph_modia!(structure::SystemStructure, maximal_top_matching, varl
7171
removed_vars = Int[]
7272
for var in old_level_vars
7373
old_assign = var_eq_matching[var]
74-
if isa(old_assign, SelectedState)
74+
if isa(old_assign, SelectedUnknown)
7575
push!(removed_vars, var)
7676
continue
7777
elseif !isa(old_assign, Int) ||
@@ -112,7 +112,7 @@ function pss_graph_modia!(structure::SystemStructure, maximal_top_matching, varl
112112
for var in remaining_vars
113113
if nlsolve_matching[var] === unassigned &&
114114
var_eq_matching[var] === unassigned
115-
var_eq_matching[var] = SelectedState()
115+
var_eq_matching[var] = SelectedUnknown()
116116
end
117117
end
118118
end
@@ -125,7 +125,7 @@ function pss_graph_modia!(structure::SystemStructure, maximal_top_matching, varl
125125
return complete(var_eq_matching)
126126
end
127127

128-
struct SelectedState end
128+
struct SelectedUnknown end
129129
function partial_state_selection_graph!(structure::SystemStructure, var_eq_matching)
130130
@unpack eq_to_diff, var_to_diff, graph, solvable_graph = structure
131131
eq_to_diff = complete(eq_to_diff)
@@ -346,13 +346,13 @@ function tearing_with_dummy_derivatives(structure, dummy_derivatives)
346346
end
347347
var_eq_matching, full_var_eq_matching, var_sccs = tear_graph_modia(structure,
348348
Base.Fix1(isdiffed, (structure, dummy_derivatives)),
349-
Union{Unassigned, SelectedState};
349+
Union{Unassigned, SelectedUnknown};
350350
varfilter = Base.Fix1(getindex, can_eliminate))
351351
for v in eachindex(var_eq_matching)
352352
is_present(structure, v) || continue
353353
dv = var_to_diff[v]
354354
(dv === nothing || !is_some_diff(structure, dummy_derivatives, dv)) && continue
355-
var_eq_matching[v] = SelectedState()
355+
var_eq_matching[v] = SelectedUnknown()
356356
end
357357
return var_eq_matching, full_var_eq_matching, var_sccs, can_eliminate
358358
end

src/structural_transformation/symbolics_tearing.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function substitution_graph(graph, slist, dlist, var_eq_matching)
1818

1919
newmatching = Matching(ns)
2020
for (v, e) in enumerate(var_eq_matching)
21-
(e === unassigned || e === SelectedState()) && continue
21+
(e === unassigned || e === SelectedUnknown()) && continue
2222
iv = vrename[v]
2323
ie = erename[e]
2424
iv == 0 && continue
@@ -228,7 +228,7 @@ function tearing_reassemble(state::TearingState, var_eq_matching;
228228
# A general DAE is in the form of `F(u'(t), u(t), p, t) == 0`. We can
229229
# characterize variables in `u(t)` into two classes: differential variables
230230
# (denoted `v(t)`) and algebraic variables (denoted `z(t)`). Differential
231-
# variables are marked as `SelectedState` and they are differentiated in the
231+
# variables are marked as `SelectedUnknown` and they are differentiated in the
232232
# DAE system, i.e. `v'(t)` are all the variables in `u'(t)` that actually
233233
# appear in the system. Algebraic variables are variables that are not
234234
# differential variables.
@@ -255,7 +255,7 @@ function tearing_reassemble(state::TearingState, var_eq_matching;
255255
for var in 1:length(fullvars)
256256
dv = var_to_diff[var]
257257
dv === nothing && continue
258-
if var_eq_matching[var] !== SelectedState()
258+
if var_eq_matching[var] !== SelectedUnknown()
259259
dd = fullvars[dv]
260260
v_t = setio(diff2term(unwrap(dd)), false, false)
261261
for eq in 𝑑neighbors(graph, dv)
@@ -283,7 +283,7 @@ function tearing_reassemble(state::TearingState, var_eq_matching;
283283
end
284284
end
285285

286-
# `SelectedState` information is no longer needed past here. State selection
286+
# `SelectedUnknown` information is no longer needed past here. State selection
287287
# is done. All non-differentiated variables are algebraic variables, and all
288288
# variables that appear differentiated are differential variables.
289289

@@ -567,10 +567,10 @@ function tearing(state::TearingState; kwargs...)
567567
var_eq_matching′, = tear_graph_modia(state.structure;
568568
varfilter = var -> var in algvars,
569569
eqfilter = eq -> eq in aeqs)
570-
var_eq_matching = Matching{Union{Unassigned, SelectedState}}(var_eq_matching′)
570+
var_eq_matching = Matching{Union{Unassigned, SelectedUnknown}}(var_eq_matching′)
571571
for var in 1:ndsts(graph)
572572
if isdiffvar(state.structure, var)
573-
var_eq_matching[var] = SelectedState()
573+
var_eq_matching[var] = SelectedUnknown()
574574
end
575575
end
576576
var_eq_matching

src/systems/diffeqs/odesystem.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct ODESystem <: AbstractODESystem
3636
Dependent (unknown) variables. Must not contain the independent variable.
3737
3838
N.B.: If `torn_matching !== nothing`, this includes all variables. Actual
39-
ODE unknowns are determined by the `SelectedState()` entries in `torn_matching`.
39+
ODE unknowns are determined by the `SelectedUnknown()` entries in `torn_matching`.
4040
"""
4141
unknowns::Vector
4242
"""Parameter variables. Must not contain the independent variable."""

src/systems/systemstructure.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ function Base.show(io::IO, mime::MIME"text/plain", ms::MatchedSystemStructure)
538538
printstyled(io, "(Unsolvable + Matched)", color = :magenta)
539539
print(io, " | ")
540540
printstyled(io, "", color = :cyan)
541-
printstyled(io, " SelectedState")
541+
printstyled(io, " SelectedUnknown")
542542
end
543543

544544
# TODO: clean up

0 commit comments

Comments
 (0)