From 711d70ead556174a59f55f92d0f342419b035577 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Sat, 23 Feb 2019 17:21:27 +0100
Subject: [PATCH] Removed debugging messages.

---
 .../isolated_galaxy.yml                       |  6 ++---
 src/cell.h                                    |  8 ++-----
 src/error.h                                   |  2 +-
 src/runner.c                                  | 23 ++++++-------------
 src/runner_doiact_stars.h                     |  5 +---
 src/scheduler.c                               |  7 +++---
 src/scheduler.h                               |  3 ---
 src/space.c                                   |  2 --
 src/stars/Default/stars_iact.h                |  2 --
 tools/task_plots/analyse_tasks.py             |  6 ++++-
 tools/task_plots/plot_tasks.py                |  8 ++++++-
 11 files changed, 30 insertions(+), 42 deletions(-)

diff --git a/examples/IsolatedGalaxy/IsolatedGalaxy_starformation/isolated_galaxy.yml b/examples/IsolatedGalaxy/IsolatedGalaxy_starformation/isolated_galaxy.yml
index e96d3520a0..1bf7689b99 100644
--- a/examples/IsolatedGalaxy/IsolatedGalaxy_starformation/isolated_galaxy.yml
+++ b/examples/IsolatedGalaxy/IsolatedGalaxy_starformation/isolated_galaxy.yml
@@ -35,9 +35,9 @@ Statistics:
 
 # Parameters related to the initial conditions
 InitialConditions:
-  file_name:               lowres8.hdf5 # The file to read
-  periodic:                    0    # Are we running with periodic ICs?
-  stars_smoothing_length:      0.5
+  file_name:               fid.hdf5 # The file to read
+  periodic:                0    # Are we running with periodic ICs?
+  stars_smoothing_length:  0.5
   
 # Parameters for the hydrodynamics scheme
 SPH:
diff --git a/src/cell.h b/src/cell.h
index 40d525c7fd..c11cbbc741 100644
--- a/src/cell.h
+++ b/src/cell.h
@@ -496,8 +496,10 @@ struct cell {
     /*! The drift task for sparts */
     struct task *drift;
 
+    /*! Implicit tasks marking the entry of the stellar physics block of tasks */
     struct task *stars_in;
 
+    /*! Implicit tasks marking the exit of the stellar physics block of tasks */
     struct task *stars_out;
 
     /*! Max smoothing length in this cell. */
@@ -1042,12 +1044,9 @@ cell_need_rebuild_for_hydro_pair(const struct cell *ci, const struct cell *cj) {
   /* Is the cut-off radius plus the max distance the parts in both cells have */
   /* moved larger than the cell size ? */
   /* Note ci->dmin == cj->dmin */
-  /*return*/
-
   if (kernel_gamma * max(ci->hydro.h_max, cj->hydro.h_max) +
           ci->hydro.dx_max_part + cj->hydro.dx_max_part >
       cj->dmin) {
-    // error("Need rebuild hydro!");
     return 1;
   }
   return 0;
@@ -1065,12 +1064,9 @@ cell_need_rebuild_for_stars_pair(const struct cell *ci, const struct cell *cj) {
   /* Is the cut-off radius plus the max distance the parts in both cells have */
   /* moved larger than the cell size ? */
   /* Note ci->dmin == cj->dmin */
-  /* return */
-
   if (kernel_gamma * max(ci->stars.h_max, cj->hydro.h_max) +
           ci->stars.dx_max_part + cj->hydro.dx_max_part >
       cj->dmin) {
-    // error("Need rebuild stars!");
     return 1;
   }
   return 0;
diff --git a/src/error.h b/src/error.h
index 181a32c78b..d384ec56ba 100644
--- a/src/error.h
+++ b/src/error.h
@@ -54,7 +54,7 @@ extern int engine_rank;
     fprintf(stderr, "[%04i] %s %s:%s():%i: " s "\n", engine_rank,          \
             clocks_get_timesincestart(), __FILE__, __FUNCTION__, __LINE__, \
             ##__VA_ARGS__);                                                \
-    swift_abort(1);                                                        \
+    MPI_Abort(MPI_COMM_WORLD, -1);                                         \
   })
 #else
 #define error(s, ...)                                                      \
diff --git a/src/runner.c b/src/runner.c
index b07d8cd546..035e1ab3f3 100644
--- a/src/runner.c
+++ b/src/runner.c
@@ -558,11 +558,6 @@ void runner_do_star_formation(struct runner *r, struct cell *c, int timer) {
             /* Copy the properties of the gas particle to the star particle */
             star_formation_copy_properties(p, xp, sp, e, sf_props, cosmo,
                                            with_cosmology);
-
-            message(
-                "STAR FORMED!!!! c->ID=%d super->ID=%d c->depth=%d"
-                "c->maxdepth=%d",
-                c->cellID, c->super->cellID, c->depth, c->maxdepth);
           }
 
         } else { /* Are we not star-forming? */
@@ -576,11 +571,9 @@ void runner_do_star_formation(struct runner *r, struct cell *c, int timer) {
     }     /* Loop over particles */
   }
 
+  /* If we formed any stars, the star sorts are now invalid. We need to
+   * re-compute them. */
   if ((c == c->hydro.super) && (current_stars_count != c->stars.count)) {
-    message(
-        "Emergency sort! c->ID=%d c->depth=%d c->maxdepth=%d c=%p c->super=%p",
-        c->cellID, c->depth, c->maxdepth, c, c->hydro.super);
-
     cell_clear_stars_sort_flags(c, /*is_super=*/1);
     runner_do_stars_sort(r, c, 0x1FFF, /*cleanup=*/0, /*timer=*/0);
   }
@@ -2775,11 +2768,10 @@ void runner_do_end_grav_force(struct runner *r, struct cell *c, int timer) {
                 e->total_nr_gparts, e->s->nr_gparts, e->count_inhibited_gparts);
           }
         }
