From a5000aa9eeb1e648bc5ea526a422e94bad65cd9d Mon Sep 17 00:00:00 2001
From: loikki <loic.hausammann@protonmail.ch>
Date: Thu, 9 Aug 2018 11:17:14 +0200
Subject: [PATCH] Add stars properties in snapshot

---
 src/parallel_io.c | 11 ++++++++++-
 src/serial_io.c   |  9 +++++++++
 src/single_io.c   |  9 +++++++++
 3 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/src/parallel_io.c b/src/parallel_io.c
index 449756293a..5974070fac 100644
--- a/src/parallel_io.c
+++ b/src/parallel_io.c
@@ -1030,7 +1030,16 @@ void prepare_file(struct engine* e, const char* baseName, long long N_total[6],
     H5Gclose(h_grp);
   }
 
-  /* Print the gravity parameters */
+  /* Print the stellar parameters */
+  if (e->policy & engine_policy_stars) {
+    h_grp = H5Gcreate(h_file, "/StarsScheme", H5P_DEFAULT, H5P_DEFAULT,
+		      H5P_DEFAULT);
+    if (h_grp < 0) error("Error while creating stars group");
+    stars_props_print_snapshot(h_grp, e->stars_properties);
+    H5Gclose(h_grp);
+  }
+
+  /* Print the cosmological parameters */
   h_grp =
       H5Gcreate(h_file, "/Cosmology", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
   if (h_grp < 0) error("Error while creating cosmology group");
diff --git a/src/serial_io.c b/src/serial_io.c
index fa7fbb220b..8c92989513 100644
--- a/src/serial_io.c
+++ b/src/serial_io.c
@@ -884,6 +884,15 @@ void write_output_serial(struct engine* e, const char* baseName,
       H5Gclose(h_grp);
     }
 
+    /* Print the stellar parameters */
+    if (e->policy & engine_policy_stars) {
+      h_grp = H5Gcreate(h_file, "/StarsScheme", H5P_DEFAULT, H5P_DEFAULT,
+                        H5P_DEFAULT);
+      if (h_grp < 0) error("Error while creating stars group");
+      stars_props_print_snapshot(h_grp, e->stars_properties);
+      H5Gclose(h_grp);
+    }
+
     /* Print the cosmological model */
     h_grp =
         H5Gcreate(h_file, "/Cosmology", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
diff --git a/src/single_io.c b/src/single_io.c
index 0238c21b10..2e6ce4111f 100644
--- a/src/single_io.c
+++ b/src/single_io.c
@@ -734,6 +734,15 @@ void write_output_single(struct engine* e, const char* baseName,
     H5Gclose(h_grp);
   }
 
+  /* Print the stellar parameters */
+  if (e->policy & engine_policy_stars) {
+    h_grp = H5Gcreate(h_file, "/StarsScheme", H5P_DEFAULT, H5P_DEFAULT,
+		      H5P_DEFAULT);
+    if (h_grp < 0) error("Error while creating stars group");
+    stars_props_print_snapshot(h_grp, e->stars_properties);
+    H5Gclose(h_grp);
+  }
+
   /* Print the cosmological model  */
   h_grp =
       H5Gcreate(h_file, "/Cosmology", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-- 
GitLab