From 33c9cc37a48d2b69ae5af2dfc94688b7d7c1f132 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <schaller@strw.leidenuniv.nl> Date: Tue, 23 Oct 2018 14:37:12 +0200 Subject: [PATCH] Collect the number of inhibited particles in each space in engine_collect_end_of_step() --- src/engine.c | 7 ++++++- src/engine.h | 2 +- src/space.c | 5 +++++ src/space.h | 9 +++++++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/engine.c b/src/engine.c index 88d59f25ee..6d32ce4362 100644 --- a/src/engine.c +++ b/src/engine.c @@ -4868,7 +4868,7 @@ void engine_collect_end_of_step_mapper(void *map_data, int num_elements, void engine_collect_end_of_step(struct engine *e, int apply) { const ticks tic = getticks(); - const struct space *s = e->s; + struct space *s = e->s; struct end_of_step_data data; data.updated = 0, data.g_updated = 0, data.s_updated = 0; data.inhibited = 0, data.g_inhibited = 0, data.s_inhibited = 0; @@ -4883,6 +4883,11 @@ void engine_collect_end_of_step(struct engine *e, int apply) { s->local_cells_with_tasks_top, s->nr_local_cells_with_tasks, sizeof(int), 0, &data); + /* Store the local number of inhibited particles */ + s->nr_inhibited_parts = data.inhibited; + s->nr_inhibited_gparts = data.g_inhibited; + s->nr_inhibited_sparts = data.s_inhibited; + /* Store these in the temporary collection group. */ collectgroup1_init( &e->collect_group1, data.updated, data.g_updated, data.s_updated, diff --git a/src/engine.h b/src/engine.h index 7505a643cc..d81346d323 100644 --- a/src/engine.h +++ b/src/engine.h @@ -206,7 +206,7 @@ struct engine { long long total_nr_parts, total_nr_gparts, total_nr_sparts; /* The total number of inhibted particles in the system. */ - size_t nr_inhibited_parts, nr_inhibited_gparts, nr_inhibited_sparts; + long long nr_inhibited_parts, nr_inhibited_gparts, nr_inhibited_sparts; #ifdef SWIFT_DEBUG_CHECKS /* Total number of particles removed from the system since the last rebuild */ diff --git a/src/space.c b/src/space.c index 323dfdd722..9d405fbf83 100644 --- a/src/space.c +++ b/src/space.c @@ -1005,6 +1005,11 @@ void space_rebuild(struct space *s, int repartitioned, int verbose) { #endif /* WITH_MPI */ + /* Mark that there are no inhibited particles left */ + s->nr_inhibited_parts = 0; + s->nr_inhibited_gparts = 0; + s->nr_inhibited_sparts = 0; + /* Sort the gparts according to their cells. */ if (nr_gparts > 0) space_gparts_sort(s->gparts, s->parts, s->sparts, gind, cell_gpart_counts, diff --git a/src/space.h b/src/space.h index 7fb9cf1640..a39f59ffa4 100644 --- a/src/space.h +++ b/src/space.h @@ -146,6 +146,15 @@ struct space { /*! The total number of g-parts in the space. */ size_t nr_sparts, size_sparts; + /*! Number of inhibted gas particles in the space */ + size_t nr_inhibited_parts; + + /*! Number of inhibted gravity particles in the space */ + size_t nr_inhibited_gparts; + + /*! Number of inhibted star particles in the space */ + size_t nr_inhibited_sparts; + /*! The particle data (cells have pointers to this). */ struct part *parts; -- GitLab