8 use constants
, only: dp
39 subroutine pwl_interp_1d ( nd, xd, yd, ni, xi, yi )
80 integer ( kind = 4 ) nd
81 integer ( kind = 4 ) ni
83 integer ( kind = 4 ) i
84 integer ( kind = 4 ) k
86 real ( kind = dp ) xd(nd)
87 real ( kind = dp ) yd(nd)
88 real ( kind = dp ) xi(ni)
89 real ( kind = dp ) yi(ni)
100 if ( xi(i) <= xd(1) )
then 102 t = ( xi(i) - xd(1) ) / ( xd(2) - xd(1) )
103 yi(i) = ( 1.0e+00_dp - t ) * yd(1) + t * yd(2)
105 else if ( xd(nd) <= xi(i) )
then 107 t = ( xi(i) - xd(nd-1) ) / ( xd(nd) - xd(nd-1) )
108 yi(i) = ( 1.0e+00_dp - t ) * yd(nd-1) + t * yd(nd)
114 if ( xd(k-1) <= xi(i) .and. xi(i) <= xd(k) )
then 116 t = ( xi(i) - xd(k-1) ) / ( xd(k) - xd(k-1) )
117 yi(i) = ( 1.0e+00_dp - t ) * yd(k-1) + t * yd(k)
129 end subroutine pwl_interp_1d
130 end module interpolation