source: PSPA/parmelaPSPA/trunk/spl1d1.f @ 315

Last change on this file since 315 was 12, checked in by lemeur, 12 years ago

parmela pspa initial

File size: 4.7 KB
Line 
1      subroutine spl1d1(n,x,f,w,iop,ij,a,b,c)
2c     where n= number of points in the interpolation
3c           x= origin of table of independent variable
4c           f= origin of table of dependent variable
5c           w= an array of dimension n which contains the calculated
6c              second derivatives upon return
7c         iop= an array of dimension 2 which contains combinations of
8c              the integers 1 thru 5 used to specify the boundary
9c              conditions
10c           ij= spacing in the f and w tables
11c        a,b,c= arrays of dimension n used for temporary storage
12c
13c--------------------------------------------------------------------------
14c
15      include 'ucom.h'
16c
17      dimension iop(2),x(n),f(n*ij),w(n*ij),a(n),b(n),c(n)
18c--------------------------------------------------------------------------
19c*
20      k=n-1
21      a(2)=-(x(2)-x(1))/6.
22      b(2)=(x(3)-x(1))/3.
23      w(ij+1)=(f(2*ij+1)-f(ij+1))/(x(3)-x(2))-(f(ij+1)-f(1))
24     1/(x(2)-x(1))
25      if (n-3)3,4,3
26    3 do 10 i=3,k
27      m=(i-1)*ij+1
28      j1=m+ij
29      j2=m-ij
30      con=(x(i+1)-x(i-1))/3.
31      don=(x(i)-x(i-1))/6.
32      b(i)=con-(don**2)/b(i-1)
33      e=(f(j1)-f(m))/(x(i+1)-x(i))-(f(m)-f(j2))/(x(i)-x(i-1))
34      w(m)=e-(don*w(j2))/b(i-1)
35   10 a(i)=-(don*a(i-1))/b(i-1)
36    4 k1=(n-2)*ij+1
37      c(n-1)=-((x(n)-x(n-1))/6.)/b(n-1)
38      w(k1)=w(k1)/b(n-1)
39      a(n-1)=a(n-1)/b(n-1)
40      k2=k-1
41      if (n-3)7,8,7
42    7 do 20 i=2,k2
43      j=n-i
44      con=(x(j+1)-x(j))/6.
45      a(j)=(a(j)-con*a(j+1))/b(j)
46      c(j)=-(con*c(j+1))/b(j)
47      k3=(j-1)*ij+1
48      m=k3+ij
49   20 w(k3)=(w(k3)-con*w(m))/b(j)
50    8 k4=(n-1)*ij+1
51      if (iop(1)-5) 201,200,201
52  201 c1=w(1)
53      if (iop(2)-5) 203,202,203
54  203 c2=w(k4)
55      go to 205
56  200 if (n-4)300,302,302
57  302 a1=x(1)-x(2)
58      a2=x(1)-x(3)
59      a3=x(1)-x(4)
60      a4=x(2)-x(3)
61      a5=x(2)-x(4)
62      a6=x(3)-x(4)
63c      w(1)=f(1)*(1./a1+1./a2+1./a3)-a2*a3*f(ij+1)/(a1*a4*a5)+
64c     1 a1*a3*f(2*ij+1)/(a2*a4*a6 )-a1*a2*f(3*ij+1)/(a3*a5*a6)
65      w(1)=f(1)*(1./a1+1./a2+1./a3)-a2*a3*f(ij+1)/(a1*a4*a5)
66      w(1)=w(1)+a1*a3*f(2*ij+1)/(a2*a4*a6 )-a1*a2*f(3*ij+1)/(a3*a5*a6)
67      go to 201
68  202 if (n-4)300,303,303
69  303 b1=x(n)-x(n-3)
70      b2=x(n)-x(n-2)
71      b3=x(n)-x(n-1)
72      b4=x(n-1)-x(n-3)
73      b5=x(n-1)-x(n-2)
74      b6=x(n-2)-x(n-3)
75      l1=k4-ij
76      l2=l1-ij
77      l3=l2-ij
78c      w(k4)=-b2*b3*f(l3)/(b6*b4*b1)+b1*b3*f(l2)/(b6*b5*b2)
79c     1 -b1*b2*f(l1)/(b4*b5*b3)+f(k4)*(1./b1+1./b2+1./b3)
80      w(k4)=-b2*b3*f(l3)/(b6*b4*b1)+b1*b3*f(l2)/(b6*b5*b2)
81      w(k4)=w(k4)-b1*b2*f(l1)/(b4*b5*b3)+f(k4)*(1./b1+1./b2+1./b3)
82      go to 203
83  205 do 50 i=1,k
84      m=(i-1)*ij+1
85   60 mk=iop(1)
86      go to (62,64,66,68,66),mk
87   62 if (i-1)71,63,71
88   63 a(1)=-1.
89      c(1)=0.
90      go to500
91   71 bob=0.
92      go to 500
93   64 if (i-1)73,76,73
94   76 a(1)=-1.
95      c(1)=0.
96      w(1)=0.
97      go to 500
98   73 if (i-2)81,81,82
99   81 bob=-c1
100      go to 500
101   82 bob=0.
102      go to 500
103   66 if (i-1)83,84,83
104   84 a(1)=-(x(2)-x(1))/3.
105      c(1)=0.
106      w(1)=-c1+(f(ij+1)-f(1))/(x(2)-x(1))
107      go to 500
108   83 if (i-2)85,85,86
109   85 bob=(x(2)-x(1))/6.
110      go to 500
111   86 bob=0.
112      go to 500
113   68 if (i-1)87,88,87
114   88 a(1)=-1.
115      c(1)=1.
116      w(1)=0.
117      go to 500
118   87 bob=0.
119  500 ml=iop(2)
120      go to (120,130,140,150,140),ml
121  120 if (i-1)121,122,121
122  122 a(n)=0.
123      c(n)=-1.
124      go to 70
125  121 bill=0.
126      go to 70
127  130 if (i-1)131,132,131
128  132 a(n)=0.
129      c(n)=-1.
130      w(k4)=0.
131      go to 70
132  131 if (i-k)134,133,134
133  133 bill=-c2
134      go to 70
135  134 bill=0.
136      go to 70
137  140 if (i-1)141,142,141
138  142 a(n)=0.
139      c(n)=(x(n-1)-x(n))/3.
140      w(k4)=c2-(f(k4)-f(k1))/(x(n)-x(n-1))
141      go to 70
142  141 if (i-k)143,144,143
143  144 bill=(x(n)-x(n-1))/6.
144      go to 70
145  143 bill=0.
146      go to 70
147  150 if (i-1)151,152,151
148  152 a(n)=0.
149      c(n)=(x(n-1)+x(1)-x(n)-x(2))/3.
150      w(k4)=(f(ij+1)-f(1))/(x(2)-x(1))-(f(k4)-f(k1))/(x(n)-x(n-1))
151      go to 70
152  151 if (i-2)153,154,153
153  154 bill=(x(2)-x(1))/6.
154      go to 70
155  153 if (i-k)155,156,155
156  156 bill=(x(n)-x(n-1))/6.
157      go to 70
158  155 bill=0.
159   70 if (i-1)80,50,80
160   80 w(1)=w(1)-bob*w(m)
161      w(k4)=w(k4)-bill*w(m)
162      a(1)=a(1)-bob*a(i)
163      a(n)=a(n)-bill*a(i)
164      c(1)=c(1)-bob*c(i)
165      c(n)=c(n)-bill*c(i)
166   50 continue
167      go to 100
168  100 con=a(1)*c(n)-c(1)*a(n)
169      d1=-w(1)
170      d2=-w(k4)
171      w(1)=(d1*c(n)-c(1)*d2)/con
172      w(k4)=(a(1)*d2-d1*a(n))/con
173      do 110 i=2,k
174      m=(i-1)*ij+1
175  110 w(m)=w(m)+a(i)*w(1)+c(i)*w(k4)
176      go to 305
177  300 write(ndiag,*)' hsp1d1,  n.lt.4 results incorrect '
178      call appendparm
179      stop ' Abnormal stop spl1d1 '
180  305 return
181      end
182c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Note: See TracBrowser for help on using the repository browser.