Skip to content

Commit 8669cd3

Browse files
committed
solver_states -> unknown_states
1 parent cb0d444 commit 8669cd3

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

src/structural_transformation/codegen.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ function build_torn_function(sys;
298298
rhss)
299299

300300
states = Any[fullvars[i] for i in states_idxs]
301-
@set! sys.solver_states = states
301+
@set! sys.unknown_states = states
302302
syms = map(Symbol, states)
303303

304304
pre = get_postprocess_fbody(sys)
@@ -403,7 +403,7 @@ function build_observed_function(state, ts, var_eq_matching, var_sccs,
403403

404404
fullvars = state.fullvars
405405
s = state.structure
406-
solver_states = fullvars[is_solver_state_idxs]
406+
unknown_states = fullvars[is_solver_state_idxs]
407407
algvars = fullvars[.!is_solver_state_idxs]
408408

409409
required_algvars = Set(intersect(algvars, vars))
@@ -490,7 +490,7 @@ function build_observed_function(state, ts, var_eq_matching, var_sccs,
490490
cpre = get_preprocess_constants([obs[1:maxidx];
491491
isscalar ? ts[1] : MakeArray(ts, output_type)])
492492
pre2 = x -> pre(cpre(x))
493-
ex = Code.toexpr(Func([DestructuredArgs(solver_states, inbounds = !checkbounds)
493+
ex = Code.toexpr(Func([DestructuredArgs(unknown_states, inbounds = !checkbounds)
494494
DestructuredArgs(parameters(sys), inbounds = !checkbounds)
495495
independent_variables(sys)],
496496
[],

src/systems/abstractsystem.jl

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ for prop in [:eqs
214214
:substitutions
215215
:metadata
216216
:discrete_subsystems
217-
:solver_states]
217+
:unknown_states]
218218
fname1 = Symbol(:get_, prop)
219219
fname2 = Symbol(:has_, prop)
220220
@eval begin
@@ -581,16 +581,21 @@ end
581581

582582
SymbolicIndexingInterface.is_indep_sym(sys::AbstractSystem, sym) = isequal(sym, get_iv(sys))
583583

584-
function solver_states(sys::AbstractSystem)
584+
"""
585+
$(SIGNATURES)
586+
587+
Return a list of actual states needed to be solved by solvers.
588+
"""
589+
function unknown_states(sys::AbstractSystem)
585590
sts = states(sys)
586-
if has_solver_states(sys)
587-
sts = something(get_solver_states(sys), sts)
591+
if has_unknown_states(sys)
592+
sts = something(get_unknown_states(sys), sts)
588593
end
589594
return sts
590595
end
591596

592597
function SymbolicIndexingInterface.state_sym_to_index(sys::AbstractSystem, sym)
593-
findfirst(isequal(sym), solver_states(sys))
598+
findfirst(isequal(sym), unknown_states(sys))
594599
end
595600
function SymbolicIndexingInterface.is_state_sym(sys::AbstractSystem, sym)
596601
!isnothing(SymbolicIndexingInterface.state_sym_to_index(sys, sym))

src/systems/diffeqs/odesystem.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,16 +131,17 @@ struct ODESystem <: AbstractODESystem
131131
"""
132132
discrete_subsystems::Any
133133
"""
134-
solver_states: a list of actual solver states. Only used for ODAEProblem.
134+
unknown_states: a list of actual states needed to be solved by solvers. Only
135+
used for ODAEProblem.
135136
"""
136-
solver_states::Union{Nothing, Vector{Any}}
137+
unknown_states::Union{Nothing, Vector{Any}}
137138

138139
function ODESystem(tag, deqs, iv, dvs, ps, tspan, var_to_name, ctrls, observed, tgrad,
139140
jac, ctrl_jac, Wfact, Wfact_t, name, systems, defaults,
140141
torn_matching, connector_type, preface, cevents,
141142
devents, metadata = nothing, tearing_state = nothing,
142143
substitutions = nothing, complete = false,
143-
discrete_subsystems = nothing, solver_states = nothing;
144+
discrete_subsystems = nothing, unknown_states = nothing;
144145
checks::Union{Bool, Int} = true)
145146
if checks == true || (checks & CheckComponents) > 0
146147
check_variables(dvs, iv)
@@ -154,7 +155,7 @@ struct ODESystem <: AbstractODESystem
154155
new(tag, deqs, iv, dvs, ps, tspan, var_to_name, ctrls, observed, tgrad, jac,
155156
ctrl_jac, Wfact, Wfact_t, name, systems, defaults, torn_matching,
156157
connector_type, preface, cevents, devents, metadata, tearing_state,
157-
substitutions, complete, discrete_subsystems, solver_states)
158+
substitutions, complete, discrete_subsystems, unknown_states)
158159
end
159160
end
160161

0 commit comments

Comments
 (0)