diff --git a/src/fof.c b/src/fof.c index 8f51b4fff2c3f2758d85cd8451728b7e0f843240..db80aef43319153efafbe1bfad6e9b0c120c965d 100644 --- a/src/fof.c +++ b/src/fof.c @@ -290,19 +290,7 @@ void fof_allocate(const struct space *s, const long long total_nr_DM_particles, s->nr_gparts * sizeof(size_t)) != 0) error("Failed to allocate list of group size for FOF search."); - /* Set initial group ID of the gparts */ - const size_t group_id_default = props->group_id_default; - ticks tic = getticks(); - - threadpool_map(&s->e->threadpool, fof_set_initial_group_id_mapper, s->gparts, - s->nr_gparts, sizeof(struct gpart), 0, (void *)&group_id_default); - - if(verbose) - message("Setting initial group ID took: %.3f %s.", - clocks_from_ticks(getticks() - tic), clocks_getunit()); - - tic = getticks(); /* Set initial group index */ threadpool_map(&s->e->threadpool, fof_set_initial_group_index_mapper, @@ -2747,9 +2735,15 @@ void fof_search_tree(struct fof_props *props, qsort(high_group_sizes, num_groups_local, sizeof(struct group_length), cmp_func_group_size); + tic = getticks(); + /* Set default group ID for all particles */ - for (size_t i = 0; i < nr_gparts; i++) - gparts[i].fof_data.group_id = group_id_default; + threadpool_map(&s->e->threadpool, fof_set_initial_group_id_mapper, s->gparts, + s->nr_gparts, sizeof(struct gpart), 0, (void *)&group_id_default); + + if(verbose) + message("Setting default group ID took: %.3f %s.", + clocks_from_ticks(getticks() - tic), clocks_getunit()); /* Assign final group IDs to local root particles where the global root is * on this node and the group is large enough. Within a node IDs are