source: LMDZ.3.3/trunk/libf/dyn3d/splint.F @ 5230

Last change on this file since 5230 was 2, checked in by lmdz, 25 years ago

Initial revision

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 948 bytes
Line 
1     
2      SUBROUTINE splint(xa,ya,y2a,n,x,y)
3     
4c
5c     Routine to compute a cubic-spline interpolated value Y given the
6c     value of X, the arrays XA, YA and the 2nd derivative array Y2A
7c     computed by SUBROUTINE SPLINE. See "Numerical Recipes" for details
8c
9     
10      IMPLICIT REAL (a-h,o-z)
11      IMPLICIT INTEGER (i-n)
12      DIMENSION xa(n),ya(n),y2a(n)
13     
14      kl0=1
15     
16      khi=n
17c means of bisection
18 1    IF(khi-kl0.gt.1) THEN
19     
20       k=(khi+kl0)/2
21     
22       IF(xa(k).gt.x) THEN
23     
24        khi=k
25     
26       ELSE
27     
28        kl0=k
29     
30       END IF
31     
32       GO TO 1
33     
34      END IF
35c KL0 and KHI now bracket the X
36      h=xa(khi)-xa(kl0)
37     
38      IF(h.eq.0.0) STOP
39      a=(xa(khi)-x)/h
40c evaluation of cubic spline polynomial
41      b=(x-xa(kl0))/h
42     
43      y=a*ya(kl0)+b*ya(khi)+((a**3-a)*y2a(kl0)+(b**3-b)*y2a(khi))*(h**2)
44     
45     ./6.
46     
47c
48     
49      RETURN
50     
51      END
52     
53
Note: See TracBrowser for help on using the repository browser.