Returns the value of x
to use for computing the interval
in t
, depending on if extrapolation is allowed or not.
If extrapolation is allowed and x is < tmin or > tmax, then either
tmin
or tmax - 2.0_wp*spacing(tmax)
is returned.
Otherwise, x
is returned.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in) | :: | x |
variable value |
||
real(kind=wp), | intent(in) | :: | tmin |
first knot vector element for b-splines |
||
real(kind=wp), | intent(in) | :: | tmax |
last knot vector element for b-splines |
||
logical, | intent(in), | optional | :: | extrap |
if extrapolation is allowed (if not present, default is False) |
The value returned (it will either
be tmin
, x
, or tmax
)
pure function get_temp_x_for_extrap(x,tmin,tmax,extrap) result(xt) implicit none real(wp),intent(in) :: x !! variable value real(wp),intent(in) :: tmin !! first knot vector element for b-splines real(wp),intent(in) :: tmax !! last knot vector element for b-splines real(wp) :: xt !! The value returned (it will either !! be `tmin`, `x`, or `tmax`) logical,intent(in),optional :: extrap !! if extrapolation is allowed !! (if not present, default is False) logical :: extrapolation_allowed !! if extrapolation is allowed if (present(extrap)) then extrapolation_allowed = extrap else extrapolation_allowed = .false. end if if (extrapolation_allowed) then if (x<tmin) then xt = tmin else if (x>tmax) then ! Put it just inside the upper bound. ! This is sort of a hack to get ! extrapolation to work. xt = tmax - 2.0_wp*spacing(tmax) else xt = x end if else xt = x end if end function get_temp_x_for_extrap