From b2efc6e322b8e7e7bf10485caa89b825d6779302 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Tue, 31 Mar 2020 13:27:49 +0200
Subject: [PATCH] Also add the option to name columns in the cooling i/o

---
 src/cooling/Compton/cooling_io.h      | 7 +++++--
 src/cooling/EAGLE/cooling_io.h        | 4 +++-
 src/cooling/QLA/cooling_io.h          | 4 +++-
 src/cooling/const_du/cooling_io.h     | 7 +++++--
 src/cooling/const_lambda/cooling_io.h | 7 +++++--
 src/cooling/grackle/cooling_io.h      | 6 +++++-
 src/cooling/none/cooling_io.h         | 5 ++++-
 src/parallel_io.c                     | 2 +-
 src/serial_io.c                       | 2 +-
 src/single_io.c                       | 2 +-
 10 files changed, 33 insertions(+), 13 deletions(-)

diff --git a/src/cooling/Compton/cooling_io.h b/src/cooling/Compton/cooling_io.h
index 1f137e18ca..ea3997d9c5 100644
--- a/src/cooling/Compton/cooling_io.h
+++ b/src/cooling/Compton/cooling_io.h
@@ -30,11 +30,14 @@
 
 /**
  * @brief Writes the current model of cooling to the file
+ *
  * @param h_grp The HDF5 group in which to write
- * @param cooling the parameters of the cooling function.
+ * @param h_grp_columns The HDF5 group containing named columns
+ * @param cooling The #cooling_function_data
  */
 __attribute__((always_inline)) INLINE static void cooling_write_flavour(
-    hid_t h_grp, const struct cooling_function_data* cooling) {
+    hid_t h_grp, hid_t h_grp_columns,
+    const struct cooling_function_data* cooling) {
 
   io_write_attribute_s(h_grp, "Cooling Model", "Compton cooling");
   io_write_attribute_d(h_grp, "Compton rate [erg s^-1 K^-1]",
diff --git a/src/cooling/EAGLE/cooling_io.h b/src/cooling/EAGLE/cooling_io.h
index a57e4451d8..e642185882 100644
--- a/src/cooling/EAGLE/cooling_io.h
+++ b/src/cooling/EAGLE/cooling_io.h
@@ -32,10 +32,12 @@
  * @brief Writes the current model of cooling to the file.
  *
  * @param h_grp The HDF5 group in which to write
+ * @param h_grp_columns The HDF5 group containing named columns
  * @param cooling The #cooling_function_data
  */
 __attribute__((always_inline)) INLINE static void cooling_write_flavour(
-    hid_t h_grp, const struct cooling_function_data* cooling) {
+    hid_t h_grp, hid_t h_grp_columns,
+    const struct cooling_function_data* cooling) {
 
   io_write_attribute_s(h_grp, "Cooling Model", "EAGLE");
 }
diff --git a/src/cooling/QLA/cooling_io.h b/src/cooling/QLA/cooling_io.h
index 71303e5e42..5407b53787 100644
--- a/src/cooling/QLA/cooling_io.h
+++ b/src/cooling/QLA/cooling_io.h
@@ -32,10 +32,12 @@
  * @brief Writes the current model of cooling to the file.
  *
  * @param h_grp The HDF5 group in which to write
+ * @param h_grp_columns The HDF5 group containing named columns
  * @param cooling The #cooling_function_data
  */
 __attribute__((always_inline)) INLINE static void cooling_write_flavour(
-    hid_t h_grp, const struct cooling_function_data* cooling) {
+    hid_t h_grp, hid_t h_grp_columns,
+    const struct cooling_function_data* cooling) {
 
   io_write_attribute_s(h_grp, "Cooling Model",
                        "Quick Lyman-alpha (EAGLE with primordial Z only)");
diff --git a/src/cooling/const_du/cooling_io.h b/src/cooling/const_du/cooling_io.h
index 8c82d0e3f7..0ecb2ebe51 100644
--- a/src/cooling/const_du/cooling_io.h
+++ b/src/cooling/const_du/cooling_io.h
@@ -41,11 +41,14 @@
 
 /**
  * @brief Writes the current model of SPH to the file
+ *
  * @param h_grp The HDF5 group in which to write
- * @param cooling the parameters of the cooling function.
+ * @param h_grp_columns The HDF5 group containing named columns
+ * @param cooling The #cooling_function_data
  */
 __attribute__((always_inline)) INLINE static void cooling_write_flavour(
-    hid_t h_grp, const struct cooling_function_data* cooling) {
+    hid_t h_grp, hid_t h_grp_columns,
+    const struct cooling_function_data* cooling) {
 
   io_write_attribute_s(h_grp, "Cooling Model", "Constant du/dt");
 }
diff --git a/src/cooling/const_lambda/cooling_io.h b/src/cooling/const_lambda/cooling_io.h
index 5a8c2e8241..091d567066 100644
--- a/src/cooling/const_lambda/cooling_io.h
+++ b/src/cooling/const_lambda/cooling_io.h
@@ -39,11 +39,14 @@
 
 /**
  * @brief Writes the current model of cooling to the file
+ *
  * @param h_grp The HDF5 group in which to write
- * @param cooling the parameters of the cooling function.
+ * @param h_grp_columns The HDF5 group containing named columns
+ * @param cooling The #cooling_function_data
  */
 __attribute__((always_inline)) INLINE static void cooling_write_flavour(
-    hid_t h_grp, const struct cooling_function_data* cooling) {
+    hid_t h_grp, hid_t h_grp_columns,
+    const struct cooling_function_data* cooling) {
 
   io_write_attribute_s(h_grp, "Cooling Model", "Constant Lambda");
   io_write_attribute_d(h_grp, "Lambda/n_H^2 [cgs]", cooling->lambda_nH2_cgs);
diff --git a/src/cooling/grackle/cooling_io.h b/src/cooling/grackle/cooling_io.h
index 613f507868..223f0db2f6 100644
--- a/src/cooling/grackle/cooling_io.h
+++ b/src/cooling/grackle/cooling_io.h
@@ -27,10 +27,14 @@
 
 /**
  * @brief Writes the current model of cooling  to the file
+ *
  * @param h_grp The HDF5 group in which to write
+ * @param h_grp_columns The HDF5 group containing named columns
+ * @param cooling The #cooling_function_data
  */
 __attribute__((always_inline)) INLINE static void cooling_write_flavour(
-    hid_t h_grp, const struct cooling_function_data* cooling) {
+    hid_t h_grp, hid_t h_grp_columns,
+    const struct cooling_function_data* cooling) {
 
 #if COOLING_GRACKLE_MODE == 0
   io_write_attribute_s(h_grp, "Cooling Model", "Grackle");
diff --git a/src/cooling/none/cooling_io.h b/src/cooling/none/cooling_io.h
index 0c551f0f66..848a90dd5e 100644
--- a/src/cooling/none/cooling_io.h
+++ b/src/cooling/none/cooling_io.h
@@ -30,11 +30,14 @@
 
 /**
  * @brief Writes the current model of SPH to the file
+ *
  * @param h_grp The HDF5 group in which to write
+ * @param h_grp_columns The HDF5 group containing named columns
  * @param cooling the parameters of the cooling function.
  */
 __attribute__((always_inline)) INLINE static void cooling_write_flavour(
-    hid_t h_grp, const struct cooling_function_data* cooling) {
+    hid_t h_grp, hid_t h_grp_columns,
+    const struct cooling_function_data* cooling) {
 
   io_write_attribute_s(h_grp, "Cooling Model", "None");
 }
diff --git a/src/parallel_io.c b/src/parallel_io.c
index 208fa3872d..9d3b141643 100644
--- a/src/parallel_io.c
+++ b/src/parallel_io.c
@@ -1178,7 +1178,7 @@ void prepare_file(struct engine* e, const char* baseName, long long N_total[6],
       H5Gcreate(h_grp, "NamedColumns", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
   if (h_grp_columns < 0) error("Error while creating named columns group");
   entropy_floor_write_flavour(h_grp);
-  cooling_write_flavour(h_grp, e->cooling_func);
+  cooling_write_flavour(h_grp, h_grp_columns, e->cooling_func);
   chemistry_write_flavour(h_grp, h_grp_columns);
   tracers_write_flavour(h_grp);
   feedback_write_flavour(e->feedback_props, h_grp);
diff --git a/src/serial_io.c b/src/serial_io.c
index f4ee75a813..3ff429e275 100644
--- a/src/serial_io.c
+++ b/src/serial_io.c
@@ -1043,7 +1043,7 @@ void write_output_serial(struct engine* e, const char* baseName,
         H5Gcreate(h_grp, "NamedColumns", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
     if (h_grp_columns < 0) error("Error while creating named columns group");
     entropy_floor_write_flavour(h_grp);
-    cooling_write_flavour(h_grp, e->cooling_func);
+    cooling_write_flavour(h_grp, h_grp_columns, e->cooling_func);
     chemistry_write_flavour(h_grp, h_grp_columns);
     tracers_write_flavour(h_grp);
     feedback_write_flavour(e->feedback_props, h_grp);
diff --git a/src/single_io.c b/src/single_io.c
index 9a3a9e7ec3..52e13a0c1d 100644
--- a/src/single_io.c
+++ b/src/single_io.c
@@ -888,7 +888,7 @@ void write_output_single(struct engine* e, const char* baseName,
       H5Gcreate(h_grp, "NamedColumns", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
   if (h_grp_columns < 0) error("Error while creating named columns group");
   entropy_floor_write_flavour(h_grp);
-  cooling_write_flavour(h_grp, e->cooling_func);
+  cooling_write_flavour(h_grp, h_grp_columns, e->cooling_func);
   chemistry_write_flavour(h_grp, h_grp_columns);
   tracers_write_flavour(h_grp);
   feedback_write_flavour(e->feedback_props, h_grp);
-- 
GitLab