360360const  MTKPARAMETERS_ARG =  Sym {Vector{Vector}} (:___mtkparameters___ )
361361
362362""" 
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)) ) 
364364
365365Return function(s) to be passed to the `wrap_code` keyword of `build_function` which 
366366allow 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
370370if a history function (DDEs) was passed before `p`, then the function before wrapping 
371371would have the signature `f(u, h, p..., t)` and hence `p_start` would need to be `3`. 
372372
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+ 
373376The returned function is `identity` if the system does not have an `IndexCache`. 
374377""" 
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)))
376380    if  has_index_cache (sys) &&  get_index_cache (sys) != =  nothing 
377-         offset =  Int (is_time_dependent (sys))
378- 
379381        if  isscalar
380382            function  (expr)
381383                param_args =  expr. args[p_start: (end  -  offset)]
0 commit comments