V3FIT
dnherm1.f
1  subroutine dnherm1(x,nx,fherm,ilinx,ier)
2 C
3 C create a data set for Hermite interpolation, based on simple
4 C numerical differentiation using the given grid.
5 C
6 C 1d routine
7 C
8 C input:
9 C
10  integer nx ! array dimensions
11  real x(nx) ! x coordinate array
12  real fherm(0:1,nx) ! data/Hermite array
13 C
14 C fherm(0,i) = function value f at x(i) **on input**
15 C
16 C fherm(1,i) = derivative df/dx at x(i) **on output**
17 C
18 C addl output:
19 C ilinx=1 if x is "evenly spaced" ier=0 if no errors
20 C
21 C ** x must be strict ascending **
22 C
23 C----------------------------
24 C
25  ztol=1.0e-3
26  call splinck(x,nx,ilinx,ztol,ier)
27  if(ier.ne.0) then
28  write(6,*) '?dnherm1: x axis not strict ascending.'
29  return
30  endif
31 C
32  do ix=1,nx
33 c
34 c x div. diffs in vicinity
35 c
36  ixp=min(nx,ix+1)
37  ixm=max(1,ix-1)
38  zd=(fherm(0,ixp)-fherm(0,ixm))/(x(ixp)-x(ixm))
39 c
40  fherm(1,ix)=zd
41  enddo
42 C
43  return
44  end