Skip to content

Commit 4475a5a

Browse files
committed
up
1 parent dd71d23 commit 4475a5a

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

src/structural_transformation/symbolics_tearing.jl

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -237,18 +237,6 @@ function check_diff_graph(var_to_diff, fullvars)
237237
end
238238
=#
239239

240-
function state_selection()
241-
242-
end
243-
244-
function create_new_deriv_variables()
245-
246-
end
247-
248-
function solve_solvable_equations()
249-
250-
end
251-
252240
function tearing_reassemble(state::TearingState, var_eq_matching,
253241
full_var_eq_matching = nothing; simplify = false, mm = nothing, cse_hack = true, array_hack = true)
254242
@unpack fullvars, sys, structure = state
@@ -323,7 +311,7 @@ function tearing_reassemble(state::TearingState, var_eq_matching,
323311
diff_to_var[dv] = nothing
324312
end
325313
end
326-
@show neweqs
314+
@show var_eq_matching
327315

328316
println("Post state selection.")
329317

@@ -337,14 +325,16 @@ function tearing_reassemble(state::TearingState, var_eq_matching,
337325
end
338326
idx_to_lowest_shift = Dict{Int, Int}(var => 0 for var in 1:length(fullvars))
339327
for (i,var) in enumerate(fullvars)
340-
key = operation(var) isa Shift ? only(arguments(var)) : var
328+
key = (operation(var) isa Shift) ? only(arguments(var)) : var
341329
idx_to_lowest_shift[i] = get(lowest_shift, key, 0)
342330
end
343331

344332
# if var is like D(x)
345333
isdervar = let diff_to_var = diff_to_var
346334
var -> diff_to_var[var] !== nothing
347335
end
336+
# For discrete variables, we want the substitution to turn
337+
# Shift(t, k)(x(t)) => x_t-k(t)
348338
var_order = let diff_to_var = diff_to_var
349339
dv -> begin
350340
order = 0
@@ -358,7 +348,6 @@ function tearing_reassemble(state::TearingState, var_eq_matching,
358348
end
359349
lower_name = is_only_discrete(state.structure) ? lower_varname_withshift : lower_varname_with_unit
360350

361-
#retear = BitSet()
362351
# There are three cases where we want to generate new variables to convert
363352
# the system into first order (semi-implicit) ODEs.
364353
#

0 commit comments

Comments
 (0)