From 21e886b81b24a3b4a79c33be23ec07161d504cb4 Mon Sep 17 00:00:00 2001
From: Folkert Nobels <nobels@strw.leidenuniv.nl>
Date: Mon, 10 Dec 2018 14:50:32 +0100
Subject: [PATCH] Change static functions to non static functions and some
 other minor things

---
 src/Makefile.am                            | 2 +-
 src/engine.c                               | 8 ++++++++
 src/runner.c                               | 2 +-
 src/starformation/none/starformation.h     | 8 ++++----
 src/starformation/schaye08/starformation.h | 8 ++++----
 5 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 020fcb1722..f405e61329 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -63,7 +63,7 @@ AM_SOURCES = space.c runner.c queue.c task.c cell.c engine.c engine_maketasks.c
     proxy.c parallel_io.c units.c common_io.c single_io.c multipole.c version.c map.c \
     kernel_hydro.c tools.c part.c partition.c clocks.c parser.c \
     physical_constants.c potential.c hydro_properties.c \
-    threadpool.c cooling.c sourceterms.c starformation.c \
+    threadpool.c cooling.c starformation.c \
     statistics.c runner_doiact_vec.c profiler.c dump.c logger.c \
     part_type.c xmf.c gravity_properties.c gravity.c \
     collectgroup.c hydro_space.c equation_of_state.c \
diff --git a/src/engine.c b/src/engine.c
index ce9153e8c8..d032349a0f 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -4054,6 +4054,7 @@ void engine_init(struct engine *e, struct space *s, struct swift_params *params,
                  struct pm_mesh *mesh,
                  const struct external_potential *potential,
                  struct cooling_function_data *cooling_func,
+                 const struct star_formation *starform,
                  const struct chemistry_global_data *chemistry) {
 
   /* Clean-up everything */
@@ -4116,6 +4117,7 @@ void engine_init(struct engine *e, struct space *s, struct swift_params *params,
   e->mesh = mesh;
   e->external_potential = potential;
   e->cooling_func = cooling_func;
+  e->star_formation = starform;
   e->chemistry = chemistry;
   e->parameter_file = params;
   e->cell_loc = NULL;
@@ -5227,6 +5229,7 @@ void engine_struct_dump(struct engine *e, FILE *stream) {
   pm_mesh_struct_dump(e->mesh, stream);
   potential_struct_dump(e->external_potential, stream);
   cooling_struct_dump(e->cooling_func, stream);
+  starformation_struct_dump(e->star_formation, stream);
   chemistry_struct_dump(e->chemistry, stream);
   parser_struct_dump(e->parameter_file, stream);
   if (e->output_list_snapshots)
@@ -5318,6 +5321,11 @@ void engine_struct_restore(struct engine *e, FILE *stream) {
   cooling_struct_restore(cooling_func, stream, e->cosmology);
   e->cooling_func = cooling_func;
 
+  struct star_formation *star_formation = (struct star_formation *)malloc(sizeof( 
+  struct star_formation));
+  starformation_struct_restore(star_formation, stream);
+  e->star_formation = star_formation;
+
   struct chemistry_global_data *chemistry =
       (struct chemistry_global_data *)malloc(
           sizeof(struct chemistry_global_data));
diff --git a/src/runner.c b/src/runner.c
index bd6919411d..686dbc0f16 100644
--- a/src/runner.c
+++ b/src/runner.c
@@ -491,7 +491,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);
+        //const float rho = hydro_get_physical_density(p, cosmo);
 
         if (starformation_potential_to_become_star(starform, p, xp, constants, cosmo) ) {
           starformation_convert_to_gas(starform, p, xp, cosmo);
diff --git a/src/starformation/none/starformation.h b/src/starformation/none/starformation.h
index 953b1f038a..e1a949fdc1 100644
--- a/src/starformation/none/starformation.h
+++ b/src/starformation/none/starformation.h
@@ -46,7 +46,7 @@ struct star_formation {};
  * @param cosmo the cosmological parameters and properties
  *
  * */
-static int starformation_potential_to_become_star(
+int starformation_potential_to_become_star(
     const struct star_formation* starform, const struct parts* p,
     const struct xparts* xp, const struct phys_const* const phys_const,
     const struct cosmology* cosmo){
@@ -63,7 +63,7 @@ static int starformation_potential_to_become_star(
  * @param cosmo the cosmological properties
  *
  * */
-static void starformation_convert_to_gas( 
+void starformation_convert_to_gas( 
     const struct star_formation* starform, const struct parts* p,
     const struct xparts* xp, const struct cosmology* cosmo) {}
 
@@ -76,7 +76,7 @@ static void starformation_convert_to_gas(
  * @param starform the star formation law properties to initialize
  *
  * */
-static void starformation_init_backend(
+void starformation_init_backend(
   struct swift_params* parameter_file, const struct phys_const* phys_const,
   const struct unit_system* us, const struct star_formation* starform) {}
 
@@ -84,7 +84,7 @@ static void starformation_init_backend(
  *
  * @param starform the star formation law properties.
  * */
-static void starformation_print_backend(
+void starformation_print_backend(
     const struct star_formation* starform){ 
 
   message("Star formation law is 'No Star Formation'");
diff --git a/src/starformation/schaye08/starformation.h b/src/starformation/schaye08/starformation.h
index eb569083b9..eac1c0710f 100644
--- a/src/starformation/schaye08/starformation.h
+++ b/src/starformation/schaye08/starformation.h
@@ -86,7 +86,7 @@ struct star_formation {
  * @param cosmo the cosmological parameters and properties
  *
  * */
-static int starformation_potential_to_become_star(
+int starformation_potential_to_become_star(
     const struct star_formation* starform, const struct parts* p,
     const struct xparts* xp, const struct phys_const* const phys_const,
     const struct cosmology* cosmo){
@@ -143,7 +143,7 @@ static int starformation_potential_to_become_star(
  * @param cosmo the cosmological properties
  *
  * */
-static void starformation_convert_to_gas( 
+void starformation_convert_to_gas( 
     const struct star_formation* starform, const struct parts* p,
     const struct xparts* xp, const struct cosmology* cosmo
     ){
@@ -174,7 +174,7 @@ static void starformation_convert_to_gas(
  * @param starform the star formation law properties to initialize
  *
  * */
-static void starformation_init_backend(
+void starformation_init_backend(
   struct swift_params* parameter_file, const struct phys_const* phys_const,
   const struct unit_system* us, const struct star_formation* starform) {
   
@@ -316,7 +316,7 @@ static void starformation_init_backend(
  *
  * @param starform the star formation law properties.
  * */
-static void starformation_print_backend(
+void starformation_print_backend(
     const struct star_formation* starform){ 
 
   message("Star formation law is Schaye and Dalla Vecchia (2008)"
-- 
GitLab