Commit 17c63523 authored by David Deepwell's avatar David Deepwell
Browse files

Move the writing of plot times into BaseCase

parent f8e85580
......@@ -422,6 +422,25 @@ void BaseCase::write_diagnostics(string header, string line,
fclose(diagnos_file);
}
// Write plot time information
void BaseCase::write_plot_times(double time, double clock_time, double comp_duration,
double avg_write_time, int plot_number, bool restarting) {
if (master()) {
// in log file
fprintf(stdout,"*Write time: %.6g. Average write time: %.6g.\n",
clock_time - comp_duration, avg_write_time);
// track in a file
FILE * plottimes_file = fopen("plot_times.txt","a");
assert(plottimes_file);
if ( plot_number==get_restart_sequence()+1 and !restarting )
fprintf(plottimes_file,"Output number, Simulation time (s), "
"Write time (s), Average write time (s)\n");
fprintf(plottimes_file,"%d, %.17f, %.12g, %.12g\n",
plot_number, time, clock_time - comp_duration, avg_write_time);
fclose(plottimes_file);
}
}
// parse expansion types
void parse_boundary_conditions(const string xgrid_type, const string ygrid_type,
const string zgrid_type, DIMTYPE & intype_x, DIMTYPE & intype_y, DIMTYPE & intype_z) {
......
......@@ -167,6 +167,8 @@ class BaseCase {
template <class T> void add_diagnostic(const string str, const T val,
string & header, string & line);
void write_diagnostics(string header, string line, int iter, bool restarting);
void write_plot_times(double time, double clock_time, double comp_duration,
double avg_write_time, int plot_number, bool restarting);
// Generate an automatic grid for unmapped cases
virtual void automatic_grid(double MinX, double MinY, double MinZ,
......
......@@ -365,20 +365,7 @@ class userControl : public BaseCase {
avg_write_time = (avg_write_time*(plot_number-restart_sequence-1)
+ (clock_time - comp_duration))/(plot_number-restart_sequence);
// Print information about plot outputs
if (master()) {
// in log file
fprintf(stdout,"*Write time: %.6g. Average write time: %.6g.\n",
clock_time - comp_duration, avg_write_time);
// track in a file
FILE * plottimes_file = fopen("plot_times.txt","a");
assert(plottimes_file);
if ( plot_number==restart_sequence+1 and !restarting )
fprintf(plottimes_file,"Output number, Simulation time (s), "
"Write time (s), Average write time (s)\n");
fprintf(plottimes_file,"%d, %.12f, %.12g, %.12g\n",
plot_number, time, clock_time - comp_duration, avg_write_time);
fclose(plottimes_file);
}
write_plot_times(time, clock_time, comp_duration, avg_write_time, plot_number, restarting);
}
// see if close to end of compute time and dump
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment