# include # include # include # include # include # include # include using namespace std; int main ( ); double *r8vec_linspace_new ( int n, double a, double b ); void timestamp ( ); //****************************************************************************80 int main ( ) //****************************************************************************80 // // Purpose: // // orbital_fill_contour() creates a color contour plot of orbital data. // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 03 April 2025 // // Author: // // John Burkardt // { string command_filename; ofstream command_unit; timestamp ( ); cout << "\n"; cout << "orbital_fill_contour():\n"; cout << " C version\n"; cout << " Color contour plot of orbital data using gnuplot().\n"; command_filename = "orbital_fill_contour_commands.txt"; command_unit.open ( command_filename.c_str ( ) ); command_unit << "# orbital_fill_contour_commands.txt\n"; command_unit << "#\n"; command_unit << "# Usage:\n"; command_unit << "# gnuplot < orbital_fill_contour_commands.txt\n"; command_unit << "#\n"; command_unit << "set term png\n"; command_unit << "set output 'orbital_fill_contour.png'\n"; command_unit << "set xlabel '<--- X --->'\n"; command_unit << "set ylabel '<--- Y --->'\n"; command_unit << "set title 'Orbital Data'\n"; command_unit << "set grid\n"; command_unit << "unset surface\n"; command_unit << "set contour base\n"; command_unit << "set view map\n"; command_unit << "set pm3d\n"; command_unit << "set style data lines\n"; command_unit << "splot 'orbital_gnuplot_data.txt' with pm3d\n"; command_unit << "quit\n"; command_unit.close ( ); cout << " Created command file 'orbital_fill_contour_commands.txt'\n"; // // Terminate. // cout << "\n"; cout << "orbital_fill_contour():\n"; cout << " Normal end of execution.\n"; timestamp ( ); return 0; } //****************************************************************************80 double *r8vec_linspace_new ( int n, double a_first, double a_last ) //****************************************************************************80 // // Purpose: // // R8VEC_LINSPACE_NEW creates a vector of linearly spaced values. // // Discussion: // // An R8VEC is a vector of R8's. // // 4 points evenly spaced between 0 and 12 will yield 0, 4, 8, 12. // // In other words, the interval is divided into N-1 even subintervals, // and the endpoints of intervals are used as the points. // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 29 March 2011 // // Author: // // John Burkardt // // Input: // // int N, the number of entries in the vector. // // double A_FIRST, A_LAST, the first and last entries. // // Output: // // double R8VEC_LINSPACE_NEW[N], a vector of linearly spaced data. // { double *a; int i; a = new double[n]; if ( n == 1 ) { a[0] = ( a_first + a_last ) / 2.0; } else { for ( i = 0; i < n; i++ ) { a[i] = ( ( double ) ( n - 1 - i ) * a_first + ( double ) ( i ) * a_last ) / ( double ) ( n - 1 ); } } return a; } //****************************************************************************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 }