Skip to content

Commit e69851a

Browse files
committed
use old tosymbol but disable escaping
1 parent 3403d67 commit e69851a

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

src/systems/diffeqs/abstractodesystem.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,13 @@ function DiffEqBase.ODEFunction{iip}(sys::AbstractODESystem, dvs = states(sys),
158158

159159
_M = (u0 === nothing || M == I) ? M : ArrayInterface.restructure(u0 .* u0',M)
160160

161+
sts = states(sys)
161162
ODEFunction{iip}(f,
162163
jac = _jac === nothing ? nothing : _jac,
163164
tgrad = _tgrad === nothing ? nothing : _tgrad,
164165
mass_matrix = _M,
165166
jac_prototype = sparse ? similar(sys.jac[],Float64) : nothing,
166-
syms = tosymbol.(states(sys)))
167+
syms = tosymbol.(sts, states=sts, escape=false))
167168
end
168169

169170
"""
@@ -219,13 +220,13 @@ function ODEFunctionExpr{iip}(sys::AbstractODESystem, dvs = states(sys),
219220
tgrad = $_tgrad
220221
jac = $_jac
221222
M = $_M
222-
223+
sts = $(states(sys))
223224
ODEFunction{$iip}(f,
224225
jac = jac,
225226
tgrad = tgrad,
226227
mass_matrix = M,
227228
jac_prototype = $jp_expr,
228-
syms = $(tosymbol.(states(sys))))
229+
syms = $(tosymbol.(sts, states=sts, escape=false)))
229230
end
230231
!linenumbers ? striplines(ex) : ex
231232
end

src/systems/diffeqs/sdesystem.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,14 @@ function DiffEqBase.SDEFunction{iip}(sys::SDESystem, dvs = sys.states, ps = sys.
190190
M = calculate_massmatrix(sys)
191191
_M = (u0 === nothing || M == I) ? M : ArrayInterface.restructure(u0 .* u0',M)
192192

193+
sts = states(sys)
193194
SDEFunction{iip}(f,g,
194195
jac = _jac === nothing ? nothing : _jac,
195196
tgrad = _tgrad === nothing ? nothing : _tgrad,
196197
Wfact = _Wfact === nothing ? nothing : _Wfact,
197198
Wfact_t = _Wfact_t === nothing ? nothing : _Wfact_t,
198199
mass_matrix = _M,
199-
syms = tosymbol.(states(sys)))
200+
syms = tosymbol.(sts, states=sts, escape=false))
200201
end
201202

202203
function DiffEqBase.SDEFunction(sys::SDESystem, args...; kwargs...)
@@ -262,14 +263,14 @@ function SDEFunctionExpr{iip}(sys::SDESystem, dvs = states(sys),
262263
Wfact = $_Wfact
263264
Wfact_t = $_Wfact_t
264265
M = $_M
265-
266+
sts = $(states(sys))
266267
SDEFunction{$iip}(f,g,
267268
jac = jac,
268269
tgrad = tgrad,
269270
Wfact = Wfact,
270271
Wfact_t = Wfact_t,
271272
mass_matrix = M,
272-
syms = $(tosymbol.(states(sys))),kwargs...)
273+
syms = $(tosymbol.(sts, states=sts, escape=false)),kwargs...)
273274
end
274275
!linenumbers ? striplines(ex) : ex
275276
end

src/systems/jumps/jumpsystem.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ function DiffEqBase.DiscreteProblem(sys::JumpSystem, u0map, tspan::Tuple,
197197
p = parammap
198198
end
199199
f = DiffEqBase.DISCRETE_INPLACE_DEFAULT
200-
df = DiscreteFunction{true,true}(f, syms=tosymbol.(states(sys)))
200+
sts = states(sys)
201+
df = DiscreteFunction{true,true}(f, syms=tosymbol.(sts, states=sts, escape=false))
202+
@show df.syms
201203
DiscreteProblem(df, u0, tspan, p; kwargs...)
202204
end
203205

@@ -230,7 +232,8 @@ function DiscreteProblemExpr(sys::JumpSystem, u0map, tspan::Tuple,
230232
u0 = $u0
231233
p = $p
232234
tspan = $tspan
233-
df = DiscreteFunction{true,true}(f, syms=$(tosymbol.(states(sys))))
235+
sts = $(states(sys))
236+
df = DiscreteFunction{true,true}(f, syms=$(tosymbol.(sts, states=sts, escape=false)))
234237
DiscreteProblem(df, u0, tspan, p; kwargs...)
235238
end
236239
end

src/utils.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ tovar(s::Sym) = s
159159
Base.Symbol(x::Union{Num,Symbolic}) = tosymbol(x)
160160
tosymbol(x; kwargs...) = x
161161
tosymbol(x::Sym; kwargs...) = nameof(x)
162-
tosymbol(x::Term; kwargs...) = nameof(operation(x))
163162
tosymbol(t::Num; kwargs...) = tosymbol(value(t); kwargs...)
164163

165164
"""

0 commit comments

Comments
 (0)