Skip to content
Snippets Groups Projects
Commit ee351587 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Also add an output type to the header of all the snapshots

parent b8944f8a
No related branches found
No related tags found
1 merge request!1050Line-of-sight output along the z-axis
...@@ -391,6 +391,7 @@ void write_output_distributed(struct engine* e, ...@@ -391,6 +391,7 @@ void write_output_distributed(struct engine* e,
swift_type_count); swift_type_count);
io_write_attribute_i(h_grp, "NumFilesPerSnapshot", numFiles); io_write_attribute_i(h_grp, "NumFilesPerSnapshot", numFiles);
io_write_attribute_i(h_grp, "ThisFile", mpi_rank); io_write_attribute_i(h_grp, "ThisFile", mpi_rank);
io_write_attribute_s(h_grp, "OutputType", "Snapshot");
/* Close header */ /* Close header */
H5Gclose(h_grp); H5Gclose(h_grp);
......
...@@ -488,17 +488,19 @@ void write_hdf5_header(hid_t h_file, const struct engine *e, ...@@ -488,17 +488,19 @@ void write_hdf5_header(hid_t h_file, const struct engine *e,
e->s->dim[2] * factor_length}; e->s->dim[2] * factor_length};
io_write_attribute(h_grp, "BoxSize", DOUBLE, dim, 3); io_write_attribute(h_grp, "BoxSize", DOUBLE, dim, 3);
io_write_attribute(h_grp, "Time", DOUBLE, &dblTime, 1); io_write_attribute_d(h_grp, "Time", dblTime);
const int dimension = (int)hydro_dimension; io_write_attribute_d(h_grp, "Dimension", (int)hydro_dimension);
io_write_attribute(h_grp, "Dimension", INT, &dimension, 1); io_write_attribute_d(h_grp, "Redshift", e->cosmology->z);
io_write_attribute(h_grp, "Redshift", DOUBLE, &e->cosmology->z, 1); io_write_attribute_d(h_grp, "Scale-factor", e->cosmology->a);
io_write_attribute(h_grp, "Scale-factor", DOUBLE, &e->cosmology->a, 1);
io_write_attribute_s(h_grp, "Code", "SWIFT"); io_write_attribute_s(h_grp, "Code", "SWIFT");
io_write_attribute_s(h_grp, "RunName", e->run_name); io_write_attribute_s(h_grp, "RunName", e->run_name);
const int num_files_per_snapshot = 1;
io_write_attribute(h_grp, "NumFilesPerSnapshot", INT, &num_files_per_snapshot, /* Store the time at which the snapshot was written */
1); time_t tm = time(NULL);
io_write_attribute_s(h_grp, "OutputType", "LineOfSight"); struct tm *timeinfo = localtime(&tm);
char snapshot_date[64];
strftime(snapshot_date, 64, "%T %F %Z", timeinfo);
io_write_attribute_s(h_grp, "Snapshot date", snapshot_date);
/* GADGET-2 legacy values */ /* GADGET-2 legacy values */
/* Number of particles of each type */ /* Number of particles of each type */
...@@ -516,13 +518,9 @@ void write_hdf5_header(hid_t h_file, const struct engine *e, ...@@ -516,13 +518,9 @@ void write_hdf5_header(hid_t h_file, const struct engine *e,
swift_type_count); swift_type_count);
io_write_attribute(h_grp, "NumPart_Total_HighWord", UINT, io_write_attribute(h_grp, "NumPart_Total_HighWord", UINT,
numParticlesHighWord, swift_type_count); numParticlesHighWord, swift_type_count);
io_write_attribute_i(h_grp, "NumFilesPerSnapshot", 1);
/* Store the time at which the snapshot was written */ io_write_attribute_i(h_grp, "ThisFile", 0);
time_t tm = time(NULL); io_write_attribute_s(h_grp, "OutputType", "LineOfSight");
struct tm *timeinfo = localtime(&tm);
char snapshot_date[64];
strftime(snapshot_date, 64, "%T %F %Z", timeinfo);
io_write_attribute_s(h_grp, "Snapshot date", snapshot_date);
/* Close group */ /* Close group */
H5Gclose(h_grp); H5Gclose(h_grp);
......
...@@ -1139,6 +1139,7 @@ void prepare_file(struct engine* e, const char* fileName, ...@@ -1139,6 +1139,7 @@ void prepare_file(struct engine* e, const char* fileName,
swift_type_count); swift_type_count);
io_write_attribute(h_grp, "NumFilesPerSnapshot", INT, &numFiles, 1); io_write_attribute(h_grp, "NumFilesPerSnapshot", INT, &numFiles, 1);
io_write_attribute_i(h_grp, "ThisFile", 0); io_write_attribute_i(h_grp, "ThisFile", 0);
io_write_attribute_s(h_grp, "OutputType", "Snapshot");
/* Close header */ /* Close header */
H5Gclose(h_grp); H5Gclose(h_grp);
......
...@@ -1006,6 +1006,7 @@ void write_output_serial(struct engine* e, ...@@ -1006,6 +1006,7 @@ void write_output_serial(struct engine* e,
swift_type_count); swift_type_count);
io_write_attribute(h_grp, "NumFilesPerSnapshot", INT, &numFiles, 1); io_write_attribute(h_grp, "NumFilesPerSnapshot", INT, &numFiles, 1);
io_write_attribute_i(h_grp, "ThisFile", 0); io_write_attribute_i(h_grp, "ThisFile", 0);
io_write_attribute_s(h_grp, "OutputType", "Snapshot");
/* Close header */ /* Close header */
H5Gclose(h_grp); H5Gclose(h_grp);
......
...@@ -851,6 +851,7 @@ void write_output_single(struct engine* e, ...@@ -851,6 +851,7 @@ void write_output_single(struct engine* e,
swift_type_count); swift_type_count);
io_write_attribute(h_grp, "NumFilesPerSnapshot", INT, &numFiles, 1); io_write_attribute(h_grp, "NumFilesPerSnapshot", INT, &numFiles, 1);
io_write_attribute_i(h_grp, "ThisFile", 0); io_write_attribute_i(h_grp, "ThisFile", 0);
io_write_attribute_s(h_grp, "OutputType", "Snapshot");
/* Close header */ /* Close header */
H5Gclose(h_grp); H5Gclose(h_grp);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment