program main c*********************************************************************72 c cc TEST_INTERP_2D_PRB tests the TEST_INTERP_2D library. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 05 October 2012 c c Author: c c John Burkardt c implicit none call timestamp ( ) write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'TEST_INTERP_2D_PRB' write ( *, '(a)' ) ' FORTRAN77 version' write ( *, '(a)' ) ' Test the TEST_INTERP_2D library.' write ( *, '(a)' ) & ' The test requires access to the R8LIB library.' call test01 ( ) call test02 ( ) c c Terminate. c write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'TEST_INTERP_2D_PRB' write ( *, '(a)' ) ' Normal end of execution.' write ( *, '(a)' ) ' ' call timestamp ( ) stop end subroutine test01 ( ) c*********************************************************************72 c cc TEST01 simply prints the title of each grid and function. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 28 January 2012 c c Author: c c John Burkardt c implicit none 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 ( ) c*********************************************************************72 c cc TEST02 samples each function using each grid. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 28 January 2012 c c Author: c c John Burkardt c implicit none double precision f(100) double precision f_ave double precision f_max double precision f_min integer f_num integer fi character * ( 50 ) ft integer g_num integer gi integer gn character * ( 50 ) gt double precision gx(100) double precision gy(100) double precision r8vec_max double precision r8vec_min double precision r8vec_sum 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 ) call g00_xy ( gi, gn, gx, gy ) call f00_f0 ( fi, gn, gx, gy, f ) f_max = r8vec_max ( gn, f ) f_min = r8vec_min ( gn, f ) f_ave = r8vec_sum ( gn, f ) f_ave = f_ave / dble ( gn ) write ( *, '(2x,i4,2x,a25,2x,g14.6,2x,g14.6,2x,g14.6)' ) & gi, gt, f_min, f_ave, f_max end do end do return end function r8vec_max ( n, a ) c*********************************************************************72 c cc r8vec_max() returns the maximum value in an R8VEC. c c Discussion: c c An R8VEC is a vector of R8's. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 12 May 2014 c c Author: c c John Burkardt c c Parameters: c c Input, integer N, the number of entries in the array. c c Input, double precision A(N), the array. c c Output, double precision R8VEC_MAX, the value of the largest entry. c implicit none integer n double precision a(n) integer i double precision r8_huge parameter ( r8_huge = 1.79769313486231571D+308 ) double precision r8vec_max double precision value value = - r8_huge do i = 1, n value = max ( value, a(i) ) end do r8vec_max = value return end function r8vec_min ( n, a ) c*********************************************************************72 c cc r8vec_min() returns the minimum value in an R8VEC. c c Discussion: c c An R8VEC is a vector of R8's. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 18 January 2015 c c Author: c c John Burkardt c c Parameters: c c Input, integer N, the number of entries in the array. c c Input, double precision A(N), the array. c c Output, double precision R8VEC_MIN, the value of the smallest entry. c implicit none integer n double precision a(n) integer i double precision r8_huge parameter ( r8_huge = 1.79769313486231571D+308 ) double precision r8vec_min double precision value value = r8_huge do i = 1, n value = min ( value, a(i) ) end do r8vec_min = value return end function r8vec_sum ( n, v1 ) c*********************************************************************72 c cc r8vec_sum() sums the entries of an R8VEC. c c Discussion: c c An R8VEC is a vector of R8's. c c In FORTRAN90, the system routine SUM should be called c directly. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 22 July 2008 c c Author: c c John Burkardt c c Parameters: c c Input, integer N, the dimension of the vectors. c c Input, double precision V1(N), the vector. c c Output, double precision R8VEC_SUM, the sum of the entries. c implicit none integer n integer i double precision r8vec_sum double precision v1(n) double precision value value = 0.0D+00 do i = 1, n value = value + v1(i) end do r8vec_sum = value return end subroutine timestamp ( ) c*********************************************************************72 c cc timestamp() prints the YMDHMS date as a timestamp. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 12 June 2014 c c Author: c c John Burkardt c implicit none character * ( 8 ) ampm integer d character * ( 8 ) date integer h integer m integer mm character * ( 9 ) month(12) integer n integer s character * ( 10 ) time integer y save month data month / & 'January ', 'February ', 'March ', 'April ', & 'May ', 'June ', 'July ', 'August ', & 'September', 'October ', 'November ', 'December ' / call date_and_time ( date, time ) read ( date, '(i4,i2,i2)' ) y, m, d read ( time, '(i2,i2,i2,1x,i3)' ) h, n, s, mm if ( h .lt. 12 ) then ampm = 'AM' else if ( h .eq. 12 ) then if ( n .eq. 0 .and. s .eq. 0 ) then ampm = 'Noon' else ampm = 'PM' end if else h = h - 12 if ( h .lt. 12 ) then ampm = 'PM' else if ( h .eq. 12 ) then if ( n .eq. 0 .and. s .eq. 0 ) then ampm = 'Midnight' else ampm = 'AM' end if end if end if write ( *, & '(i2,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