From 13dbe2ab30597784df32bb62f819dbc38bbfb5d7 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Thu, 14 Feb 2019 15:58:17 +0100
Subject: [PATCH] Only use one task type for the local and foreign spart sorts.

---
 src/runner.c    |  3 +--
 src/scheduler.c |  6 ++----
 src/task.c      | 12 ++++--------
 src/task.h      |  7 +++----
 4 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/src/runner.c b/src/runner.c
index 0bd185cb16..00505b880c 100644
--- a/src/runner.c
+++ b/src/runner.c
@@ -3118,8 +3118,7 @@ void *runner_main(void *data) {
           /* Reset the sort flags as our work here is done. */
           t->flags = 0;
           break;
-        case task_type_stars_sort_local:
-        case task_type_stars_sort_foreign:
+      case task_type_stars_sort:
           /* Cleanup only if any of the indices went stale. */
           runner_do_stars_sort(
               r, ci, t->flags,
diff --git a/src/scheduler.c b/src/scheduler.c
index 64b01f9209..1fa3102305 100644
--- a/src/scheduler.c
+++ b/src/scheduler.c
@@ -1995,8 +1995,7 @@ void scheduler_reweight(struct scheduler *s, int verbose) {
                (sizeof(int) * 8 - intrinsics_clz(t->ci->hydro.count));
         break;
 
-      case task_type_stars_sort_local:
-      case task_type_stars_sort_foreign:
+      case task_type_stars_sort:
         cost = wscale * intrinsics_popcount(t->flags) * scount_i *
                (sizeof(int) * 8 - intrinsics_clz(t->ci->stars.count));
         break;
@@ -2280,8 +2279,7 @@ void scheduler_enqueue(struct scheduler *s, struct task *t) {
       case task_type_kick2:
       case task_type_stars_ghost:
       case task_type_logger:
-      case task_type_stars_sort_local:
-      case task_type_stars_sort_foreign:
+      case task_type_stars_sort:
       case task_type_timestep:
         qid = t->ci->super->owner;
         break;
diff --git a/src/task.c b/src/task.c
index 6d3443d9e1..d85587458f 100644
--- a/src/task.c
+++ b/src/task.c
@@ -81,8 +81,7 @@ const char *taskID_names[task_type_count] = {"none",
                                              "stars_ghost_in",
                                              "stars_ghost",
                                              "stars_ghost_out",
-                                             "stars_sort_local",
-                                             "stars_sort_foreign"};
+                                             "stars_sort"};
 
 /* Sub-task type names. */
 const char *subtaskID_names[task_subtype_count] = {
@@ -152,8 +151,7 @@ __attribute__((always_inline)) INLINE static enum task_actions task_acts_on(
       return task_action_all;
 
     case task_type_stars_ghost:
-    case task_type_stars_sort_local:
-    case task_type_stars_sort_foreign:
+    case task_type_stars_sort:
       return task_action_spart;
       break;
 
@@ -355,8 +353,7 @@ void task_unlock(struct task *t) {
       cell_gunlocktree(ci);
       break;
 
-    case task_type_stars_sort_local:
-    case task_type_stars_sort_foreign:
+    case task_type_stars_sort:
       cell_sunlocktree(ci);
       break;
 
@@ -479,8 +476,7 @@ int task_lock(struct task *t) {
       if (cell_locktree(ci) != 0) return 0;
       break;
 
-    case task_type_stars_sort_local:
-    case task_type_stars_sort_foreign:
+    case task_type_stars_sort:
       if (ci->stars.hold) return 0;
       if (cell_slocktree(ci) != 0) return 0;
       break;
diff --git a/src/task.h b/src/task.h
index cc41b458a2..2ed07e6178 100644
--- a/src/task.h
+++ b/src/task.h
@@ -69,11 +69,10 @@ enum task_types {
   task_type_cooling,
   task_type_star_formation,
   task_type_logger,
-  task_type_stars_ghost_in,
+  task_type_stars_ghost_in, /* Implicit */
   task_type_stars_ghost,
-  task_type_stars_ghost_out,
-  task_type_stars_sort_local,
-  task_type_stars_sort_foreign,
+  task_type_stars_ghost_out, /* Implicit */
+  task_type_stars_sort,
   task_type_count
 } __attribute__((packed));
 
-- 
GitLab