From 839cbab33b942f0cc915c67a22bb970556750f3e Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Fri, 29 Jan 2016 00:49:14 +0000
Subject: [PATCH] Moved the interaction functions to the hydro directory

---
 src/Makefile.am                                          | 4 ++--
 src/engine.c                                             | 6 ------
 src/gravity.h                                            | 1 +
 src/gravity/Default/gravity.h                            | 3 +++
 src/hydro.h                                              | 2 ++
 src/{runner_iact.h => hydro/Default/hydro_iact.h}        | 0
 src/{runner_iact_legacy.h => hydro/Gadget2/hydro_iact.h} | 0
 src/runner.c                                             | 8 --------
 src/swift.h                                              | 8 ++------
 9 files changed, 10 insertions(+), 22 deletions(-)
 rename src/{runner_iact.h => hydro/Default/hydro_iact.h} (100%)
 rename src/{runner_iact_legacy.h => hydro/Gadget2/hydro_iact.h} (100%)

diff --git a/src/Makefile.am b/src/Makefile.am
index c71cbbbbd1..f682834e95 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -45,8 +45,8 @@ AM_SOURCES = space.c runner.c queue.c task.c cell.c engine.c \
 
 # Include files for distribution, not installation.
 noinst_HEADERS = atomic.h cycle.h error.h inline.h kernel.h vector.h \
-	runner_iact_legacy.h runner_iact_grav.h runner_doiact.h \
-	runner_doiact_grav.h units.h intrinsics.h
+		 runner_doiact.h runner_doiact_grav.h units.h intrinsics.h \
+		 hydro.h gravity.h
 
 # Sources and flags for regular library
 libswiftsim_la_SOURCES = $(AM_SOURCES)
diff --git a/src/engine.c b/src/engine.c
index 4d017a5a63..12fa647a6a 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -55,12 +55,6 @@
 #include "part.h"
 #include "timers.h"
 
-#ifdef LEGACY_GADGET2_SPH
-#include "runner_iact_legacy.h"
-#else
-#include "runner_iact.h"
-#endif
-
 const char *engine_policy_names[10] = {
     "none",   "rand",     "steal",     "keep", "block",
     "fix_dt", "multi_dt", "cpu_tight", "mpi",  "numa_affinity"};
diff --git a/src/gravity.h b/src/gravity.h
index 390d529f94..0f28055b07 100644
--- a/src/gravity.h
+++ b/src/gravity.h
@@ -24,5 +24,6 @@
 /* So far only one model here */
 /* Straight-forward import */
 #include "./gravity/Default/gravity.h"
+#include "runner_iact_grav.h"
 
 #endif
diff --git a/src/gravity/Default/gravity.h b/src/gravity/Default/gravity.h
index cd7a7d6a15..6e739546e1 100644
--- a/src/gravity/Default/gravity.h
+++ b/src/gravity/Default/gravity.h
@@ -16,6 +16,9 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  ******************************************************************************/
+
+#include <float.h>
+
 /**
  * @brief Computes the gravity time-step of a given particle
  *
diff --git a/src/hydro.h b/src/hydro.h
index 19b5e7a2b4..c57c60d696 100644
--- a/src/hydro.h
+++ b/src/hydro.h
@@ -24,8 +24,10 @@
 /* Import the right functions */
 #ifdef LEGACY_GADGET2_SPH
 #include "./hydro/Gadget2/hydro.h"
+#include "./hydro/Gadget2/hydro_iact.h"
 #else
 #include "./hydro/Default/hydro.h"
+#include "./hydro/Default/hydro_iact.h"
 #endif
 
 #endif
diff --git a/src/runner_iact.h b/src/hydro/Default/hydro_iact.h
similarity index 100%
rename from src/runner_iact.h
rename to src/hydro/Default/hydro_iact.h
diff --git a/src/runner_iact_legacy.h b/src/hydro/Gadget2/hydro_iact.h
similarity index 100%
rename from src/runner_iact_legacy.h
rename to src/hydro/Gadget2/hydro_iact.h
diff --git a/src/runner.c b/src/runner.c
index adf740b013..98f9574412 100644
--- a/src/runner.c
+++ b/src/runner.c
@@ -45,14 +45,6 @@
 #include "hydro.h"
 #include "gravity.h"
 
-/* Include the right variant of the SPH interactions */
-#ifdef LEGACY_GADGET2_SPH
-#include "runner_iact_legacy.h"
-#else
-#include "runner_iact.h"
-#endif
-#include "runner_iact_grav.h"
-
 /* Orientation of the cell pairs */
 const float runner_shift[13 * 3] = {
     5.773502691896258e-01, 5.773502691896258e-01,  5.773502691896258e-01,
diff --git a/src/swift.h b/src/swift.h
index 1b7d86c769..95b0abba00 100644
--- a/src/swift.h
+++ b/src/swift.h
@@ -31,6 +31,8 @@
 #include "debug.h"
 #include "engine.h"
 #include "error.h"
+#include "gravity.h"
+#include "hydro.h"
 #include "lock.h"
 #include "map.h"
 #include "multipole.h"
@@ -48,11 +50,5 @@
 #include "tools.h"
 #include "version.h"
 
-#ifdef LEGACY_GADGET2_SPH
-#include "runner_iact_legacy.h"
-#else
-#include "runner_iact.h"
-#endif
-#include "runner_iact_grav.h"
 
 #endif /* SWIFT_SWIFT_H */
-- 
GitLab