From 30d2f6115e3223bb7907dec24a2902dbaad30806 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Thu, 1 Mar 2018 21:01:27 +0100
Subject: [PATCH] Only compile the cooling_write_flavour() functions if HDF5 is
 detected.

---
 src/cooling/EAGLE/cooling.h        | 3 +++
 src/cooling/const_du/cooling.h     | 3 +++
 src/cooling/const_lambda/cooling.h | 3 +++
 src/cooling/grackle/cooling.h      | 3 +++
 src/cooling/none/cooling.h         | 3 +++
 5 files changed, 15 insertions(+)

diff --git a/src/cooling/EAGLE/cooling.h b/src/cooling/EAGLE/cooling.h
index 99d0c7d7cc..62d1cc9b72 100644
--- a/src/cooling/EAGLE/cooling.h
+++ b/src/cooling/EAGLE/cooling.h
@@ -37,6 +37,8 @@
 #include "physical_constants.h"
 #include "units.h"
 
+#ifdef HAVE_HDF5
+
 /**
  * @brief Writes the current model of SPH to the file
  * @param h_grpsph The HDF5 group in which to write
@@ -46,6 +48,7 @@ __attribute__((always_inline)) INLINE static void cooling_write_flavour(
 
   io_write_attribute_s(h_grpsph, "Cooling Model", "EAGLE");
 }
+#endif
 
 /**
  * @brief Apply the cooling function to a particle.
diff --git a/src/cooling/const_du/cooling.h b/src/cooling/const_du/cooling.h
index 83698c06ff..25aa974e47 100644
--- a/src/cooling/const_du/cooling.h
+++ b/src/cooling/const_du/cooling.h
@@ -44,6 +44,8 @@
 #include "physical_constants.h"
 #include "units.h"
 
+#ifdef HAVE_HDF5
+
 /**
  * @brief Writes the current model of SPH to the file
  * @param h_grpsph The HDF5 group in which to write
@@ -53,6 +55,7 @@ __attribute__((always_inline)) INLINE static void cooling_write_flavour(
 
   io_write_attribute_s(h_grpsph, "Cooling Model", "Constant du/dt");
 }
+#endif
 
 /**
  * @brief Apply the cooling function to a particle.
diff --git a/src/cooling/const_lambda/cooling.h b/src/cooling/const_lambda/cooling.h
index af648b9043..a402b74930 100644
--- a/src/cooling/const_lambda/cooling.h
+++ b/src/cooling/const_lambda/cooling.h
@@ -37,6 +37,8 @@
 #include "physical_constants.h"
 #include "units.h"
 
+#ifdef HAVE_HDF5
+
 /**
  * @brief Writes the current model of SPH to the file
  * @param h_grpsph The HDF5 group in which to write
@@ -46,6 +48,7 @@ __attribute__((always_inline)) INLINE static void cooling_write_flavour(
 
   io_write_attribute_s(h_grpsph, "Cooling Model", "Constant Lambda");
 }
+#endif
 
 /**
  * @brief Calculates du/dt in code units for a particle.
diff --git a/src/cooling/grackle/cooling.h b/src/cooling/grackle/cooling.h
index b7a09f1907..d1da523001 100644
--- a/src/cooling/grackle/cooling.h
+++ b/src/cooling/grackle/cooling.h
@@ -42,6 +42,8 @@
 #define GRACKLE_NPART 1
 #define GRACKLE_RANK 3
 
+#ifdef HAVE_HDF5
+
 /**
  * @brief Writes the current model of SPH to the file
  * @param h_grpsph The HDF5 group in which to write
@@ -51,6 +53,7 @@ __attribute__((always_inline)) INLINE static void cooling_write_flavour(
 
   io_write_attribute_s(h_grpsph, "Cooling Model", "Grackle");
 }
+#endif
 
 /**
  * @brief Sets the cooling properties of the (x-)particles to a valid start
diff --git a/src/cooling/none/cooling.h b/src/cooling/none/cooling.h
index 4715c06f9f..a1cc649111 100644
--- a/src/cooling/none/cooling.h
+++ b/src/cooling/none/cooling.h
@@ -37,6 +37,8 @@
 #include "physical_constants.h"
 #include "units.h"
 
+#ifdef HAVE_HDF5
+
 /**
  * @brief Writes the current model of SPH to the file
  * @param h_grpsph The HDF5 group in which to write
@@ -46,6 +48,7 @@ __attribute__((always_inline)) INLINE static void cooling_write_flavour(
 
   io_write_attribute_s(h_grpsph, "Cooling Model", "None");
 }
+#endif
 
 /**
  * @brief Apply the cooling function to a particle.
-- 
GitLab