@@ -242,29 +242,32 @@ function isdelay(var, iv)
242
242
return false
243
243
end
244
244
const DDE_HISTORY_FUN = Sym {Symbolics.FnType{Tuple{Any, <:Real}, Vector{Real}}} (:___history___ )
245
- function delay_to_function (sys:: AbstractODESystem , eqs = full_equations (sys))
245
+ const DEFAULT_PARAMS_ARG = Sym {Any} (:ˍ₋arg3 )
246
+ function delay_to_function (
247
+ sys:: AbstractODESystem , eqs = full_equations (sys); history_arg = DEFAULT_PARAMS_ARG)
246
248
delay_to_function (eqs,
247
249
get_iv (sys),
248
250
Dict {Any, Int} (operation (s) => i for (i, s) in enumerate (unknowns (sys))),
249
251
parameters (sys),
250
- DDE_HISTORY_FUN)
252
+ DDE_HISTORY_FUN; history_arg )
251
253
end
252
- function delay_to_function (eqs:: Vector , iv, sts, ps, h)
253
- delay_to_function .(eqs, (iv,), (sts,), (ps,), (h,))
254
+ function delay_to_function (eqs:: Vector , iv, sts, ps, h; history_arg = DEFAULT_PARAMS_ARG )
255
+ delay_to_function .(eqs, (iv,), (sts,), (ps,), (h,); history_arg )
254
256
end
255
- function delay_to_function (eq:: Equation , iv, sts, ps, h)
256
- delay_to_function (eq. lhs, iv, sts, ps, h) ~ delay_to_function (eq. rhs, iv, sts, ps, h)
257
+ function delay_to_function (eq:: Equation , iv, sts, ps, h; history_arg = DEFAULT_PARAMS_ARG)
258
+ delay_to_function (eq. lhs, iv, sts, ps, h; history_arg) ~ delay_to_function (
259
+ eq. rhs, iv, sts, ps, h; history_arg)
257
260
end
258
- function delay_to_function (expr, iv, sts, ps, h)
261
+ function delay_to_function (expr, iv, sts, ps, h; history_arg = DEFAULT_PARAMS_ARG )
259
262
if isdelay (expr, iv)
260
263
v = operation (expr)
261
264
time = arguments (expr)[1 ]
262
265
idx = sts[v]
263
- return term (getindex, h (Sym {Any} ( :ˍ₋arg3 ) , time), idx, type = Real) # BIG BIG HACK
266
+ return term (getindex, h (history_arg , time), idx, type = Real) # BIG BIG HACK
264
267
elseif iscall (expr)
265
268
return maketerm (typeof (expr),
266
269
operation (expr),
267
- map (x -> delay_to_function (x, iv, sts, ps, h), arguments (expr)),
270
+ map (x -> delay_to_function (x, iv, sts, ps, h; history_arg ), arguments (expr)),
268
271
metadata (expr))
269
272
else
270
273
return expr
0 commit comments