V3FIT
splinck.f
1  subroutine splinck(x,inx,ilinx,ztol,ier)
2 C
3 C check if a grid is strictly ascending and if it is evenly spaced
4 C to w/in ztol
5 C
6  real x(inx) ! input -- grid to check
7 C
8  integer ilinx ! output -- =1 if evenly spaced =2 O.W.
9 C
10  real ztol ! input -- spacing check tolerance
11 C
12  integer ier ! output -- =0 if OK
13 C
14 C ier=1 is returned if x(1...inx) is NOT STRICTLY ASCENDING...
15 C
16 C-------------------------------
17 C
18  ier=0
19  ilinx=1
20  if(inx.le.1) return
21 c
22  dxavg=(x(inx)-x(1))/(inx-1)
23  zeps=abs(ztol*dxavg)
24 c
25  do ix=2,inx
26  zdiffx=(x(ix)-x(ix-1))
27  if(zdiffx.le.0.0) ier=2
28  zdiff=zdiffx-dxavg
29  if(abs(zdiff).gt.zeps) then
30  ilinx=2
31  endif
32  enddo
33  10 continue
34 c
35  return
36  end