# include # include # include # include # include "biharmonic_exact.h" int main ( ); void timestamp ( ); /******************************************************************************/ int main ( ) /******************************************************************************/ /* Purpose: biharmonic_exact_test() tests biharmonic_exact(). Licensing: This code is distributed under the MIT license. Modified: 02 August 2024 Author: John Burkardt */ { double a; double b; double c; double d; double e; double f; double g; int i; int n = 5; double r; double x; double y; timestamp ( ); printf ( "\n" ); printf ( "biharmonic_exact_test():\n" ); printf ( " C version\n" ); printf ( " Test biharmonic_exact().\n" ); a = 1.0; b = 2.0; c = 3.0; d = 4.0; e = 5.0; f = 6.0; g = 7.0; /* Exact function 1. */ printf ( "\n" ); printf ( " Exact solution 1 residual at random points:\n" ); for ( i = 0; i < n; i++ ) { x = drand48 ( ); y = drand48 ( ); r = biharmonic_exact_r1 ( x, y, a, b, c, d, e, f, g ); printf ( " %2d %10.4f %10.4f %14.6g\n", i, x, y, r ); } /* Exact function 2. */ printf ( "\n" ); printf ( " Exact solution 2 residual at random points:\n" ); for ( i = 0; i < n; i++ ) { x = drand48 ( ); y = drand48 ( ); r = biharmonic_exact_r2 ( x, y, a, b, c, d, e, f, g ); printf ( " %2d %10.4f %10.4f %14.6g\n", i, x, y, r ); } /* Exact function 3. */ printf ( "\n" ); printf ( " Exact solution 3 residual at random points:\n" ); for ( i = 0; i < n; i++ ) { x = drand48 ( ); y = drand48 ( ); r = biharmonic_exact_r3 ( x, y, a, b, c, d, e, f ); printf ( " %2d %10.4f %10.4f %14.6g\n", i, x, y, r ); } /* Terminate. */ printf ( "\n" ); printf ( "biharmonic_exact_test():\n" ); printf ( " Normal end of execution.\n" ); printf ( "\n" ); timestamp ( ); return 0; } /******************************************************************************/ void timestamp ( ) /******************************************************************************/ /* Purpose: timestamp() prints the current YMDHMS date as a time stamp. Example: 31 May 2001 09:45:54 AM Licensing: This code is distributed under the MIT license. Modified: 24 September 2003 Author: John Burkardt */ { # define TIME_SIZE 40 static char time_buffer[TIME_SIZE]; const struct tm *tm; time_t now; now = time ( NULL ); tm = localtime ( &now ); strftime ( time_buffer, TIME_SIZE, "%d %B %Y %I:%M:%S %p", tm ); fprintf ( stdout, "%s\n", time_buffer ); return; # undef TIME_SIZE }