Page MenuHomeHEPForge

test_interpolate.f90
No OneTemporary

test_interpolate.f90

!-------------------------------------------------------------------
program test_interpolate
!-------------------------------------------------------------------
! This program was designed to test the subroutines interpol1D and interpol2D
! It is compiled and run using:
! gfortran -L../HiggsBounds_KW/ -I../HiggsBounds_KW/ test_interpolate.f90 -o test_interpolate.exe -lHB
! ./test_interpolate.exe 'case 1a'
! Argument picks the set of points for interpolation, labelling corresponds to notes in interpolate.f90
!-------------------------------------------------------------------
use interpolate, only : interpol1D,interpol2D
implicit none
double precision :: interpol
double precision :: x,y
double precision :: c_x(3),c_y(3),c_f(3)
character(LEN=9) :: test
integer :: i
if(IARGC().ne.1)then
stop'test_interpolate has wrong number of arguments'
endif
! Read arguments into text strings.
i=1
test=""
call GETARG(i,test)
x=2.0D0
c_x(1)=2.0D0
c_x(2)=4.0D0
c_f(1)=20.0D0
c_f(2)=40.0D0
interpol=interpol1D(x, &
& c_x(1),c_f(1), &
& c_x(2),c_f(2) )
write(*,*)'(1D) interpol =',interpol
write(*,*)'test=',test
select case(test)
case('case 1a')
x=1.0D0
y=1.0D0
c_x(1)=1.0D0
c_x(2)=1.0D0
c_x(3)=1.0D0
c_y(1)=1.0D0
c_y(2)=2.0D0
c_y(3)=3.0D0
c_f(1)=20.0D0
c_f(2)=30.0D0
c_f(3)=40.0D0
!!(2D) interpol= 20.000000000000000
case('case 1b')
x=1.0D0
y=2.0D0
c_x(1)=1.0D0
c_x(2)=1.0D0
c_x(3)=1.0D0
c_y(1)=1.0D0
c_y(2)=2.0D0
c_y(3)=3.0D0
c_f(1)=20.0D0
c_f(2)=30.0D0
c_f(3)=40.0D0
!!(2D) interpol= 30.000000000000000
case('case 1c')
x=1.0D0
y=3.0D0
c_x(1)=1.0D0
c_x(2)=1.0D0
c_x(3)=1.0D0
c_y(1)=1.0D0
c_y(2)=2.0D0
c_y(3)=3.0D0
c_f(1)=20.0D0
c_f(2)=30.0D0
c_f(3)=40.0D0
!!(2D) interpol= 40.000000000000000
case('case 1d')
x=2.0D0
y=2.0D0
c_x(1)=1.0D0
c_x(2)=1.0D0
c_x(3)=1.0D0
c_y(1)=1.0D0
c_y(2)=1.0D0
c_y(3)=1.0D0
c_f(1)=20.0D0
c_f(2)=20.0D0
c_f(3)=20.0D0
!!STOP error in function interpol2D (1d)
case('case 2ai')
x=3.0D0
y=1.0D0
c_x(1)=2.0D0
c_x(2)=2.0D0
c_x(3)=4.0D0
c_y(1)=1.0D0
c_y(2)=1.0D0
c_y(3)=1.0D0
c_f(1)=20.0D0
c_f(2)=20.0D0
c_f(3)=40.0D0
!! (2D) interpol= 30.000000000000000
case('case 2aii')
x=3.0D0
y=2.0D0
c_x(1)=2.0D0
c_x(2)=2.0D0
c_x(3)=4.0D0
c_y(1)=1.0D0
c_y(2)=1.0D0
c_y(3)=1.0D0
c_f(1)=20.0D0
c_f(2)=20.0D0
c_f(3)=40.0D0
!! STOP error in function interpol2D (2aii)
case('case 2bi')
x=3.0D0
y=1.0D0
c_x(1)=2.0D0
c_x(2)=4.0D0
c_x(3)=2.0D0
c_y(1)=1.0D0
c_y(2)=1.0D0
c_y(3)=1.0D0
c_f(1)=20.0D0
c_f(2)=40.0D0
c_f(3)=20.0D0
!! (2D) interpol= 30.000000000000000
case('case 2bii')
x=3.0D0
y=2.0D0
c_x(1)=2.0D0
c_x(2)=4.0D0
c_x(3)=2.0D0
c_y(1)=1.0D0
c_y(2)=1.0D0
c_y(3)=1.0D0
c_f(1)=20.0D0
c_f(2)=40.0D0
c_f(3)=20.0D0
!!STOP error in function interpol2D (2bii)
case('case 2ci')
x=3.0D0
y=1.0D0
c_x(1)=4.0D0
c_x(2)=2.0D0
c_x(3)=2.0D0
c_y(1)=1.0D0
c_y(2)=1.0D0
c_y(3)=1.0D0
c_f(1)=40.0D0
c_f(2)=20.0D0
c_f(3)=20.0D0
!! (2D) interpol= 30.000000000000000
case('case 2cii')
x=3.0D0
y=2.0D0
c_x(1)=4.0D0
c_x(2)=2.0D0
c_x(3)=2.0D0
c_y(1)=1.0D0
c_y(2)=1.0D0
c_y(3)=1.0D0
c_f(1)=40.0D0
c_f(2)=20.0D0
c_f(3)=20.0D0
!! STOP error in function interpol2D (2cii)
case('case 2d')
x=2.5D0
y=2.5D0
c_x(1)=2.0D0
c_x(2)=3.0D0
c_x(3)=4.0D0
c_y(1)=2.0D0
c_y(2)=3.0D0
c_y(3)=4.0D0
c_f(1)=20.0D0
c_f(2)=30.0D0
c_f(3)=40.0D0
case('case 2e')
x=2.5D0
y=3.5D0
c_x(1)=2.0D0
c_x(2)=3.0D0
c_x(3)=4.0D0
c_y(1)=2.0D0
c_y(2)=3.0D0
c_y(3)=4.0D0
c_f(1)=20.0D0
c_f(2)=30.0D0
c_f(3)=40.0D0
!! STOP error: have not implemented this bit yet (2d)
case('case 3')
x=2.5D0
y=2.5D0
c_x(1)=2.0D0
c_x(2)=3.0D0
c_x(3)=4.0D0
c_y(1)=2.0D0
c_y(2)=3.0D0
c_y(3)=2.0D0
c_f(1)=20.0D0
c_f(2)=30.0D0
c_f(3)=40.0D0
!! (2D) interpol= 25.000000000000000
case('temp')
x=3.0D0
y=4.0D0
c_x(1)=2.0D0
c_x(2)=7.0D0
c_x(3)=3.0D0
c_y(1)=1.0D0
c_y(2)=3.0D0
c_y(3)=5.0D0
c_f(1)=20.0D0
c_f(2)=30.0D0
c_f(3)=40.0D0
case default
stop'error in test_interpolate'
end select
interpol=interpol2D(x,y,c_x(1),c_y(1),c_f(1),c_x(2),c_y(2),c_f(2),c_x(3),c_y(3),c_f(3))
write(*,*)'(2D) interpol=',interpol
end program test_interpolate

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 21, 4:13 PM (21 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4007726
Default Alt Text
test_interpolate.f90 (4 KB)

Event Timeline