Debian Codegraph @

packages/seacas/applications/gen3d/g3_spline.f

raw
1 C Copyright(C) 1999-2020 National Technology & Engineering Solutions
2 C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
3 C NTESS, the U.S. Government retains certain rights in this software.
4 C
5 C See packages/seacas/LICENSE for details
6
7 SUBROUTINE SPLINE(X,Y,N,YP1,YPN,Y2, U)
8 DIMENSION X(N),Y(N),Y2(N),U(N)
9 IF (YP1.GT..99E30) THEN
10 Y2(1)=0.
11 U(1)=0.
12 ELSE
13 Y2(1)=-0.5
14 U(1)=(3./(X(2)-X(1)))*((Y(2)-Y(1))/(X(2)-X(1))-YP1)
15 ENDIF
16 DO 11 I=2,N-1
17 SIG=(X(I)-X(I-1))/(X(I+1)-X(I-1))
18 P=SIG*Y2(I-1)+2.
19 Y2(I)=(SIG-1.)/P
20 U(I)=(6.*((Y(I+1)-Y(I))/(X(I+1)-X(I))-(Y(I)-Y(I-1))
21 * /(X(I)-X(I-1)))/(X(I+1)-X(I-1))-SIG*U(I-1))/P
22 11 CONTINUE
23 IF (YPN.GT..99E30) THEN
24 QN=0.
25 UN=0.
26 ELSE
27 QN=0.5
28 UN=(3./(X(N)-X(N-1)))*(YPN-(Y(N)-Y(N-1))/(X(N)-X(N-1)))
29 ENDIF
30 Y2(N)=(UN-QN*U(N-1))/(QN*Y2(N-1)+1.)
31 DO 12 K=N-1,1,-1
32 Y2(K)=Y2(K)*Y2(K+1)+U(K)
33 12 CONTINUE
34 RETURN
35 END