360
360
const MTKPARAMETERS_ARG = Sym {Vector{Vector}} (:___mtkparameters___ )
361
361
362
362
"""
363
- wrap_mtkparameters(sys::AbstractSystem, isscalar::Bool, p_start = 2)
363
+ wrap_mtkparameters(sys::AbstractSystem, isscalar::Bool, p_start = 2, offset = Int(is_time_dependent(sys)) )
364
364
365
365
Return function(s) to be passed to the `wrap_code` keyword of `build_function` which
366
366
allow the compiled function to be called as `f(u, p, t)` where `p isa MTKParameters`
@@ -370,12 +370,14 @@ the first parameter vector in the out-of-place version of the function. For exam
370
370
if a history function (DDEs) was passed before `p`, then the function before wrapping
371
371
would have the signature `f(u, h, p..., t)` and hence `p_start` would need to be `3`.
372
372
373
+ `offset` is the number of arguments at the end of the argument list to ignore. Defaults
374
+ to 1 if the system is time-dependent (to ignore `t`) and 0 otherwise.
375
+
373
376
The returned function is `identity` if the system does not have an `IndexCache`.
374
377
"""
375
- function wrap_mtkparameters (sys:: AbstractSystem , isscalar:: Bool , p_start = 2 )
378
+ function wrap_mtkparameters (sys:: AbstractSystem , isscalar:: Bool , p_start = 2 ,
379
+ offset = Int (is_time_dependent (sys)))
376
380
if has_index_cache (sys) && get_index_cache (sys) != = nothing
377
- offset = Int (is_time_dependent (sys))
378
-
379
381
if isscalar
380
382
function (expr)
381
383
param_args = expr. args[p_start: (end - offset)]
0 commit comments