Improved output and config

This commit is contained in:
Yohai Meiron 2020-03-31 22:06:04 -04:00
parent 5cb4282be4
commit 62b0d7e491
6 changed files with 126 additions and 107 deletions

View file

@ -291,22 +291,6 @@ void get_CPU_time(double *time_real, double *time_user, double *time_syst)
*time_user = *time_real;
}
void write_snap_data(char out_fname[], int diskstep, int N, double time_cur, int ind[], double m[], double3 x[], double3 v[])
{
auto out = fopen(out_fname, "w");
fprintf(out,"%06d \n", diskstep);
fprintf(out,"%07d \n", N);
fprintf(out,"%.10E \n", time_cur);
for (int i=0; i<N; i++) {
fprintf(out,"%07d \t %.10E \t % .10E % .10E % .10E \t % .10E % .10E % .10E \n",
ind[i],
m[i],
x[i][0], x[i][1], x[i][2],
v[i][0], v[i][1], v[i][2]);
}
fclose(out);
}
void write_bh_data(double time_cur, double m[], double3 x[], double3 v[], double pot[], double3 a[], double3 adot[], double dt[])
{
if (config->live_smbh_count == 2) {
@ -1971,9 +1955,8 @@ int main(int argc, char *argv[])
diskstep++;
char out_fname[256];
sprintf(out_fname, "%06d", diskstep);
if (config->output_hdf5) h5_write(std::string(out_fname) + ".h5", diskstep, N, time_cur, m, x, v, pot, a, adot, 0, true);
else ascii_write(std::string(out_fname) + ".dat", diskstep, N, time_cur, m, x, v, 10);
// TODO custom precision
if (config->output_hdf5) h5_write(std::string(out_fname) + ".h5", diskstep, N, time_cur, m, x, v, pot, a, adot, config->output_extra_mode, config->output_hdf5_double_precision);
else ascii_write(std::string(out_fname) + ".dat", diskstep, N, time_cur, m, x, v, config->output_ascii_precision);
} /* if (myRank == rootRank) */
#ifdef ETICS_DUMP