46 real(kind=
rp),
intent(in) :: x
47 real(kind=
rp),
intent(in) :: edge0, edge1
48 real(kind=
rp) :: res, t
50 t =
clamp_cpu((x - edge0) / (edge1 - edge0), 0.0_rp, 1.0_rp)
52 res = t**3 * (t * (6.0_rp * t - 15.0_rp) + 10.0_rp)
57 elemental function clamp_cpu(x, lowerlimit, upperlimit)
result(res)
58 real(kind=
rp),
intent(in) :: x
59 real(kind=
rp),
intent(in) :: lowerlimit, upperlimit
62 res =
max(lowerlimit, min(upperlimit, x))
67 real(kind=
rp),
intent(in) :: x, x_step, value0, value1
70 res = merge(value0, value1, x > x_step)
76 real(kind=
rp),
intent(in) :: x, k_0, k_1, q
79 perm = k_0 + (k_1 - k_0) * x * (q + 1.0_rp) / (q + x)
CPU implementations of the filter functions.
elemental real(kind=rp) function smooth_step_cpu(x, edge0, edge1)
Apply a smooth step function to a scalar.
elemental real(kind=rp) function clamp_cpu(x, lowerlimit, upperlimit)
Clamp a value between two limits.
elemental real(kind=rp) function permeability_cpu(x, k_0, k_1, q)
Apply a permeability function to a scalar.
elemental real(kind=rp) function step_function_cpu(x, x_step, value0, value1)
Apply a step function to a scalar.
integer, parameter, public rp
Global precision used in computations.