# include # include # include # include # include int main ( ); double *r8vec_linspace_new ( int n, double a, double b ); void timestamp ( ); /******************************************************************************/ int main ( ) /******************************************************************************/ /* 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 */ { FILE *command_unit; timestamp ( ); printf ( "\n" ); printf ( "orbital_fill_contour():\n" ); printf ( " C version\n" ); printf ( " Color contour plot of orbital data using gnuplot().\n" ); command_unit = fopen ( "orbital_fill_contour_commands.txt", "wt" ); fprintf ( command_unit, "# orbital_fill_contour_commands.txt\n" ); fprintf ( command_unit, "#\n" ); fprintf ( command_unit, "# Usage:\n" ); fprintf ( command_unit, "# gnuplot < orbital_fill_contour_commands.txt\n" ); fprintf ( command_unit, "#\n" ); fprintf ( command_unit, "set term png\n" ); fprintf ( command_unit, "set output 'orbital_fill_contour.png'\n" ); fprintf ( command_unit, "set xlabel '<--- X --->'\n" ); fprintf ( command_unit, "set ylabel '<--- Y --->'\n" ); fprintf ( command_unit, "set title 'Orbital Data'\n" ); fprintf ( command_unit, "set grid\n" ); fprintf ( command_unit, "unset surface\n" ); fprintf ( command_unit, "set contour base\n" ); fprintf ( command_unit, "set view map\n" ); fprintf ( command_unit, "set pm3d\n" ); fprintf ( command_unit, "set style data lines\n" ); fprintf ( command_unit, "splot 'orbital_gnuplot_data.txt' with pm3d\n" ); fprintf ( command_unit, "quit\n" ); fclose ( command_unit ); printf ( " Created command file 'orbital_fill_contour_commands.txt'\n" ); /* Terminate. */ printf ( "\n" ); printf ( "orbital_fill_contour():\n" ); printf ( " Normal end of execution.\n" ); timestamp ( ); return 0; } /******************************************************************************/ double *r8vec_linspace_new ( int n, double a, double b ) /******************************************************************************/ /* 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, B, the first and last entries. Output: double R8VEC_LINSPACE_NEW[N], a vector of linearly spaced data. */ { int i; double *x; x = ( double * ) malloc ( n * sizeof ( double ) ); if ( n == 1 ) { x[0] = ( a + b ) / 2.0; } else { for ( i = 0; i < n; i++ ) { x[i] = ( ( double ) ( n - 1 - i ) * a + ( double ) ( i ) * b ) / ( double ) ( n - 1 ); } } return x; } /******************************************************************************/ void timestamp ( ) /******************************************************************************/ /* Purpose: timestamp() prints the current YMDHMS date as a time stamp. Example: 17 June 2014 09:45:54 AM Licensing: This code is distributed under the MIT license. Modified: 01 May 2021 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 ); printf ( "%s\n", time_buffer ); return; # undef TIME_SIZE }