Skip to content

Commit 4142923

Browse files
committed
up
1 parent d9a760d commit 4142923

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/systems/discrete_system/implicit_discrete_system.jl

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ struct ImplicitDiscreteSystem <: AbstractTimeDependentSystem
2323
structurally identical.
2424
"""
2525
tag::UInt
26-
"""The differential equations defining the discrete system."""
26+
"""The difference equations defining the discrete system."""
2727
eqs::Vector{Equation}
2828
"""Independent variable."""
2929
iv::BasicSymbolic{Real}
@@ -48,10 +48,10 @@ struct ImplicitDiscreteSystem <: AbstractTimeDependentSystem
4848
"""
4949
The internal systems. These are required to have unique names.
5050
"""
51-
systems::Vector{DiscreteSystem}
51+
systems::Vector{ImplicitDiscreteSystem}
5252
"""
5353
The default values to use when initial conditions and/or
54-
parameters are not supplied in `DiscreteProblem`.
54+
parameters are not supplied in `ImplicitDiscreteProblem`.
5555
"""
5656
defaults::Dict
5757
"""
@@ -136,11 +136,11 @@ end
136136

137137
"""
138138
$(TYPEDSIGNATURES)
139-
Constructs a DiscreteSystem.
139+
Constructs a ImplicitDiscreteSystem.
140140
"""
141141
function ImplicitDiscreteSystem(eqs::AbstractVector{<:Equation}, iv, dvs, ps;
142142
observed = Num[],
143-
systems = DiscreteSystem[],
143+
systems = ImplicitDiscreteSystem[],
144144
tspan = nothing,
145145
name = nothing,
146146
description = "",
@@ -162,12 +162,12 @@ function ImplicitDiscreteSystem(eqs::AbstractVector{<:Equation}, iv, dvs, ps;
162162
dvs′ = value.(dvs)
163163
ps′ = value.(ps)
164164
if any(hasderiv, eqs) || any(hashold, eqs) || any(hassample, eqs) || any(hasdiff, eqs)
165-
error("Equations in a `DiscreteSystem` can only have `Shift` operators.")
165+
error("Equations in a `ImplicitDiscreteSystem` can only have `Shift` operators.")
166166
end
167167
if !(isempty(default_u0) && isempty(default_p))
168168
Base.depwarn(
169169
"`default_u0` and `default_p` are deprecated. Use `defaults` instead.",
170-
:DiscreteSystem, force = true)
170+
:ImplicitDiscreteSystem, force = true)
171171
end
172172

173173
defaults = Dict{Any, Any}(todict(defaults))
@@ -190,7 +190,7 @@ function ImplicitDiscreteSystem(eqs::AbstractVector{<:Equation}, iv, dvs, ps;
190190
if length(unique(sysnames)) != length(sysnames)
191191
throw(ArgumentError("System names must be unique."))
192192
end
193-
DiscreteSystem(Threads.atomic_add!(SYSTEM_COUNT, UInt(1)),
193+
ImplicitDiscreteSystem(Threads.atomic_add!(SYSTEM_COUNT, UInt(1)),
194194
eqs, iv′, dvs′, ps′, tspan, var_to_name, observed, name, description, systems,
195195
defaults, guesses, initializesystem, initialization_eqs, preface, connector_type,
196196
parameter_dependencies, metadata, gui_metadata, kwargs...)
@@ -206,7 +206,7 @@ function ImplicitDiscreteSystem(eqs, iv; kwargs...)
206206
collect_vars!(allunknowns, ps, eq, iv; op = Shift)
207207
if iscall(eq.lhs) && operation(eq.lhs) isa Shift
208208
isequal(iv, operation(eq.lhs).t) ||
209-
throw(ArgumentError("A DiscreteSystem can only have one independent variable."))
209+
throw(ArgumentError("An ImplicitDiscreteSystem can only have one independent variable."))
210210
eq.lhs in diffvars &&
211211
throw(ArgumentError("The shift variable $(eq.lhs) is not unique in the system of equations."))
212212
push!(diffvars, eq.lhs)
@@ -233,16 +233,16 @@ function ImplicitDiscreteSystem(eqs, iv; kwargs...)
233233
push!(new_ps, p)
234234
end
235235
end
236-
return DiscreteSystem(eqs, iv,
236+
return ImplicitDiscreteSystem(eqs, iv,
237237
collect(allunknowns), collect(new_ps); kwargs...)
238238
end
239239

240-
function flatten(sys::DiscreteSystem, noeqs = false)
240+
function flatten(sys::ImplicitDiscreteSystem, noeqs = false)
241241
systems = get_systems(sys)
242242
if isempty(systems)
243243
return sys
244244
else
245-
return DiscreteSystem(noeqs ? Equation[] : equations(sys),
245+
return ImplicitDiscreteSystem(noeqs ? Equation[] : equations(sys),
246246
get_iv(sys),
247247
unknowns(sys),
248248
parameters(sys),
@@ -258,14 +258,14 @@ function flatten(sys::DiscreteSystem, noeqs = false)
258258
end
259259

260260
function generate_function(
261-
sys::DiscreteSystem, dvs = unknowns(sys), ps = parameters(sys); wrap_code = identity, kwargs...)
261+
sys::ImplicitDiscreteSystem, dvs = unknowns(sys), ps = parameters(sys); wrap_code = identity, kwargs...)
262262
exprs = [eq.rhs for eq in equations(sys)]
263263
wrap_code = wrap_code .∘ wrap_array_vars(sys, exprs) .∘
264264
wrap_parameter_dependencies(sys, false)
265265
generate_custom_function(sys, exprs, dvs, ps; wrap_code, kwargs...)
266266
end
267267

268-
function shift_u0map_forward(sys::DiscreteSystem, u0map, defs)
268+
function shift_u0map_forward(sys::ImplicitDiscreteSystem, u0map, defs)
269269
iv = get_iv(sys)
270270
updated = AnyDict()
271271
for k in collect(keys(u0map))
@@ -291,7 +291,7 @@ end
291291
Generates an ImplicitDiscreteProblem from an ImplicitDiscreteSystem.
292292
"""
293293
function SciMLBase.ImplicitDiscreteProblem(
294-
sys::DiscreteSystem, u0map = [], tspan = get_tspan(sys),
294+
sys::ImplicitDiscreteSystem, u0map = [], tspan = get_tspan(sys),
295295
parammap = SciMLBase.NullParameters();
296296
eval_module = @__MODULE__,
297297
eval_expression = false,
@@ -309,7 +309,7 @@ function SciMLBase.ImplicitDiscreteProblem(
309309
u0map = to_varmap(u0map, dvs)
310310
u0map = shift_u0map_forward(sys, u0map, defaults(sys))
311311
f, u0, p = process_SciMLProblem(
312-
DiscreteFunction, sys, u0map, parammap; eval_expression, eval_module)
312+
ImplicitDiscreteFunction, sys, u0map, parammap; eval_expression, eval_module)
313313
u0 = f(u0, p, tspan[1])
314314
ImplicitDiscreteProblem(f, u0, tspan, p; kwargs...)
315315
end
@@ -348,7 +348,7 @@ function SciMLBase.ImplicitDiscreteFunction{iip, specialize}(
348348

349349
if specialize === SciMLBase.FunctionWrapperSpecialize && iip
350350
if u0 === nothing || p === nothing || t === nothing
351-
error("u0, p, and t must be specified for FunctionWrapperSpecialize on DiscreteFunction.")
351+
error("u0, p, and t must be specified for FunctionWrapperSpecialize on ImplicitDiscreteFunction.")
352352
end
353353
f = SciMLBase.wrapfun_iip(f, (u0, u0, p, t))
354354
end
@@ -395,7 +395,7 @@ function ImplicitDiscreteFunctionExpr{iip}(sys::ImplicitDiscreteSystem, dvs = un
395395

396396
ex = quote
397397
$_f
398-
DiscreteFunction{$iip}($fsym)
398+
ImplicitDiscreteFunction{$iip}($fsym)
399399
end
400400
!linenumbers ? Base.remove_linenums!(ex) : ex
401401
end

0 commit comments

Comments
 (0)