@@ -15,6 +15,8 @@ const ExtrapDimSpec = Union{BoundaryCondition,Tuple{Vararg{Union{BoundaryConditi
1515etptype (:: Extrapolation{T,N,ITPT,IT,ET} ) where {T,N,ITPT,IT,ET} = ET
1616etpflag (etp:: Extrapolation{T,N,ITPT,IT,ET} ) where {T,N,ITPT,IT,ET} = etp. et
1717
18+ BoundsCheckStyle (etp:: AbstractExtrapolation ) = CheckWillPass ()
19+
1820"""
1921`extrapolate(itp, scheme)` adds extrapolation behavior to an interpolation object, according to the provided scheme.
2022
@@ -35,11 +37,12 @@ extrapolate(itp::AbstractInterpolation{T,N,IT}, et::ET) where {T,N,IT,ET<:Extrap
3537
3638count_interp_dims (:: Type{<:Extrapolation{T,N,ITPT}} , n) where {T,N,ITPT} = count_interp_dims (ITPT, n)
3739
38- @inline function (etp:: Extrapolation{T,N} )(x:: Vararg{Number,N} ) where {T,N}
40+ @propagate_inbounds function (etp:: Extrapolation{T,N} )(x:: Vararg{Number,N} ) where {T,N}
3941 itp = parent (etp)
4042 eflag = etpflag (etp)
4143 xs = inbounds_position (eflag, bounds (itp), x, etp, x)
42- extrapolate_value (eflag, skip_flagged_nointerp (itp, x), skip_flagged_nointerp (itp, xs), Tuple (gradient (itp, xs... )), itp (xs... ))
44+ g = @inbounds gradient (itp, xs... )
45+ extrapolate_value (eflag, skip_flagged_nointerp (itp, x), skip_flagged_nointerp (itp, xs), Tuple (g), @inbounds (itp (xs... )))
4346end
4447@inline function (etp:: Extrapolation{T,N} )(x:: Vararg{Union{Number,AbstractVector},N} ) where {T,N}
4548 itp = parent (etp)
5861 else
5962 eflag = tcollect (etpflag, etp)
6063 xs = inbounds_position (eflag, bounds (itp), x, etp, x)
61- g = gradient (itp, xs... )
64+ g = @inbounds gradient (itp, xs... )
6265 skipni = t-> skip_flagged_nointerp (itp, t)
6366 SVector (extrapolate_gradient .(skipni (eflag), skipni (x), skipni (xs), Tuple (g)))
6467 end
127130periodic (y, l, u) = mod (y- l, u- l) + l
128131
129132
130- function extrapolate_value (eflag, x, xs, g, val)
133+ @inline function extrapolate_value (eflag, x, xs, g, val)
131134 val = extrapolate_axis (getfirst (eflag), x[1 ], xs[1 ], g[1 ], val)
132135 extrapolate_value (getrest (eflag), Base. tail (x), Base. tail (xs), Base. tail (g), val)
133136end
0 commit comments