8 real(rprec),
intent(in) :: x
9 real(rprec),
intent(out) :: y
10 real(rprec),
dimension(npts),
intent(in) :: xx
11 real(rprec),
dimension(npts),
intent(in) :: yy
12 integer,
intent(in) :: npts
13 integer,
intent(inout) :: iflag
17 real(rprec),
dimension(-1:size(xx)+2) :: a
18 real(rprec),
dimension(-1:size(xx)+2) :: b
19 real(rprec),
dimension(-1:size(xx)+2) :: c
20 real(rprec),
dimension(-1:size(xx)+2) :: d
22 real(rprec),
dimension(-1:size(xx)+2) :: xloc
23 real(rprec),
dimension(-1:size(xx)+2) :: yloc
25 real(rprec),
dimension(-1:size(xx)+2) :: m
26 real(rprec),
dimension(-1:size(xx)+2) :: t
27 real(rprec),
dimension(-1:size(xx)+2) :: dm
28 real(rprec),
dimension(-1:size(xx)+2) :: p
29 real(rprec),
dimension(-1:size(xx)+2) :: q
57 > stop
'spline_akima: more active points requested than available'
58 if(ix /=
size(yy)) stop
'size mismatch of xx and yy!'
64 a = 0._dp ; b = 0._dp ; c = 0._dp ; d = 0._dp
65 xloc = 0._dp ; yloc = 0._dp
66 m = 0._dp ; t = 0._dp ; dm = 0._dp
70 xloc(-1)= 2*xloc(1)-xloc(3)
71 xloc( 0)= xloc(1)+xloc(2)-xloc(3)
72 xloc(iv+2)= 2*xloc(iv)-xloc(iv-2)
73 xloc(iv+1)= xloc(iv)+xloc(iv-1)-xloc(iv-2)
78 m(-1:iv+1) = (yloc(0:iv+2)-yloc(-1:iv+1))/
79 > (xloc(0:iv+2)-xloc(-1:iv+1))
81 cl = (m(2)-m(1))/(xloc(3)-xloc(1))
82 bl = m(1) - cl*(xloc(2)-xloc(1))
83 cr = (m(iv-2)-m(iv-1))/(xloc(iv)-xloc(iv-2))
84 br = m(iv-2) - cr*(xloc(iv-1)-xloc(iv-2))
85 yloc( 0)=yloc(1)+bl*(xloc( 0)-xloc(1))+
86 > cl*(xloc( 0)-xloc(1))**2
87 yloc(-1)=yloc(1)+bl*(xloc(-1)-xloc(1))+
88 > cl*(xloc(-1)-xloc(1))**2
89 yloc(iv+1)=yloc(iv)+br*(xloc(iv+1)-xloc(iv))+
90 > cl*(xloc(iv+1)-xloc(iv))**2
91 yloc(iv+2)=yloc(iv)+br*(xloc(iv+2)-xloc(iv))+
92 > cl*(xloc(iv+2)-xloc(iv))**2
94 m(-1) = (yloc(0)-yloc(-1))/(xloc(0)-xloc(-1))
95 m( 0) = (yloc(1)-yloc( 0))/(xloc(1)-xloc( 0))
96 m(iv ) = (yloc(iv+1)-yloc(iv ))/(xloc(iv+1)-xloc(iv ))
97 m(iv+1) = (yloc(iv+2)-yloc(iv+1))/(xloc(iv+2)-xloc(iv+1))
99 dm(-1:iv)= abs(m(0:iv+1) - m(-1:iv))
101 p(1:iv) = dm(1:iv)/(dm(1:iv)+dm(-1:iv-2))
104 q(1:iv) = dm(-1:iv-2)/(dm(1:iv)+dm(-1:iv-2))
107 t(1:iv) = p(1:iv)*m(0:iv-1)+q(1:iv)*m(1:iv)
108 where ( p(1:iv)+q(1:iv) < tiny(1._dp))
109 t(1:iv) = 0.5_dp*m(0:iv-1)+0.5_dp*m(1:iv)
114 c(1:iv-1) = (3*m(1:iv-1)-t(2:iv)-2*t(1:iv-1))/
115 > (xloc(2:iv)-xloc(1:iv-1))
116 d(1:iv-1) = (t(2:iv)+t(1:iv-1)-2*m(1:iv-1))/
117 > (xloc(2:iv)-xloc(1:iv-1))**2
120 if(x<xloc(1) .or. x>xloc(iv))
then
126 if(x == xloc(iv))
then
133 if(x >= xloc(i) .and. x < xloc(i+1))
then
135 y=a(i)+dx*(b(i)+dx*(c(i)+d(i)*dx))