V3FIT
r8vecpc2.f
1  subroutine r8vecpc2(ict,ivec,xvec,yvec,ivd,fval,
2  > nx,xpkg,ny,ypkg,fspl,inf1,
3  > iwarn,ier)
4 c
5 c vectorized piecewise linear evaluation routine -- 2d
6 c 1. call vectorized zone lookup routine
7 c 2. call vectorized piecewise linear 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(4) ! 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/dxdy (don't evaluate if ict(4)=0)
22 c
23 c note -- derivatives are *not* continuous!
24 c
25  integer ivec ! vector dimensioning
26 c
27 c ivec-- number of vector pts (piecewise linear 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 axis 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 inf1 ! fspl 3rd array dimension, .ge.nx
50  real*8 fspl(inf1,ny) ! Piecewise Linear function
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(ivec.le.0) then
77  write(6,*) .le.' ?vecpc2: vector dimension 0: ivec = ',
78  > ivec
79  ier=1
80  endif
81 c
82  if(ivd.lt.ivec) then
83  write(6,*)
84  > ' ?vecpc2: output vector dimension less than input ',
85  > 'vector dimension.'
86  write(6,*) ' ivec=',ivec,' ivd=',ivd
87  ier=1
88  endif
89 c
90  if(ier.ne.0) return
91 c
92 c vectorized lookup
93 c
94  ix=0
95  iy=0
96  call r8xlookup(ivec,xvec,nx,xpkg,2,ix,dxn,hx,hxi,iwarn1)
97  call r8xlookup(ivec,yvec,ny,ypkg,2,iy,dyn,hy,hyi,iwarn2)
98  iwarn=iwarn1+iwarn2
99 c
100 c vectorized evaluation
101 c
102  call r8pc2fcn(ict,ivec,ivd,fval,ix,iy,dxn,dyn,
103  > hx,hxi,hy,hyi,fspl,inf1,ny)
104 c
105  return
106  end