# include # include # include # include # include # include # include using namespace std; int main ( ); void timestamp ( ); //****************************************************************************80 int main ( ) //****************************************************************************80 // // Purpose: // // vortex_subplots() shows pressure and velocity as two subplots. // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 22 August 2026 // // Author: // // John Burkardt // { string command_filename; ofstream command_unit; timestamp ( ); cout << "\n"; cout << "vortex_subplots():\n"; cout << " C++ version\n"; cout << " Plot a pair of subplots together using gnuplot().\n"; command_filename = "vortex_commands.txt"; command_unit.open ( command_filename.c_str ( ) ); command_unit << "# vortex_commands.txt\n"; command_unit << "#\n"; command_unit << "# Usage:\n"; command_unit << "# gnuplot < vortex_commands.txt\n"; command_unit << "#\n"; command_unit << "set term png\n"; command_unit << "set output 'vortex_subplots.png'\n"; command_unit << "set multiplot layout 1,2 title \"Vortex pressure and velocity\"\n"; command_unit << "#\n"; command_unit << "set xlabel '<--- X --->'\n"; command_unit << "set ylabel '<--- Y --->'\n"; command_unit << "set title 'Pressure'\n"; command_unit << "set grid\n"; command_unit << "set timestamp\n"; command_unit << "unset key\n"; command_unit << "unset surface\n"; command_unit << "set contour base\n"; command_unit << "set pm3d\n"; command_unit << "set size ratio -1\n"; command_unit << "unset tics\n"; command_unit << "set view map scale 0.90\n"; command_unit << "splot 'vortex_pressure_data.txt' with pm3d\n"; command_unit << "#\n"; command_unit << "set xlabel \"<--- X --->\"\n"; command_unit << "set ylabel \"<--- Y --->\"\n"; command_unit << "set title \"Velocity\"\n"; command_unit << "unset key\n"; command_unit << "set grid\n"; command_unit << "set size ratio -1\n"; command_unit << "plot \"vortex_velocity_data.txt\" using 1:2:5:6 with vectors \\\n"; command_unit << " head filled lt 2 linecolor rgb \"blue\"\n"; command_unit << "#\n"; command_unit << "unset multiplot\n"; command_unit << "quit\n"; command_unit.close ( ); cout << " Created command file 'vortex_commands.txt'\n"; // // Terminate. // cout << "\n"; cout << "vortex_subplots():\n"; cout << " Normal end of execution.\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 }