From 0af3c6e5397996bbcd90102a2671f0c7da05f665 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Mon, 25 Apr 2022 13:55:32 +0000
Subject: [PATCH] Remove the global pressure floor variable

---
 examples/main.c        |  1 +
 src/Makefile.am        |  2 +-
 src/engine_config.c    |  2 ++
 src/hydro_properties.c |  3 ---
 src/pressure_floor.c   | 24 ------------------------
 src/pressure_floor.h   |  2 --
 6 files changed, 4 insertions(+), 30 deletions(-)
 delete mode 100644 src/pressure_floor.c

diff --git a/examples/main.c b/examples/main.c
index 3144a12e61..1c340bbf7b 100644
--- a/examples/main.c
+++ b/examples/main.c
@@ -103,6 +103,7 @@ int main(int argc, char *argv[]) {
   struct feedback_props feedback_properties;
   struct rt_props rt_properties;
   struct entropy_floor_properties entropy_floor;
+  struct pressure_floor_props pressure_floor_props;
   struct black_holes_props black_holes_properties;
   struct fof_props fof_properties;
   struct lightcone_array_props lightcone_array_properties;
diff --git a/src/Makefile.am b/src/Makefile.am
index 3d45f7e511..979ba33b85 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -153,7 +153,7 @@ AM_SOURCES += collectgroup.c hydro_space.c equation_of_state.c io_compression.c
 AM_SOURCES += chemistry.c cosmology.c velociraptor_interface.c 
 AM_SOURCES += output_list.c velociraptor_dummy.c csds_io.c memuse.c mpiuse.c memuse_rnodes.c
 AM_SOURCES += fof.c fof_catalogue_io.c
-AM_SOURCES += hashmap.c pressure_floor.c
+AM_SOURCES += hashmap.c
 AM_SOURCES += mesh_gravity.c mesh_gravity_mpi.c mesh_gravity_patch.c mesh_gravity_sort.c
 AM_SOURCES += runner_neutrino.c
 AM_SOURCES += neutrino/Default/fermi_dirac.c neutrino/Default/neutrino.c neutrino/Default/neutrino_response.c 
diff --git a/src/engine_config.c b/src/engine_config.c
index c16840c507..42f7bf4666 100644
--- a/src/engine_config.c
+++ b/src/engine_config.c
@@ -37,6 +37,7 @@
 #include "fof.h"
 #include "mpiuse.h"
 #include "part.h"
+#include "pressure_floor.h"
 #include "proxy.h"
 #include "star_formation.h"
 #include "star_formation_logger.h"
@@ -491,6 +492,7 @@ void engine_config(int restart, int fof, struct engine *e,
     /* Print information about the hydro scheme */
     if (e->policy & engine_policy_hydro) {
       if (e->nodeID == 0) hydro_props_print(e->hydro_properties);
+      if (e->nodeID == 0) pressure_floor_print(e->pressure_floor_props);
       if (e->nodeID == 0) entropy_floor_print(e->entropy_floor);
     }
 
diff --git a/src/hydro_properties.c b/src/hydro_properties.c
index 001344fb85..65b3a04386 100644
--- a/src/hydro_properties.c
+++ b/src/hydro_properties.c
@@ -219,9 +219,6 @@ void hydro_props_print(const struct hydro_props *p) {
   /* Print equation of state first */
   eos_print(&eos);
 
-  /* Then the pressure floor */
-  pressure_floor_print(&pressure_floor_props);
-
   /* Now SPH */
   message("Hydrodynamic scheme: %s in %dD.", SPH_IMPLEMENTATION,
           (int)hydro_dimension);
diff --git a/src/pressure_floor.c b/src/pressure_floor.c
deleted file mode 100644
index d985721827..0000000000
--- a/src/pressure_floor.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * This file is part of SWIFT.
- * Copyright (c) 2019 Loic Hausammann (loic.hausammann@epfl.ch)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- ******************************************************************************/
-
-/* This object's header. */
-#include "pressure_floor.h"
-
-/* Pressure floor for the physics model. */
-struct pressure_floor_props pressure_floor_props;
diff --git a/src/pressure_floor.h b/src/pressure_floor.h
index e570460518..7637612930 100644
--- a/src/pressure_floor.h
+++ b/src/pressure_floor.h
@@ -32,8 +32,6 @@
 #include "error.h"
 #include "inline.h"
 
-extern struct pressure_floor_props pressure_floor_props;
-
 /* Check if pressure floor is implemented in hydro */
 #ifndef PRESSURE_FLOOR_NONE
 #if defined(GADGET2_SPH) || defined(HOPKINS_PU_SPH) || defined(SPHENIX_SPH)
-- 
GitLab