8 use constants
, only: dp
35 subroutine pwl_interp_1d ( nd, xd, yd, ni, xi, yi )
76 integer ( kind = 4 ) nd
77 integer ( kind = 4 ) ni
79 integer ( kind = 4 ) i
80 integer ( kind = 4 ) k
82 real ( kind = dp ) xd(nd)
83 real ( kind = dp ) yd(nd)
84 real ( kind = dp ) xi(ni)
85 real ( kind = dp ) yi(ni)
96 if ( xi(i) <= xd(1) )
then 98 t = ( xi(i) - xd(1) ) / ( xd(2) - xd(1) )
99 yi(i) = ( 1.0e+00_dp - t ) * yd(1) + t * yd(2)
101 else if ( xd(nd) <= xi(i) )
then 103 t = ( xi(i) - xd(nd-1) ) / ( xd(nd) - xd(nd-1) )
104 yi(i) = ( 1.0e+00_dp - t ) * yd(nd-1) + t * yd(nd)
110 if ( xd(k-1) <= xi(i) .and. xi(i) <= xd(k) )
then 112 t = ( xi(i) - xd(k-1) ) / ( xd(k) - xd(k-1) )
113 yi(i) = ( 1.0e+00_dp - t ) * yd(k-1) + t * yd(k)
125 end subroutine pwl_interp_1d
126 end module interpolation