Skip to content

Commit f4a9d13

Browse files
committed
up
1 parent a901d09 commit f4a9d13

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed

src/systems/discrete_system/implicit_discrete_system.jl

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,6 @@ function ImplicitDiscreteSystem(eqs, iv; kwargs...)
238238
return ImplicitDiscreteSystem(eqs, iv,
239239
collect(allunknowns), collect(new_ps); kwargs...)
240240
end
241-
# basically at every timestep it should build a nonlinear solve
242-
# Previous timesteps should be treated as parameters? is this right?
243241

244242
function flatten(sys::ImplicitDiscreteSystem, noeqs = false)
245243
systems = get_systems(sys)
@@ -263,25 +261,10 @@ end
263261

264262
function generate_function(
265263
sys::ImplicitDiscreteSystem, dvs = unknowns(sys), ps = parameters(sys); wrap_code = identity, kwargs...)
266-
if !iscomplete(sys)
267-
error("A completed system is required. Call `complete` or `structural_simplify` on the system.")
268-
end
269-
p = (reorder_parameters(sys, unwrap.(ps))..., cachesyms...)
270-
isscalar = !(exprs isa AbstractArray)
271-
pre, sol_states = get_substitutions_and_solved_unknowns(sys, isscalar ? [exprs] : exprs)
272-
if postprocess_fbody === nothing
273-
postprocess_fbody = pre
274-
end
275-
if states === nothing
276-
states = sol_states
277-
end
278264
exprs = [eq.lhs - eq.rhs for eq in equations(sys)]
279-
u = map(Shift(iv, -1), dvs)
280-
u_next = dvs
281-
282-
wrap_code = wrap_code .∘ wrap_array_vars(sys, exprs) .∘ wrap_parameter_dependencies(sys, false)
283-
284-
build_function(exprs, u_next, u, p..., get_iv(sys))
265+
u = dvs
266+
u_next = map(Shift(iv, 1), u)
267+
generate_custom_function(sys, exprs, u_next, u, ps..., get_iv(sys); kwargs...)
285268
end
286269

287270
function shift_u0map_forward(sys::ImplicitDiscreteSystem, u0map, defs)

0 commit comments

Comments
 (0)