Blame view

fvn_test/test_akima.f90 1.19 KB
27d3b84d6   daniau   git-svn-id: https...
1
  program akima
2919a9e2d   daniau   git-svn-id: https...
2
   use fvn_interpol
f6bacaf83   cwaterkeyn   ChW 11/09: ANSI c...
3
  use Kind_Definition
27d3b84d6   daniau   git-svn-id: https...
4
5
   implicit none
   integer :: nbpoints,nppoints,i
f6bacaf83   cwaterkeyn   ChW 11/09: ANSI c...
6
7
8
   real(kind=dp_kind),dimension(:),allocatable :: x_d,y_d,breakpoints_d
   real(kind=dp_kind),dimension(:,:),allocatable :: coeff_fvn_d
   real(kind=dp_kind) :: xstep_d,xp_d,ty_d,fvn_y_d
27d3b84d6   daniau   git-svn-id: https...
9
10
11
12
13
14
15
   open(2,file='fvn_akima_double.dat')
   open(3,file='fvn_akima_breakpoints_double.dat')
   nbpoints=30
   allocate(x_d(nbpoints))
   allocate(y_d(nbpoints))
   allocate(breakpoints_d(nbpoints))
   allocate(coeff_fvn_d(4,nbpoints))
f6bacaf83   cwaterkeyn   ChW 11/09: ANSI c...
16
   xstep_d=20./real(nbpoints,dp_kind)
27d3b84d6   daniau   git-svn-id: https...
17
   do i=1,nbpoints
f6bacaf83   cwaterkeyn   ChW 11/09: ANSI c...
18
      x_d(i)=-10.+real(i,dp_kind)*xstep_d
27d3b84d6   daniau   git-svn-id: https...
19
20
21
22
23
24
      y_d(i)=dsin(x_d(i))
      write(3,44) x_d(i),y_d(i)
   end do
   close(3)
   call fvn_akima(nbpoints,x_d,y_d,breakpoints_d,coeff_fvn_d)
   nppoints=1000
f6bacaf83   cwaterkeyn   ChW 11/09: ANSI c...
25
   xstep_d=22./real(nppoints,dp_kind)
27d3b84d6   daniau   git-svn-id: https...
26
   do i=1,nppoints
f6bacaf83   cwaterkeyn   ChW 11/09: ANSI c...
27
      xp_d=-11.+real(i,dp_kind)*xstep_d
27d3b84d6   daniau   git-svn-id: https...
28
29
30
31
32
33
      ty_d=dsin(xp_d)
      fvn_y_d=fvn_spline_eval(xp_d,nbpoints-1,breakpoints_d,coeff_fvn_d)
      write(2,44) xp_d,ty_d,fvn_y_d
   end do
   close(2)
  deallocate(coeff_fvn_d,breakpoints_d,y_d,x_d)
59ae88e06   daniau   git-svn-id: https...
34
35
  write(6,*) "All done, plot results with gnuplot using command :"
  write(6,*) "pl 'fvn_akima_double.dat' u 1:2 w l,'fvn_akima_breakpoints_double.dat' w p"
27d3b84d6   daniau   git-svn-id: https...
36
37
38
  
  44       FORMAT(4(1X,1PE22.14))
  end program