Debian Codegraph @

packages/seacas/applications/grepos/gp_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 C=======================================================================
8 SUBROUTINE SPLINE(X,Y,N,YP1,YPN,Y2)
9 C=======================================================================
10 PARAMETER (NMAX=100)
11 DIMENSION X(N),Y(N),Y2(N),U(NMAX)
12 IF (YP1.GT..99E30) THEN
13 Y2(1)=0.
14 U(1)=0.
15 ELSE
16 Y2(1)=-0.5
17 U(1)=(3./(X(2)-X(1)))*((Y(2)-Y(1))/(X(2)-X(1))-YP1)
18 ENDIF
19 DO 11 I=2,N-1
20 SIG=(X(I)-X(I-1))/(X(I+1)-X(I-1))
21 P=SIG*Y2(I-1)+2.
22 Y2(I)=(SIG-1.)/P
23 U(I)=(6.*((Y(I+1)-Y(I))/(X(I+1)-X(I))-(Y(I)-Y(I-1))
24 * /(X(I)-X(I-1)))/(X(I+1)-X(I-1))-SIG*U(I-1))/P
25 11 CONTINUE
26 IF (YPN.GT..99E30) THEN
27 QN=0.
28 UN=0.
29 ELSE
30 QN=0.5
31 UN=(3./(X(N)-X(N-1)))*(YPN-(Y(N)-Y(N-1))/(X(N)-X(N-1)))
32 ENDIF
33 Y2(N)=(UN-QN*U(N-1))/(QN*Y2(N-1)+1.)
34 DO 12 K=N-1,1,-1
35 Y2(K)=Y2(K)*Y2(K+1)+U(K)
36 12 CONTINUE
37 RETURN
38 END