program main !*****************************************************************************80 ! !! test_interp_2d_test() tests test_interp_2d(). ! ! Licensing: ! ! This code is distributed under the MIT license. ! ! Modified: ! ! 27 January 2012 ! ! Author: ! ! John Burkardt ! implicit none call timestamp ( ) write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test_interp_2d_test():' write ( *, '(a)' ) ' FORTRAN90 version' write ( *, '(a)' ) ' Test the TEST_INTERP_2D library.' write ( *, '(a)' ) ' The test requires access to the R8LIB library.' call test01 ( ) call test02 ( ) ! ! Terminate. ! write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'TEST_INTERP_2D_TEST' write ( *, '(a)' ) ' Normal end of execution.' write ( *, '(a)' ) ' ' call timestamp ( ) stop 0 end subroutine test01 ( ) !*****************************************************************************80 ! !! TEST01 simply prints the title of each grid and function. ! ! Licensing: ! ! This code is distributed under the MIT license. ! ! Modified: ! ! 27 January 2012 ! ! Author: ! ! John Burkardt ! implicit none integer, parameter :: rk = kind ( 1.0D+00 ) integer f_num integer fi character ( len = 50 ) ft integer g_num integer gi character ( len = 50 ) gt write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'TEST01' write ( *, '(a)' ) ' For each grid and function, print the title.' call g00_num ( g_num ) write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' GRIDS:' write ( *, '(a)' ) ' Index Title' write ( *, '(a)' ) ' ' do gi = 1, g_num call g00_title ( gi, gt ) write ( *, '(2x,i2,2x,a)' ) gi, gt end do call f00_num ( f_num ) write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' FUNCTIONS:' write ( *, '(a)' ) ' Index Title' write ( *, '(a)' ) ' ' do fi = 1, f_num call f00_title ( fi, ft ) write ( *, '(2x,i2,2x,a)' ) fi, ft end do return end subroutine test02 ( ) !*****************************************************************************80 ! !! TEST02 samples each function using each grid. ! ! Licensing: ! ! This code is distributed under the MIT license. ! ! Modified: ! ! 28 January 2012 ! ! Author: ! ! John Burkardt ! implicit none integer, parameter :: rk = kind ( 1.0D+00 ) real ( kind = rk ), allocatable :: f(:) real ( kind = rk ) f_ave real ( kind = rk ) f_max real ( kind = rk ) f_min integer f_num integer fi character ( len = 50 ) ft integer g_num integer gi integer gn character ( len = 50 ) gt real ( kind = rk ), allocatable :: gx(:) real ( kind = rk ), allocatable :: gy(:) write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'TEST02' write ( *, '(a)' ) ' Sample each function over each grid.' call g00_num ( g_num ) call f00_num ( f_num ) do fi = 1, f_num call f00_title ( fi, ft ) write ( *, '(a)' ) ' ' write ( *, '(2x,i2,2x,a)' ) fi, trim ( ft ) write ( *, '(a)' ) ' Grid Title Min(F)' // & ' Ave(F) Max(F)' write ( *, '(a)' ) ' ' do gi = 1, g_num call g00_title ( gi, gt ) call g00_size ( gi, gn ) allocate ( gx(1:gn) ) allocate ( gy(1:gn) ) allocate ( f(1:gn) ) call g00_xy ( gi, gn, gx, gy ) call f00_f0 ( fi, gn, gx, gy, f ) f_max = maxval ( f(1:gn) ) f_min = minval ( f(1:gn) ) f_ave = sum ( f(1:gn) ) / real ( gn, kind = rk ) write ( *, '(2x,i4,2x,a25,2x,g14.6,2x,g14.6,2x,g14.6)' ) & gi, gt, f_min, f_ave, f_max deallocate ( f ) deallocate ( gx ) deallocate ( gy ) end do end do return end subroutine timestamp ( ) !*****************************************************************************80 ! !! timestamp() prints the current YMDHMS date as a time stamp. ! ! Example: ! ! 31 May 2001 9:45:54.872 AM ! ! Licensing: ! ! This code is distributed under the MIT license. ! ! Modified: ! ! 15 August 2021 ! ! Author: ! ! John Burkardt ! implicit none character ( len = 8 ) ampm integer d integer h integer m integer mm character ( len = 9 ), parameter, dimension(12) :: month = (/ & 'January ', 'February ', 'March ', 'April ', & 'May ', 'June ', 'July ', 'August ', & 'September', 'October ', 'November ', 'December ' /) integer n integer s integer values(8) integer y call date_and_time ( values = values ) y = values(1) m = values(2) d = values(3) h = values(5) n = values(6) s = values(7) mm = values(8) if ( h < 12 ) then ampm = 'AM' else if ( h == 12 ) then if ( n == 0 .and. s == 0 ) then ampm = 'Noon' else ampm = 'PM' end if else h = h - 12 if ( h < 12 ) then ampm = 'PM' else if ( h == 12 ) then if ( n == 0 .and. s == 0 ) then ampm = 'Midnight' else ampm = 'AM' end if end if end if write ( *, '(i2.2,1x,a,1x,i4,2x,i2,a1,i2.2,a1,i2.2,a1,i3.3,1x,a)' ) & d, trim ( month(m) ), y, h, ':', n, ':', s, '.', mm, trim ( ampm ) return end