[go: up one dir, main page]

Menu

[r34]: / common / sp2.f90  Maximize  Restore  History

Download this file

51 lines (43 with data), 1.6 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
! sp2 Geoff's brain production
! Copyright (C) 1999,2010 Gauthier Delerce
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
! the Free Software Foundation; either version 2, or (at your option)
! any later version.
!
! This program is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with this program; if not, write to the Free Software Foundation,
! Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
!
! Gauthier Delerce <gauthier@delerce.fr>
!*-------------------------------------------------------------------------
!* SP2 - solve for U at XI,YI given spline coefficients in S & T
!* from SP1. X and Y are coordinate arrays same as those sent to SP1.
!*-------------------------------------------------------------------------
subroutine sp2(xi,yi,x,y,n,s,t,u)
implicit real(8) (a-g,o-z)
real x(n),y(n),xi,yi,u
real(8) s(n),t(3)
u=0.
!*------------ interpolate at Xi,Yi from S(N) coefficients ---------------
do k=1,n
dx=dble(xi-x(k))
dy=dble(yi-y(k))
tt=dx*dx+dy*dy
if (tt.ne.0.d0) then
dltt=dlog(tt)
dxtt=dx*(dltt+1.d0)
dytt=dy*(dltt+1.d0)
u=u+sngl(s(k)*tt*dltt)
endif
end do
!*----------------- add the contribution from the Ts ----------------------
u=u+sngl(t(1)*xi+t(2)*yi+t(3))
return
end