@@ -34,11 +34,19 @@ apply:
3434 parameter values, and can be accessed at specific indices in the timeseries.
3535- A mix of timeseries and non-timeseries parameters: The function can _only_ be used on
3636 non-timeseries objects and will return the value of each parameter at in the object.
37+
38+ # Keyword Arguments
39+
40+ - `inbounds`: Whether to wrap the returned function in `@inbounds`.
3741"""
38- function getp (sys, p)
42+ function getp (sys, p; inbounds = false )
3943 symtype = symbolic_type (p)
4044 elsymtype = symbolic_type (eltype (p))
41- _getp (sys, symtype, elsymtype, p)
45+ getter = _getp (sys, symtype, elsymtype, p)
46+ if inbounds
47+ getter = InboundsWrapper (getter)
48+ end
49+ return getter
4250end
4351
4452struct GetParameterIndex{I} <: AbstractParameterGetIndexer
@@ -659,15 +667,22 @@ Requires that the value provider implement [`parameter_values`](@ref) and the re
659667collection be a mutable reference to the parameter object. In case `parameter_values`
660668cannot return such a mutable reference, or additional actions need to be performed when
661669updating parameters, [`set_parameter!`](@ref) must be implemented.
670+
671+ # Keyword Arguments
672+
673+ - `inbounds`: Whether to wrap the function in `@inbounds`.
662674"""
663- function setp (sys, p; run_hook = true )
675+ function setp (sys, p; run_hook = true , inbounds = false )
664676 symtype = symbolic_type (p)
665677 elsymtype = symbolic_type (eltype (p))
666- return if run_hook
667- return ParameterHookWrapper (_setp (sys, symtype, elsymtype, p), p)
668- else
669- _setp (sys, symtype, elsymtype, p)
678+ setter = _setp (sys, symtype, elsymtype, p)
679+ if run_hook
680+ setter = ParameterHookWrapper (setter, p)
681+ end
682+ if inbounds
683+ setter = InboundsWrapper (setter)
670684 end
685+ return setter
671686end
672687
673688struct SetParameterIndex{I} <: AbstractSetIndexer
@@ -723,11 +738,19 @@ the types of values stored, and leverages [`remake_buffer`](@ref). Note that `sy
723738an index, a symbolic variable, or an array/tuple of the aforementioned.
724739
725740Requires that the value provider implement `parameter_values` and `remake_buffer`.
741+
742+ # Keyword Arguments
743+
744+ - `inbounds`: Whether to wrap the returned function in `@inbounds`.
726745"""
727- function setp_oop (indp, sym)
746+ function setp_oop (indp, sym; inbounds = false )
728747 symtype = symbolic_type (sym)
729748 elsymtype = symbolic_type (eltype (sym))
730- return _setp_oop (indp, symtype, elsymtype, sym)
749+ setter = _setp_oop (indp, symtype, elsymtype, sym)
750+ if inbounds
751+ setter = InboundsWrapper (setter)
752+ end
753+ return setter
731754end
732755
733756function _setp_oop (indp, :: NotSymbolic , :: NotSymbolic , sym)
0 commit comments