Commit 099a44d5 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Use the same style throughout for the snapshot-related variables in the engine structure.

parent 2edb0d02
......@@ -5266,17 +5266,17 @@ void engine_dump_snapshot(struct engine *e) {
#if defined(HAVE_HDF5)
#if defined(WITH_MPI)
#if defined(HAVE_PARALLEL_HDF5)
write_output_parallel(e, e->snapshotBaseName, e->internal_units,
e->snapshotUnits, e->nodeID, e->nr_nodes,
write_output_parallel(e, e->snapshot_base_name, e->internal_units,
e->snapshot_units, e->nodeID, e->nr_nodes,
MPI_COMM_WORLD, MPI_INFO_NULL);
#else
write_output_serial(e, e->snapshotBaseName, e->internal_units,
e->snapshotUnits, e->nodeID, e->nr_nodes, MPI_COMM_WORLD,
write_output_serial(e, e->snapshot_base_name, e->internal_units,
e->snapshot_units, e->nodeID, e->nr_nodes, MPI_COMM_WORLD,
MPI_INFO_NULL);
#endif
#else
write_output_single(e, e->snapshotBaseName, e->internal_units,
e->snapshotUnits);
write_output_single(e, e->snapshot_base_name, e->internal_units,
e->snapshot_units);
#endif
#endif
......@@ -5413,12 +5413,12 @@ void engine_init(struct engine *e, struct space *s,
e->delta_time_snapshot =
parser_get_param_double(params, "Snapshots:delta_time");
e->ti_next_snapshot = 0;
parser_get_param_string(params, "Snapshots:basename", e->snapshotBaseName);
e->snapshotCompression =
parser_get_param_string(params, "Snapshots:basename", e->snapshot_base_name);
e->snapshot_compression =
parser_get_opt_param_int(params, "Snapshots:compression", 0);
e->snapshotUnits = (struct unit_system *)malloc(sizeof(struct unit_system));
units_init_default(e->snapshotUnits, params, "Snapshots", internal_units);
e->snapshotOutputCount = 0;
e->snapshot_units = (struct unit_system *)malloc(sizeof(struct unit_system));
units_init_default(e->snapshot_units, params, "Snapshots", internal_units);
e->snapshot_output_count = 0;
e->dt_min = parser_get_param_double(params, "TimeIntegration:dt_min");
e->dt_max = parser_get_param_double(params, "TimeIntegration:dt_max");
e->a_first_statistics =
......@@ -6135,7 +6135,7 @@ void engine_clean(struct engine *e) {
gravity_cache_clean(&e->runners[i].cj_gravity_cache);
}
free(e->runners);
free(e->snapshotUnits);
free(e->snapshot_units);
free(e->links);
scheduler_clean(&e->sched);
space_clean(e->s);
......@@ -6159,7 +6159,7 @@ void engine_struct_dump(struct engine *e, FILE *stream) {
/* And all the engine pointed data, these use their own dump functions. */
space_struct_dump(e->s, stream);
units_struct_dump(e->internal_units, stream);
units_struct_dump(e->snapshotUnits, stream);
units_struct_dump(e->snapshot_units, stream);
cosmology_struct_dump(e->cosmology, stream);
#ifdef WITH_MPI
......@@ -6211,7 +6211,7 @@ void engine_struct_restore(struct engine *e, FILE *stream) {
us = (struct unit_system *)malloc(sizeof(struct unit_system));
units_struct_restore(us, stream);
e->snapshotUnits = us;
e->snapshot_units = us;
struct cosmology *cosmo =
(struct cosmology *)malloc(sizeof(struct cosmology));
......
......@@ -199,10 +199,10 @@ struct engine {
/* Integer time of the next snapshot */
integertime_t ti_next_snapshot;
char snapshotBaseName[PARSER_MAX_LINE_SIZE];
int snapshotCompression;
struct unit_system *snapshotUnits;
int snapshotOutputCount;
char snapshot_base_name[PARSER_MAX_LINE_SIZE];
int snapshot_compression;
struct unit_system *snapshot_units;
int snapshot_output_count;
/* Statistics information */
double a_first_statistics;
......
......@@ -854,7 +854,7 @@ void prepare_file(struct engine* e, const char* baseName, long long N_total[6],
int numFiles = 1;
/* First time, we need to create the XMF file */
if (e->snapshotOutputCount == 0) xmf_create_file(baseName);
if (e->snapshot_output_count == 0) xmf_create_file(baseName);
/* Prepare the XMF file for the new entry */
xmfFile = xmf_prepare_file(baseName);
......@@ -862,7 +862,7 @@ void prepare_file(struct engine* e, const char* baseName, long long N_total[6],
/* HDF5 File name */
char fileName[FILENAME_BUFFER_SIZE];
snprintf(fileName, FILENAME_BUFFER_SIZE, "%s_%04i.hdf5", baseName,
e->snapshotOutputCount);
e->snapshot_output_count);
/* Open HDF5 file with the chosen parameters */
hid_t h_file = H5Fcreate(fileName, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
......@@ -1035,7 +1035,7 @@ void prepare_file(struct engine* e, const char* baseName, long long N_total[6],
}
/* Write LXMF file descriptor */
xmf_write_outputfooter(xmfFile, e->snapshotOutputCount, e->time);
xmf_write_outputfooter(xmfFile, e->snapshot_output_count, e->time);
/* Close the file for now */
H5Fclose(h_file);
......@@ -1117,7 +1117,7 @@ void write_output_parallel(struct engine* e, const char* baseName,
/* HDF5 File name */
char fileName[FILENAME_BUFFER_SIZE];
snprintf(fileName, FILENAME_BUFFER_SIZE, "%s_%04i.hdf5", baseName,
e->snapshotOutputCount);
e->snapshot_output_count);
/* Prepare some file-access properties */
hid_t plist_id = H5Pcreate(H5P_FILE_ACCESS);
......@@ -1327,7 +1327,7 @@ void write_output_parallel(struct engine* e, const char* baseName,
clocks_getunit());
#endif
e->snapshotOutputCount++;
e->snapshot_output_count++;
}
#endif /* HAVE_HDF5 */
......@@ -239,13 +239,13 @@ void prepareArray(const struct engine* e, hid_t grp, char* fileName,
}
/* Impose data compression */
if (e->snapshotCompression > 0) {
if (e->snapshot_compression > 0) {
h_err = H5Pset_shuffle(h_prop);
if (h_err < 0)
error("Error while setting shuffling options for field '%s'.",
props.name);
h_err = H5Pset_deflate(h_prop, e->snapshotCompression);
h_err = H5Pset_deflate(h_prop, e->snapshot_compression);
if (h_err < 0)
error("Error while setting compression options for field '%s'.",
props.name);
......@@ -746,7 +746,7 @@ void write_output_serial(struct engine* e, const char* baseName,
/* File name */
char fileName[FILENAME_BUFFER_SIZE];
snprintf(fileName, FILENAME_BUFFER_SIZE, "%s_%04i.hdf5", baseName,
e->snapshotOutputCount);
e->snapshot_output_count);
/* Compute offset in the file and total number of particles */
size_t N[swift_type_count] = {Ngas, Ndm, 0, 0, Nstars, 0};
......@@ -766,7 +766,7 @@ void write_output_serial(struct engine* e, const char* baseName,
if (mpi_rank == 0) {
/* First time, we need to create the XMF file */
if (e->snapshotOutputCount == 0) xmf_create_file(baseName);
if (e->snapshot_output_count == 0) xmf_create_file(baseName);
/* Prepare the XMF file for the new entry */
xmfFile = xmf_prepare_file(baseName);
......@@ -1045,10 +1045,10 @@ void write_output_serial(struct engine* e, const char* baseName,
/* Write footer of LXMF file descriptor */
if (mpi_rank == 0)
xmf_write_outputfooter(xmfFile, e->snapshotOutputCount, e->time);
xmf_write_outputfooter(xmfFile, e->snapshot_output_count, e->time);
/* message("Done writing particles..."); */
e->snapshotOutputCount++;
e->snapshot_output_count++;
}
#endif /* HAVE_HDF5 && HAVE_MPI */
......@@ -246,13 +246,13 @@ void writeArray(const struct engine* e, hid_t grp, char* fileName,
}
/* Impose data compression */
if (e->snapshotCompression > 0) {
if (e->snapshot_compression > 0) {
h_err = H5Pset_shuffle(h_prop);
if (h_err < 0)
error("Error while setting shuffling options for field '%s'.",
props.name);
h_err = H5Pset_deflate(h_prop, e->snapshotCompression);
h_err = H5Pset_deflate(h_prop, e->snapshot_compression);
if (h_err < 0)
error("Error while setting compression options for field '%s'.",
props.name);
......@@ -616,10 +616,10 @@ void write_output_single(struct engine* e, const char* baseName,
/* File name */
char fileName[FILENAME_BUFFER_SIZE];
snprintf(fileName, FILENAME_BUFFER_SIZE, "%s_%04i.hdf5", baseName,
e->snapshotOutputCount);
e->snapshot_output_count);
/* First time, we need to create the XMF file */
if (e->snapshotOutputCount == 0) xmf_create_file(baseName);
if (e->snapshot_output_count == 0) xmf_create_file(baseName);
/* Prepare the XMF file for the new entry */
FILE* xmfFile = 0;
......@@ -853,14 +853,14 @@ void write_output_single(struct engine* e, const char* baseName,
}
/* Write LXMF file descriptor */
xmf_write_outputfooter(xmfFile, e->snapshotOutputCount, e->time);
xmf_write_outputfooter(xmfFile, e->snapshot_output_count, e->time);
/* message("Done writing particles..."); */
/* Close file */
H5Fclose(h_file);
e->snapshotOutputCount++;
e->snapshot_output_count++;
}
#endif /* HAVE_HDF5 */
Supports Markdown
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