V3FIT
vecin3d_argchk.f
1 c---------------------------------------------------------
2 c error check routine for 2d hybrid interpolation
3 c
4  subroutine vecin3d_argchk(subname,jspline,
5  > icoeff,nx,ny,nz,ixdim,iydim,izdim,ier)
6 
7  implicit NONE
8 
9  character*(*), intent(in) :: subname ! name of caller, for messages
10  integer, intent(in) :: jspline(3) ! interp. type, by dimension
11  integer, intent(in) :: icoeff ! coeffs per data point
12  integer, intent(in) :: nx,ny,nz ! grid sizes
13  integer, intent(in) :: ixdim,iydim,izdim ! coeff array dimensions
14 
15  integer, intent(out) :: ier ! status coder (0=OK)
16 
17  !----------------------------------------
18  ! local
19  integer :: i,itest,jcoeff,ipcub
20  !----------------------------------------
21 
22  ier=0
23 
24  jcoeff=1
25  ipcub=-99
26 
27  do i=1,3
28  if((jspline(i).lt.-1).or.(jspline(i).gt.2)) then
29  write(6,*) ' ?'//trim(subname)//
30  > ': jspline(',i,')=',jspline(i)
31  write(6,*) ' not in expected range -1:2.'
32  ier=1
33 
34  else if(jspline(i).ge.1) then
35  jcoeff=jcoeff*2
36  if(ipcub.eq.-99) then
37  ipcub=jspline(i)
38  else
39  if(ipcub.ne.jspline(i)) then
40  write(6,*) ' ?'//trim(subname)//
41  > ': more than one cubic method: jspline=',jspline
42  endif
43  endif
44 
45  endif
46  enddo
47 
48  if(ier.eq.0) then
49  if(jcoeff.ne.icoeff) then
50  write(6,*) ' ?'//trim(subname)//
51  > ': incorrect #coefficients per data point.'
52  write(6,*) ' expected: ',jcoeff,' received: ',icoeff
53  write(6,*) ' jspline: ',jspline
54  ier=1
55  endif
56 
57  itest=nx
58  if(jspline(1).eq.-1) itest=nx-1
59  if(ixdim.ne.itest) then
60  write(6,*) ' ?'//trim(subname)//': ixdim dimension error:'
61  write(6,*) ' nx=',nx,' ixdim=',ixdim,' expected: ',itest
62  write(6,*) ' jspline(1)=',jspline(1),'; -1 for zonal.'
63  ier=1
64  endif
65 
66  itest=ny
67  if(jspline(2).eq.-1) itest=ny-1
68  if(iydim.ne.itest) then
69  write(6,*) ' ?'//trim(subname)//': iydim dimension error:'
70  write(6,*) ' ny=',ny,' iydim=',iydim,' expected: ',itest
71  write(6,*) ' jspline(2)=',jspline(2),'; -1 for zonal.'
72  ier=1
73  endif
74 
75  itest=nz
76  if(jspline(1).eq.-1) itest=nz-1
77  if(izdim.ne.itest) then
78  write(6,*) ' ?'//trim(subname)//': izdim dimension error:'
79  write(6,*) ' nz=',nz,' izdim=',izdim,' expected: ',itest
80  write(6,*) ' jspline(3)=',jspline(3),'; -1 for zonal.'
81  ier=1
82  endif
83 
84  endif
85 
86  return
87  end