From b09f0c44383d0a76d5e3822762daf491db9dd8cc Mon Sep 17 00:00:00 2001
From: Folkert Nobels <nobels@strw.leidenuniv.nl>
Date: Tue, 18 Dec 2018 11:28:38 +0100
Subject: [PATCH] Add additional arguments to the star formation function such
 that we can use the function cooling_get_temperature()

---
 src/runner.c                               |  5 ++++-
 src/starformation/schaye08/starformation.h | 10 +++++++---
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/runner.c b/src/runner.c
index 732f498193..b99ab57f2d 100644
--- a/src/runner.c
+++ b/src/runner.c
@@ -472,6 +472,9 @@ void runner_do_star_formation(struct runner *r, struct cell *c, int timer) {
   struct part *restrict parts = c->hydro.parts;
   struct xpart *restrict xparts = c->hydro.xparts;
   const int with_cosmology = (e->policy & engine_policy_cosmology);
+  const struct hydro_props *restrict hydro_props = e->hydro_properties;
+  const struct unit_system *restrict us = e->internal_units;
+  struct cooling_function_data *restrict cooling = e->cooling_func;
 
   TIMER_TIC;
 
@@ -494,7 +497,7 @@ void runner_do_star_formation(struct runner *r, struct cell *c, int timer) {
       if (part_is_active(p, e)) {
 
         //const float rho = hydro_get_physical_density(p, cosmo);
-        if (star_formation_convert_to_star(starform, p, xp, constants, cosmo) ) {
+        if (star_formation_convert_to_star(starform, p, xp, constants, cosmo, hydro_props, us, cooling) ) {
           star_formation_copy_properties(e, c, p, xp, starform, constants, cosmo, with_cosmology);
         //struct spart *sp =        cell_conert_part_to_spart(c, p, ...);
         }
diff --git a/src/starformation/schaye08/starformation.h b/src/starformation/schaye08/starformation.h
index 23f1285c18..4ba8360c6c 100644
--- a/src/starformation/schaye08/starformation.h
+++ b/src/starformation/schaye08/starformation.h
@@ -124,7 +124,9 @@ struct star_formation {
 INLINE static int star_formation_potential_to_become_star(
     const struct star_formation* starform, const struct part* restrict p,
     const struct xpart* restrict xp, const struct phys_const* const phys_const,
-    const struct cosmology* cosmo){
+    const struct cosmology* cosmo, const struct hydro_props *restrict hydro_props,
+    const struct unit_system *restrict us, 
+    const struct cooling_function_data *restrict cooling){
 
   /* Read the critical overdensity factor and the critical density of 
    * the universe to determine the critical density to form stars*/
@@ -192,9 +194,11 @@ INLINE static int star_formation_potential_to_become_star(
 INLINE static int star_formation_convert_to_star(
     const struct star_formation* starform, const struct part* restrict p,
     const struct xpart* restrict xp, const struct phys_const* const phys_const,
-    const struct cosmology* cosmo) {
+    const struct cosmology* cosmo, const struct hydro_props *restrict hydro_props,
+    const struct unit_system *restrict us, 
+    const struct cooling_function_data *restrict cooling) {
 
-  if (star_formation_potential_to_become_star(starform, p, xp, phys_const, cosmo)){
+  if (star_formation_potential_to_become_star(starform, p, xp, phys_const, cosmo, hydro_props, us, cooling)){
     /* Get the pressure */
     const double pressure = starform->EOS_pressure_norm 
     * pow(p->rho/starform->EOS_den0, starform->polytropic_index);
-- 
GitLab