-      }
 #endif
+      }
     }
   }
-
   if (timer) TIMER_TOC(timer_end_grav_force);
 }
 
@@ -2793,7 +2785,6 @@ void runner_do_end_grav_force(struct runner *r, struct cell *c, int timer) {
  */
 void runner_do_recv_part(struct runner *r, struct cell *c, int clear_sorts,
                          int timer) {
-
 #ifdef WITH_MPI
 
   const struct part *restrict parts = c->hydro.parts;
@@ -2862,7 +2853,7 @@ void runner_do_recv_part(struct runner *r, struct cell *c, int clear_sorts,
   if (timer) TIMER_TOC(timer_dorecv_part);
 
 #else
-    error("SWIFT was not compiled with MPI support.");
+  error("SWIFT was not compiled with MPI support.");
 #endif
 }
 
@@ -2936,7 +2927,7 @@ void runner_do_recv_gpart(struct runner *r, struct cell *c, int timer) {
   if (timer) TIMER_TOC(timer_dorecv_gpart);
 
 #else
-    error("SWIFT was not compiled with MPI support.");
+  error("SWIFT was not compiled with MPI support.");
 #endif
 }
 
@@ -3022,7 +3013,7 @@ void runner_do_recv_spart(struct runner *r, struct cell *c, int clear_sorts,
   if (timer) TIMER_TOC(timer_dorecv_spart);
 
 #else
-    error("SWIFT was not compiled with MPI support.");
+  error("SWIFT was not compiled with MPI support.");
 #endif
 }
 
@@ -3373,6 +3364,6 @@ void runner_do_logger(struct runner *r, struct cell *c, int timer) {
   if (timer) TIMER_TOC(timer_logger);
 
 #else
-    error("Logger disabled, please enable it during configuration");
+  error("Logger disabled, please enable it during configuration");
 #endif
 }
diff --git a/src/runner_doiact_stars.h b/src/runner_doiact_stars.h
index 4fa18328bc..f1210acad8 100644
--- a/src/runner_doiact_stars.h
+++ b/src/runner_doiact_stars.h
@@ -1413,10 +1413,7 @@ void DOSUB_PAIR1_STARS(struct runner *r, struct cell *ci, struct cell *cj,
 
       if (!(cj->stars.sorted & (1 << sid)) ||
           cj->stars.dx_max_sort_old > cj->dmin * space_maxreldx) {
-        error(
-            "Interacting unsorted cell (sparts)."
-            "c->stars.count=%d c->cellID=%d",
-            cj->stars.count, cj->cellID);
+        error("Interacting unsorted cell (sparts).");
       }
     }
 
diff --git a/src/scheduler.c b/src/scheduler.c
index e3f4462252..6f96b0ea93 100644
--- a/src/scheduler.c
+++ b/src/scheduler.c
@@ -100,9 +100,7 @@ static void scheduler_extend_unlocks(struct scheduler *s) {
 void scheduler_addunlock(struct scheduler *s, struct task *ta,
                          struct task *tb) {
 #ifdef SWIFT_DEBUG_CHECKS
-  if (ta == NULL)
-    error("Unlocking task is NULL. tb=%s/%s", taskID_names[tb->type],
-          subtaskID_names[tb->subtype]);
+  if (ta == NULL) error("Unlocking task is NULL.");
   if (tb == NULL) error("Unlocked task is NULL.");
 #endif
 
@@ -2095,6 +2093,9 @@ void scheduler_reweight(struct scheduler *s, int verbose) {
       case task_type_end_hydro_force:
         cost = wscale * count_i;
         break;
+      case task_type_end_grav_force:
+        cost = wscale * gcount_i;
+        break;
       case task_type_kick1:
         cost = wscale * count_i + wscale * gcount_i;
         break;
diff --git a/src/scheduler.h b/src/scheduler.h
index bc87f27f73..3fb1c2e43b 100644
--- a/src/scheduler.h
+++ b/src/scheduler.h
@@ -121,9 +121,6 @@ struct scheduler {
 __attribute__((always_inline)) INLINE static void scheduler_activate(
     struct scheduler *s, struct task *t) {
 
-  /* if(t->type == task_type_stars_sort) */
-  /*   message("Activating stars sort!!!"); */
-
   if (atomic_cas(&t->skip, 1, 0)) {
     t->wait = 0;
     int ind = atomic_inc(&s->active_count);
diff --git a/src/space.c b/src/space.c
index a9bf4ceb83..0d7621d480 100644
--- a/src/space.c
+++ b/src/space.c
@@ -331,11 +331,9 @@ void space_regrid(struct space *s, int verbose) {
         const struct cell *c =
             &s->cells_top[s->local_cells_with_particles_top[k]];
         if (c->hydro.h_max > h_max) {
-          message("hydro h_max=%e", c->hydro.h_max);
           h_max = c->hydro.h_max;
         }
         if (c->stars.h_max > h_max) {
-          message("stars h_max=%e", c->stars.h_max);
           h_max = c->stars.h_max;
         }
       }
diff --git a/src/stars/Default/stars_iact.h b/src/stars/Default/stars_iact.h
index 56cd570d6c..994ff98d01 100644
--- a/src/stars/Default/stars_iact.h
+++ b/src/stars/Default/stars_iact.h
@@ -78,8 +78,6 @@ runner_iact_nonsym_stars_feedback(float r2, const float *dx, float hi, float hj,
   /* Get the time derivative for h. */
   si->feedback.h_dt -= mj * dvdr * ri / rhoj * wi_dr;
 
-  // message("Feedback!");
-
 #ifdef DEBUG_INTERACTIONS_STARS
   /* Update ngb counters */
   if (si->num_ngb_force < MAX_NUM_OF_NEIGHBOURS_STARS)
diff --git a/tools/task_plots/analyse_tasks.py b/tools/task_plots/analyse_tasks.py
index e897424a95..fc9df0e479 100755
--- a/tools/task_plots/analyse_tasks.py
+++ b/tools/task_plots/analyse_tasks.py
@@ -76,9 +76,10 @@ TASKTYPES = [
     "ghost_out",
     "extra_ghost",
     "drift_part",
+    "drift_spart",
     "drift_gpart",
     "drift_gpart_out",
-    "end_force",
+    "hydro_end_force",
     "kick1",
     "kick2",
     "timestep",
@@ -90,9 +91,12 @@ TASKTYPES = [
     "grav_down_in",
     "grav_down",
     "grav_mesh",
+    "grav_end_force",
     "cooling",
     "star_formation",
     "logger",
+    "stars_in",
+    "stars_out",
     "stars_ghost_in",
     "stars_ghost",
     "stars_ghost_out",
diff --git a/tools/task_plots/plot_tasks.py b/tools/task_plots/plot_tasks.py
index 12fd4d241a..54f34b2f82 100755
--- a/tools/task_plots/plot_tasks.py
+++ b/tools/task_plots/plot_tasks.py
@@ -161,9 +161,10 @@ TASKTYPES = [
     "ghost_out",
     "extra_ghost",
     "drift_part",
+    "drift_spart",
     "drift_gpart",
     "drift_gpart_out",
-    "end_force",
+    "hydro_end_force",
     "kick1",
     "kick2",
     "timestep",
@@ -175,9 +176,12 @@ TASKTYPES = [
     "grav_down_in",
     "grav_down",
     "grav_mesh",
+    "grav_end_force",
     "cooling",
     "star_formation",
     "logger",
+    "stars_in",
+    "stars_out",
     "stars_ghost_in",
     "stars_ghost",
     "stars_ghost_out",
@@ -232,6 +236,8 @@ FULLTYPES = [
     "send/tend",
     "recv/gpart",
     "send/gpart",
+    "recv/spart",
+    "send/spart",
     "self/stars_density",
     "pair/stars_density",
     "sub_self/stars_density",
-- 
GitLab