From f15c30bb57631391e13c156c68dbe4e3fdfca9ff Mon Sep 17 00:00:00 2001 From: "Peter W. Draper" <p.w.draper@durham.ac.uk> Date: Mon, 10 Oct 2016 16:28:47 +0100 Subject: [PATCH] Use index over particles not indices --- src/space.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/space.c b/src/space.c index 880264e8ee..d5a5e6d8a4 100644 --- a/src/space.c +++ b/src/space.c @@ -447,7 +447,7 @@ void space_rebuild(struct space *s, double cell_max, int verbose) { if ((ind = (int *)malloc(sizeof(int) * ind_size)) == NULL) error("Failed to allocate temporary particle indices."); if (ind_size > 0) space_parts_get_cell_index(s, ind, cells_top, verbose); - for (size_t i = 0; i < ind_size; ++i) cells_top[ind[i]].count++; + for (size_t i = 0; i < s->nr_parts; ++i) cells_top[ind[i]].count++; /* Run through the gravity particles and get their cell index. */ const size_t gind_size = s->size_gparts; @@ -455,7 +455,7 @@ void space_rebuild(struct space *s, double cell_max, int verbose) { if ((gind = (int *)malloc(sizeof(int) * gind_size)) == NULL) error("Failed to allocate temporary g-particle indices."); if (gind_size > 0) space_gparts_get_cell_index(s, gind, cells_top, verbose); - for (size_t i = 0; i < gind_size; ++i) cells_top[gind[i]].gcount++; + for (size_t i = 0; i < s->nr_gparts; ++i) cells_top[gind[i]].gcount++; #ifdef WITH_MPI -- GitLab