From 82ddfcbcdea2a3a69b82ddca79bca1db69538068 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Fri, 20 Jan 2023 11:59:35 +0800
Subject: [PATCH] Report the modified trigger sizes in the snapshot as
 meta-data

---
 src/common_io.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/src/common_io.c b/src/common_io.c
index e4db20223f..eea1d91fe2 100644
--- a/src/common_io.c
+++ b/src/common_io.c
@@ -596,6 +596,36 @@ void io_write_meta_data(hid_t h_file, const struct engine* e,
   parser_write_params_to_hdf5(e->parameter_file, h_grp, /*write_used=*/0);
   H5Gclose(h_grp);
 
+  /* Print the recording triggers */
+  h_grp = H5Gcreate(h_file, "/RecordingTriggers", H5P_DEFAULT, H5P_DEFAULT,
+                    H5P_DEFAULT);
+  if (h_grp < 0) error("Error while creating recording triggers group");
+  if (num_snapshot_triggers_part) {
+    io_write_attribute(h_grp, "DesiredRecordingTimesGas", DOUBLE,
+                       e->snapshot_recording_triggers_desired_part,
+                       num_snapshot_triggers_part);
+    io_write_attribute(h_grp, "ActualRecordingTimesGas", DOUBLE,
+                       e->snapshot_recording_triggers_part,
+                       num_snapshot_triggers_part);
+  }
+  if (num_snapshot_triggers_spart) {
+    io_write_attribute(h_grp, "DesiredRecordingTimesStars", DOUBLE,
+                       e->snapshot_recording_triggers_desired_spart,
+                       num_snapshot_triggers_spart);
+    io_write_attribute(h_grp, "ActualRecordingTimesStars", DOUBLE,
+                       e->snapshot_recording_triggers_spart,
+                       num_snapshot_triggers_spart);
+  }
+  if (num_snapshot_triggers_bpart) {
+    io_write_attribute(h_grp, "DesiredRecordingTimesBlackHoles", DOUBLE,
+                       e->snapshot_recording_triggers_desired_bpart,
+                       num_snapshot_triggers_bpart);
+    io_write_attribute(h_grp, "ActualRecordingTimesBlackHoles", DOUBLE,
+                       e->snapshot_recording_triggers_bpart,
+                       num_snapshot_triggers_bpart);
+  }
+  H5Gclose(h_grp);
+
   /* Print the system of Units used in the spashot */
   io_write_unit_system(h_file, snapshot_units, "Units");
 
-- 
GitLab