Skip to content
Snippets Groups Projects
Commit f15c30bb authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Use index over particles not indices

parent 43b710d5
No related branches found
No related tags found
No related merge requests found
...@@ -447,7 +447,7 @@ void space_rebuild(struct space *s, double cell_max, int verbose) { ...@@ -447,7 +447,7 @@ void space_rebuild(struct space *s, double cell_max, int verbose) {
if ((ind = (int *)malloc(sizeof(int) * ind_size)) == NULL) if ((ind = (int *)malloc(sizeof(int) * ind_size)) == NULL)
error("Failed to allocate temporary particle indices."); error("Failed to allocate temporary particle indices.");
if (ind_size > 0) space_parts_get_cell_index(s, ind, cells_top, verbose); 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. */ /* Run through the gravity particles and get their cell index. */
const size_t gind_size = s->size_gparts; const size_t gind_size = s->size_gparts;
...@@ -455,7 +455,7 @@ void space_rebuild(struct space *s, double cell_max, int verbose) { ...@@ -455,7 +455,7 @@ void space_rebuild(struct space *s, double cell_max, int verbose) {
if ((gind = (int *)malloc(sizeof(int) * gind_size)) == NULL) if ((gind = (int *)malloc(sizeof(int) * gind_size)) == NULL)
error("Failed to allocate temporary g-particle indices."); error("Failed to allocate temporary g-particle indices.");
if (gind_size > 0) space_gparts_get_cell_index(s, gind, cells_top, verbose); 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 #ifdef WITH_MPI
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment