Skip to content

Commit 0521114

Browse files
committed
Remove dead code
1 parent 506a26e commit 0521114

File tree

4 files changed

+3
-42
lines changed

4 files changed

+3
-42
lines changed

src/systems/abstractsystem.jl

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -663,20 +663,6 @@ function SymbolicIndexingInterface.is_param_sym(sys::AbstractSystem, sym)
663663
!isnothing(SymbolicIndexingInterface.param_sym_to_index(sys, sym))
664664
end
665665

666-
struct AbstractSysToExpr
667-
sys::AbstractSystem
668-
states::Vector
669-
end
670-
AbstractSysToExpr(sys) = AbstractSysToExpr(sys, states(sys))
671-
function (f::AbstractSysToExpr)(O)
672-
!istree(O) && return toexpr(O)
673-
any(isequal(O), f.states) && return nameof(operation(O)) # variables
674-
if issym(operation(O))
675-
return build_expr(:call, Any[nameof(operation(O)); f.(arguments(O))])
676-
end
677-
return build_expr(:call, Any[operation(O); f.(arguments(O))])
678-
end
679-
680666
###
681667
### System utils
682668
###

src/systems/jumps/jumpsystem.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ function generate_rate_function(js::JumpSystem, rate)
181181
end
182182
rf = build_function(rate, states(js), parameters(js),
183183
get_iv(js),
184-
conv = states_to_sym(states(js)),
185184
expression = Val{true})
186185
end
187186

src/systems/optimization/optimizationsystem.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ function generate_gradient(sys::OptimizationSystem, vs = states(sys), ps = param
124124
grad = calculate_gradient(sys)
125125
pre = get_preprocess_constants(grad)
126126
return build_function(grad, vs, ps; postprocess_fbody = pre,
127-
conv = AbstractSysToExpr(sys), kwargs...)
127+
kwargs...)
128128
end
129129

130130
function calculate_hessian(sys::OptimizationSystem)
@@ -140,14 +140,14 @@ function generate_hessian(sys::OptimizationSystem, vs = states(sys), ps = parame
140140
end
141141
pre = get_preprocess_constants(hess)
142142
return build_function(hess, vs, ps; postprocess_fbody = pre,
143-
conv = AbstractSysToExpr(sys), kwargs...)
143+
kwargs...)
144144
end
145145

146146
function generate_function(sys::OptimizationSystem, vs = states(sys), ps = parameters(sys);
147147
kwargs...)
148148
eqs = subs_constants(objective(sys))
149149
return build_function(eqs, vs, ps;
150-
conv = AbstractSysToExpr(sys), kwargs...)
150+
kwargs...)
151151
end
152152

153153
function namespace_objective(sys::AbstractSystem)

src/utils.jl

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -50,30 +50,6 @@ end
5050

5151
@deprecate substitute_expr!(expr, s) substitute(expr, s)
5252

53-
function states_to_sym(states::Set)
54-
function _states_to_sym(O)
55-
if O isa Equation
56-
Expr(:(=), _states_to_sym(O.lhs), _states_to_sym(O.rhs))
57-
elseif istree(O)
58-
op = operation(O)
59-
args = arguments(O)
60-
if issym(op)
61-
O in states && return tosymbol(O)
62-
# dependent variables
63-
return build_expr(:call, Any[nameof(op); _states_to_sym.(args)])
64-
else
65-
canonical, O = canonicalexpr(O)
66-
return canonical ? O : build_expr(:call, Any[op; _states_to_sym.(args)])
67-
end
68-
elseif O isa Num
69-
return _states_to_sym(value(O))
70-
else
71-
return toexpr(O)
72-
end
73-
end
74-
end
75-
states_to_sym(states) = states_to_sym(Set(states))
76-
7753
function todict(d)
7854
eltype(d) <: Pair || throw(ArgumentError("The variable-value mapping must be a Dict."))
7955
d isa Dict ? d : Dict(d)

0 commit comments

Comments
 (0)