get_temp_x_for_extrap Function

private pure function get_temp_x_for_extrap(x, tmin, tmax, extrap) result(xt)

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.

Arguments

Type IntentOptional 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)

Return Value real(kind=wp)

The value returned (it will either be tmin, x, or tmax)


Called by

proc~~get_temp_x_for_extrap~~CalledByGraph proc~get_temp_x_for_extrap bspline_sub_module::get_temp_x_for_extrap proc~dintrv bspline_sub_module::dintrv proc~dintrv->proc~get_temp_x_for_extrap proc~db2val bspline_sub_module::db2val proc~db2val->proc~dintrv proc~dbvalu bspline_sub_module::dbvalu proc~db2val->proc~dbvalu proc~db3val bspline_sub_module::db3val proc~db3val->proc~dintrv proc~db3val->proc~dbvalu proc~db4val bspline_sub_module::db4val proc~db4val->proc~dintrv proc~db4val->proc~dbvalu proc~db5val bspline_sub_module::db5val proc~db5val->proc~dintrv proc~db5val->proc~dbvalu proc~db6val bspline_sub_module::db6val proc~db6val->proc~dintrv proc~db6val->proc~dbvalu proc~dbfqad bspline_sub_module::dbfqad proc~dbfqad->proc~dintrv proc~dbsgq8 bspline_sub_module::dbsgq8 proc~dbfqad->proc~dbsgq8 proc~dbsqad bspline_sub_module::dbsqad proc~dbsqad->proc~dintrv proc~dbsqad->proc~dbvalu proc~dbvalu->proc~dintrv proc~db1fqad bspline_sub_module::db1fqad proc~db1fqad->proc~dbfqad proc~db1sqad bspline_sub_module::db1sqad proc~db1sqad->proc~dbsqad proc~db1val_alt bspline_sub_module::db1val_alt proc~db1val_alt->proc~dbvalu proc~db1val_default bspline_sub_module::db1val_default proc~db1val_default->proc~dbvalu proc~dbsgq8->proc~dbvalu proc~evaluate_2d bspline_oo_module::bspline_2d%evaluate_2d proc~evaluate_2d->proc~db2val proc~evaluate_3d bspline_oo_module::bspline_3d%evaluate_3d proc~evaluate_3d->proc~db3val proc~evaluate_4d bspline_oo_module::bspline_4d%evaluate_4d proc~evaluate_4d->proc~db4val proc~evaluate_5d bspline_oo_module::bspline_5d%evaluate_5d proc~evaluate_5d->proc~db5val proc~evaluate_6d bspline_oo_module::bspline_6d%evaluate_6d proc~evaluate_6d->proc~db6val interface~db1val bspline_sub_module::db1val interface~db1val->proc~db1val_alt interface~db1val->proc~db1val_default proc~fintegral_1d bspline_oo_module::bspline_1d%fintegral_1d proc~fintegral_1d->proc~db1fqad proc~integral_1d bspline_oo_module::bspline_1d%integral_1d proc~integral_1d->proc~db1sqad proc~evaluate_1d bspline_oo_module::bspline_1d%evaluate_1d proc~evaluate_1d->interface~db1val

Source Code

    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