V3FIT
All Classes Namespaces Files Functions Variables Enumerations Macros Pages
vecherm3.f
1  subroutine vecherm3(ict,ivec,xvec,yvec,zvec,ivd,fval,
2  > nx,xpkg,ny,ypkg,nz,zpkg,fspl,inf2,inf3,
3  > iwarn,ier)
4 c
5 c vectorized hermite evaluation routine --
6 c 1. call vectorized zone lookup routine
7 c 2. call vectorized hermite evaluation routine
8 c
9 c--------------------------
10 c input:
11  integer ict(10) ! selector:
12 c ict(1)=1 for f (don't evaluate if ict(1)=0)
13 c ict(2)=1 for df/dx (don't evaluate if ict(2)=0)
14 c ict(3)=1 for df/dy (don't evaluate if ict(3)=0)
15 c ict(4)=1 for df/dy (don't evaluate if ict(4)=0)
16 c ict(5)=1 for d2f/dxdy (don't evaluate if ict(5)=0)
17 c ict(6)=1 for d2f/dxdz (don't evaluate if ict(6)=0)
18 c ict(7)=1 for d2f/dydz (don't evaluate if ict(7)=0)
19 c ict(8)=1 for d3f/dxdydz (don't evaluate if ict(8)=0)
20 c
21  integer ivec ! vector dimensioning
22 c
23 c ivec-- number of vector pts (hermite values to look up)
24 c
25 c list of (x,y,z) triples:
26 c
27  real xvec(ivec) ! x-locations at which to evaluate
28  real yvec(ivec) ! y-locations at which to evaluate
29  real zvec(ivec) ! z-locations at which to evaluate
30 c
31  integer ivd ! 1st dimension of output array
32 c
33 c ivd -- 1st dimension of fval, .ge.ivec
34 c
35 c output:
36  real fval(ivd,*) ! output array
37 c
38 c fval(1:ivec,1) -- values as per 1st non-zero ict(...) element
39 c fval(1:ivec,2) -- values as per 2nd non-zero ict(...) element
40 c --etc--
41 c
42 c input:
43  integer nx,ny,nz ! dimension of hermite grids
44  real xpkg(nx,4) ! x grid "package" (cf genxpkg)
45  real ypkg(ny,4) ! y grid "package" (cf genxpkg)
46  real zpkg(nz,4) ! z grid "package" (cf genxpkg)
47  integer inf2 ! fspl 4th array dimension, .ge.nx
48  integer inf3 ! fspl 5th array dimension, .ge.ny
49  real fspl(0:7,inf2,inf3,nz) ! Hermite coefficients cf herm3ev
50 c
51 c output:
52 c condition codes, 0 = normal return
53  integer iwarn ! =1 if an x value was out of range
54  integer ier ! =1 if argument error detected
55 c
56 c---------------------------------------------------------------
57 c local arrays
58 c
59  integer, dimension(:), allocatable :: ix,iy,iz
60  real, dimension(:), allocatable :: dxn,dyn,dzn
61  real, dimension(:), allocatable :: hx,hxi,hy,hyi,hz,hzi
62 c
63 c---------------------------------------------------------------
64 c
65 c error checks
66 c
67  ier=0
68 c
69  if(nx.lt.2) then
70  write(6,*) .lt.' ?vecherm3: nx2: nx = ',nx
71  ier=1
72  endif
73 c
74  if(ny.lt.2) then
75  write(6,*) .lt.' ?vecherm3: ny2: ny = ',ny
76  ier=1
77  endif
78 c
79  if(nz.lt.2) then
80  write(6,*) .lt.' ?vecherm3: nz2: nz = ',nz
81  ier=1
82  endif
83 c
84  if(ivec.le.0) then
85  write(6,*) .le.' ?vecherm3: vector dimension 0: ivec = ',
86  > ivec
87  ier=1
88  endif
89 c
90  if(ivd.lt.ivec) then
91  write(6,*)
92  > ' ?vecherm3: output vector dimension less than input ',
93  > 'vector dimension.'
94  write(6,*) ' ivec=',ivec,' ivd=',ivd
95  ier=1
96  endif
97 c
98  if(ier.ne.0) return
99 c
100  allocate(ix(ivec), iy(ivec), iz(ivec),
101  > dxn(ivec), dyn(ivec), dzn(ivec),
102  > hx(ivec), hy(ivec), hz(ivec),
103  > hxi(ivec), hyi(ivec), hzi(ivec), stat=ier)
104 c
105  if(ier.ne.0) then
106  write(6,*)
107  > ' ?vecherm3: memory allocation failure.'
108  ier=99
109  endif
110 c
111  if(ier.ne.0) return
112 c
113 c vectorized lookup
114 c
115  ix=0; iy=0; iz=0
116  call xlookup(ivec,xvec,nx,xpkg,2,ix,dxn,hx,hxi,iwarn1)
117  call xlookup(ivec,yvec,ny,ypkg,2,iy,dyn,hy,hyi,iwarn2)
118  call xlookup(ivec,zvec,nz,zpkg,2,iz,dzn,hz,hzi,iwarn3)
119  iwarn=max(iwarn1,iwarn2,iwarn3)
120 c
121 c vectorized evaluation
122 c
123  call herm3fcn(ict,ivec,ivd,fval,ix,iy,iz,dxn,dyn,dzn,
124  > hx,hxi,hy,hyi,hz,hzi,fspl,inf2,inf3,nz)
125 c
126  deallocate(ix,iy,iz,dxn,dyn,dzn,hx,hy,hz,hxi,hyi,hzi)
127 c
128  return
129  end