From 929f97fb255de9f701a25969406a9ac247236f59 Mon Sep 17 00:00:00 2001
From: Folkert Nobels <nobels@strw.leidenuniv.nl>
Date: Mon, 17 Dec 2018 13:59:33 +0100
Subject: [PATCH] Allow multiple star models besides default

---
 src/Makefile.am                            |  2 ++
 src/part.h                                 |  8 ++++++++
 src/starformation/schaye08/starformation.h |  2 ++
 src/stars.h                                |  2 +-
 src/stars_io.h                             | 10 ++++++++++
 5 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index f405e61329..47fe6ad1e0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -135,6 +135,8 @@ nobase_noinst_HEADERS = align.h approx_math.h atomic.h barrier.h cycle.h error.h
 	 	 stars.h stars_io.h \
 		 stars/Default/stars.h stars/Default/stars_iact.h stars/Default/stars_io.h \
 		 stars/Default/stars_debug.h stars/Default/stars_part.h  \
+		 stars/EAGLE/stars.h stars/EAGLE/stars_iact.h stars/EAGLE/stars_io.h \
+		 stars/EAGLE/stars_debug.h stars/EAGLE/stars_part.h \
 	         potential/none/potential.h potential/point_mass/potential.h \
                  potential/isothermal/potential.h potential/disc_patch/potential.h \
                  potential/sine_wave/potential.h \
diff --git a/src/part.h b/src/part.h
index 64babf4a37..744bf6edf1 100644
--- a/src/part.h
+++ b/src/part.h
@@ -89,7 +89,15 @@
 #endif
 
 /* Import the right star particle definition */
+#if defined(STARS_NONE)
 #include "./stars/Default/stars_part.h"
+#elif defined(STARS_EAGLE)
+#include "./stars/EAGLE/stars_part.h"
+#elif defined(STARS_GEAR)
+#include "./stars/GEAR/stars_part.h"
+#else 
+#error "Invalid choice of star particle"
+#endif
 
 void part_relink_gparts_to_parts(struct part *parts, size_t N,
                                  ptrdiff_t offset);
diff --git a/src/starformation/schaye08/starformation.h b/src/starformation/schaye08/starformation.h
index c4d305c1e1..8c4e017944 100644
--- a/src/starformation/schaye08/starformation.h
+++ b/src/starformation/schaye08/starformation.h
@@ -34,6 +34,7 @@
 #include "cooling.h"
 #include "adiabatic_index.h"
 #include "cell.h" 
+#include "stars.h"
 
 /* Starformation struct */
 struct star_formation {
@@ -221,6 +222,7 @@ INLINE static void star_formation_copy_properties(
   struct spart *sp = cell_convert_part_to_spart(e, c, p, xp);
   sp->mass = p->mass;
   sp->mass_init = p->mass;
+  sp->age = cosmo->a;
   message("Copy Properties");
 
 }
diff --git a/src/stars.h b/src/stars.h
index b8edd6edd5..f1cd965c95 100644
--- a/src/stars.h
+++ b/src/stars.h
@@ -28,7 +28,7 @@
 #include "./stars/Default/stars_iact.h"
 #elif defined(STARS_EAGLE)
 #include "./stars/EAGLE/stars.h"
-#include "./stars/EAGLE/stars_iact.h" 
+#include "./stars/EAGLE/stars_iact.h"
 #elif defined(STARS_GEAR)
 #include "./stars/GEAR/stars.h" 
 #include "./stars/GEAR/stars_iact.h"
diff --git a/src/stars_io.h b/src/stars_io.h
index 046e90ee75..3f6610522f 100644
--- a/src/stars_io.h
+++ b/src/stars_io.h
@@ -20,7 +20,17 @@
 #define SWIFT_STARS_IO_H
 
 #include "./const.h"
+#include "../config.h"
 
+/* Load the correct star type */
+#if defined(STARS_NONE)
 #include "./stars/Default/stars_io.h"
+#elif defined(STARS_EAGLE)
+#include "./stars/EAGLE/stars_io.h"
+#elif defined(STARS_GEAR)
+#include "./stars/GEAR/stars_io.h"
+#else 
+#error "Invalid choice of star model"
+#endif
 
 #endif /* SWIFT_STARS_IO_H */
-- 
GitLab