V3FIT
mkherm2.f
1  subroutine mkherm2(fun,x,nx,y,ny,fherm)
2 C
3 C create a data set for Hermite interpolation, from evaluation of
4 C function and derivatives. function of 2 indep. coordinates.
5 C
6 C input:
7 C
8  external fun ! passed real function(x,y)
9  real x(nx) ! x coordinate array
10  real y(ny) ! y coordinate array
11 C
12 C the passed function fun must have the interface:
13 C
14 C real function <name>(x,y,dfdx,dfdy,d2fdxdy)
15 C where x,y are input, the function returns the function value,
16 C and the arguments dfdx and dfdy return as output the function
17 C derivative at the point (x,y).
18 C
19 C output:
20 C
21  real fherm(0:3,nx,ny) ! function data & derivatives
22 C
23 C fherm(0,i,j) = function value f at x(i),y(j)
24 C fherm(1,i,j) = derivative df/dx at x(i),y(j)
25 C fherm(2,i,j) = derivative df/dy at x(i),y(j)
26 C fherm(3,i,j) = derivative d2f/dxdy at x(i),y(j)
27 C
28 C----------------------------
29 C
30  do ix=1,nx
31  do iy=1,ny
32  fherm(0,ix,iy)=fun(x(ix),y(iy),dfdx,dfdy,d2fdxdy)
33  fherm(1,ix,iy)=dfdx
34  fherm(2,ix,iy)=dfdy
35  fherm(3,ix,iy)=d2fdxdy
36  enddo
37  enddo
38 C
39  return
40  end