Skip to content

Commit 631c447

Browse files
feat: add denominators field to SystemStructure
1 parent cff3906 commit 631c447

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/systems/systemstructure.jl

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,16 @@ Base.@kwdef mutable struct SystemStructure
149149
# or as `torn` to assert that tearing has run.
150150
"""Graph that connects equations to variables that appear in them."""
151151
graph::BipartiteGraph{Int, Nothing}
152-
"""Graph that connects equations to the variable they will be solved for during simplification."""
152+
"""
153+
Graph that connects equations to the variables that they can be analytically solved
154+
for.
155+
"""
153156
solvable_graph::Union{BipartiteGraph{Int, Nothing}, Nothing}
157+
"""
158+
Dict mapping `eq => var` edges in `solvable_graph` to the variables that occur in the
159+
denominator when `eq` is analytically solved for `var`.
160+
"""
161+
denominators::Dict{Pair{Int, Int}, Vector{Int}}
154162
"""Variable types (brownian, variable, parameter) in the system."""
155163
var_types::Union{Vector{VariableType}, Nothing}
156164
"""Whether the system is discrete."""
@@ -160,7 +168,7 @@ end
160168
function Base.copy(structure::SystemStructure)
161169
var_types = structure.var_types === nothing ? nothing : copy(structure.var_types)
162170
SystemStructure(copy(structure.var_to_diff), copy(structure.eq_to_diff),
163-
copy(structure.graph), copy(structure.solvable_graph),
171+
copy(structure.graph), copy(structure.solvable_graph), copy(structure.denominators),
164172
var_types, structure.only_discrete)
165173
end
166174

@@ -438,7 +446,7 @@ function TearingState(sys; quick_cancel = false, check = true)
438446

439447
ts = TearingState(sys, fullvars,
440448
SystemStructure(complete(var_to_diff), complete(eq_to_diff),
441-
complete(graph), nothing, var_types, sys isa AbstractDiscreteSystem),
449+
complete(graph), nothing, Dict(), var_types, sys isa AbstractDiscreteSystem),
442450
Any[])
443451
if sys isa DiscreteSystem
444452
ts = shift_discrete_system(ts)

0 commit comments

Comments
 (0)