# include # include # include # include # include using namespace std; # include "biharmonic_exact.hpp" int main ( ); void timestamp ( ); //****************************************************************************80 int main ( ) //****************************************************************************80 // // 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 ( ); cout << "\n"; cout << "biharmonic_exact_test():\n"; cout << " C++ version\n"; cout << " 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. // cout << "\n"; cout << " 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 ); cout << " " << setw(2) << i << " " << setw(10) << x << " " << setw(10) << y << " " << setw(14) << r << "\n"; } // // Exact function 2. // cout << "\n"; cout << " 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 ); cout << " " << setw(2) << i << " " << setw(10) << x << " " << setw(10) << y << " " << setw(14) << r << "\n"; } // // Exact function 3. // cout << "\n"; cout << " 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 ); cout << " " << setw(2) << i << " " << setw(10) << x << " " << setw(10) << y << " " << setw(14) << r << "\n"; } // // Terminate. // cout << "\n"; cout << "biharmonic_exact_test():\n"; cout << " Normal end of execution.\n"; cout << "\n"; timestamp ( ); return 0; } //****************************************************************************80 void timestamp ( ) //****************************************************************************80 // // 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: // // 19 March 2018 // // Author: // // John Burkardt // { # define TIME_SIZE 40 static char time_buffer[TIME_SIZE]; const struct std::tm *tm_ptr; std::time_t now; now = std::time ( NULL ); tm_ptr = std::localtime ( &now ); std::strftime ( time_buffer, TIME_SIZE, "%d %B %Y %I:%M:%S %p", tm_ptr ); std::cout << time_buffer << "\n"; return; # undef TIME_SIZE }