From 54be8998522794db8a4661dbaa91e44a3f824e48 Mon Sep 17 00:00:00 2001
From: Folkert Nobels <nobels@strw.leidenuniv.nl>
Date: Mon, 10 Dec 2018 16:59:30 +0100
Subject: [PATCH] Add the star formation struct to the main.c and engine_init

---
 examples/main.c | 8 +++++++-
 src/engine.h    | 3 +++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/examples/main.c b/examples/main.c
index db8d8f0d41..b997104245 100644
--- a/examples/main.c
+++ b/examples/main.c
@@ -90,6 +90,7 @@ int main(int argc, char *argv[]) {
   struct cooling_function_data cooling_func;
   struct cosmology cosmo;
   struct external_potential potential;
+  struct star_formation starform;
   struct pm_mesh mesh;
   struct gpart *gparts = NULL;
   struct gravity_props gravity_properties;
@@ -862,6 +863,11 @@ int main(int argc, char *argv[]) {
       cooling_init(params, &us, &prog_const, &cooling_func);
     if (myrank == 0) cooling_print(&cooling_func);
 
+    /* Initialise the star formation law and its properties */
+    if (with_star_formation) 
+    starformation_init(params, &prog_const, &us, &s, &starform);
+    if (myrank ==0) starformation_init(&starform);
+
     /* Initialise the chemistry */
     bzero(&chemistry, sizeof(struct chemistry_global_data));
     chemistry_init(params, &us, &prog_const, &chemistry);
@@ -890,7 +896,7 @@ int main(int argc, char *argv[]) {
     engine_init(&e, &s, params, N_total[0], N_total[1], N_total[2],
                 engine_policies, talking, &reparttype, &us, &prog_const, &cosmo,
                 &hydro_properties, &gravity_properties, &stars_properties,
-                &mesh, &potential, &cooling_func, &chemistry);
+                &mesh, &potential, &cooling_func, &starform, &chemistry);
     engine_config(0, &e, params, nr_nodes, myrank, nr_threads, with_aff,
                   talking, restart_file);
 
diff --git a/src/engine.h b/src/engine.h
index fea874435c..0a62e976b3 100644
--- a/src/engine.h
+++ b/src/engine.h
@@ -356,6 +356,9 @@ struct engine {
   /* Properties of the cooling scheme */
   struct cooling_function_data *cooling_func;
 
+  /* Properties of the starformation law */
+  const struct star_formation *star_formation;
+
   /* Properties of the chemistry model */
   const struct chemistry_global_data *chemistry;
 
-- 
GitLab