COSMOS v7.655  COSMOSv7655
(AirShowerMC)
k4ptdi.f
Go to the documentation of this file.
1 ! ****************************************************************
2 ! * *
3 ! * k4ptdi: 4-point two dimensional interpolation *
4 ! * *
5 ! ****************************************************************
6 !
7 ! /usage/
8 !
9 ! call
10 ! k4ptdi(f, im, jm, iadj, x0, y0, hx, hy, x, y, ans)
11 !
12 ! f is a 2-dimensional table of some function with 2 arguments.
13 ! f containes the function values at (x0,y0), (x0+hx, y0+hy),...
14 ! (x0+(im-1)*hx, y0+(jm-1)*hy).
15 ! iadj is the adjustable dimension.
16 ! ans gets the value of the funtion at (x,y)
17 !
18 !
19 !
20  subroutine k4ptdi(f, im, jm, iadj, x0, y0, hx, hy, x, y, ans)
21  implicit none
22  integer im, jm, iadj
23  real*8 f(iadj,jm), x0, y0, hx, hy, x, y, ans
24 !
25  integer i, j
26  real*8 a, b, p, q, p1, q1
27 
28  a=(x-x0)/hx
29  b=(y-y0)/hy
30  i=a
31  j=b
32  i=min(max(i,0)+1,im-1)
33  j=min(max(j,0)+1,jm-1)
34  p=a+1.-i
35  q=b+1.-j
36  p1=1.-p
37  q1=1.-q
38  ans=( f(i,j)*p1 + f(i+1,j)*p ) * q1 +
39  * ( f(i,j+1)*p1 + f(i+1,j+1)*p ) * q
40  end
subroutine k4ptdi(f, im, jm, iadj, x0, y0, hx, hy, x, y, ans)
Definition: k4ptdi.f:21