V3FIT
r8vecbicub.f
1  subroutine r8vecbicub(ict,ivec,xvec,yvec,ivd,fval,
2  > nx,xpkg,ny,ypkg,fspl,inf2,
3  > iwarn,ier)
4 c
5 c vectorized spline evaluation routine -- 2d *compact* spline
6 c 1. call vectorized zone lookup routine
7 c 2. call vectorized spline evaluation routine
8 c
9 c--------------------------
10 c input:
11 !============
12 ! idecl: explicitize implicit INTEGER declarations:
13  IMPLICIT NONE
14  INTEGER, PARAMETER :: R8=selected_real_kind(12,100)
15  INTEGER iwarn1,iwarn2
16 !============
17  integer ict(6) ! selector:
18 c ict(1)=1 for f (don't evaluate if ict(1)=0)
19 c ict(2)=1 for df/dx (don't evaluate if ict(2)=0)
20 c ict(3)=1 for df/dy (don't evaluate if ict(3)=0)
21 c ict(4)=1 for d2f/dx2 (don't evaluate if ict(4)=0)
22 c ict(5)=1 for d2f/dy2 (don't evaluate if ict(5)=0)
23 c ict(6)=1 for d2f/dxdy (don't evaluate if ict(6)=0)
24 c
25  integer ivec ! vector dimensioning
26 c
27 c ivec-- number of vector pts (spline values to look up)
28 c
29 c list of (x,y) pairs:
30 c
31  real*8 xvec(ivec) ! x-locations at which to evaluate
32  real*8 yvec(ivec) ! y-locations at which to evaluate
33 c
34  integer ivd ! 1st dimension of output array
35 c
36 c ivd -- 1st dimension of fval, .ge.ivec
37 c
38 c output:
39  real*8 fval(ivd,*) ! output array
40 c
41 c fval(1:ivec,1) -- values as per 1st non-zero ict(...) element
42 c fval(1:ivec,2) -- values as per 2nd non-zero ict(...) element
43 c --etc--
44 c
45 c input:
46  integer nx,ny ! dimension of spline grids
47  REAL*8 xpkg(nx,4) ! x grid "package" (cf genxpkg)
48  real*8 ypkg(ny,4) ! y grid "package" (cf genxpkg)
49  integer inf2 ! fspl 3rd array dimension, .ge.nx
50  real*8 fspl(0:3,inf2,ny) ! (compact) spline coefficients
51 c
52 c output:
53 c condition codes, 0 = normal return
54  integer iwarn ! =1 if an x value was out of range
55  integer ier ! =1 if argument error detected
56 c
57 c---------------------------------------------------------------
58 c local arrays
59 c
60  integer ix(ivec) ! zone indices {j}
61  REAL*8 dxn(ivec) ! normalized displacements w/in zones
62  real*8 hx(ivec) ! h(j) vector
63  real*8 hxi(ivec) ! 1/h(j) vector
64 c
65  integer iy(ivec) ! zone indices {j}
66  REAL*8 dyn(ivec) ! normalized displacements w/in zones
67  real*8 hy(ivec) ! h(j) vector
68  real*8 hyi(ivec) ! 1/h(j) vector
69 c
70 c---------------------------------------------------------------
71 c
72 c error checks
73 c
74  ier=0
75 c
76  if(nx.lt.2) then
77  write(6,*) .lt.' ?vecbicub: nx2: nx = ',nx
78  ier=1
79  endif
80 c
81  if(ny.lt.2) then
82  write(6,*) .lt.' ?vecbicub: ny2: ny = ',ny
83  ier=1
84  endif
85 c
86  if(ivec.le.0) then
87  write(6,*) .le.' ?vecbicub: vector dimension 0: ivec = ',
88  > ivec
89  ier=1
90  endif
91 c
92  if(ivd.lt.ivec) then
93  write(6,*)
94  > ' ?vecbicub: output vector dimension less than input ',
95  > 'vector dimension.'
96  write(6,*) ' ivec=',ivec,' ivd=',ivd
97  ier=1
98  endif
99 c
100  if(ier.ne.0) return
101 c
102 c vectorized lookup
103 c
104  ix=0
105  iy=0
106  call r8xlookup(ivec,xvec,nx,xpkg,2,ix,dxn,hx,hxi,iwarn1)
107  call r8xlookup(ivec,yvec,ny,ypkg,2,iy,dyn,hy,hyi,iwarn2)
108  iwarn=iwarn1+iwarn2
109 c
110 c vectorized evaluation
111 c
112  call r8fvbicub(ict,ivec,ivd,fval,ix,iy,dxn,dyn,
113  > hx,hxi,hy,hyi,fspl,inf2,ny)
114 c
115  return
116  end