Skip to content
Snippets Groups Projects
Commit b5b6c6dc authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Use the correct offset for the particle arrays when re-linking.

parent 9a8b7e4a
Branches
Tags
1 merge request!716Delayed foreign allocation
......@@ -103,6 +103,11 @@ int cell_getsize(struct cell *c) {
*/
int cell_link_parts(struct cell *c, struct part *parts) {
#ifdef SWIFT_DEBUG_CHECKS
if(c->hydro.parts != NULL)
error("Linking parts into a cell that was already linked");
#endif
c->hydro.parts = parts;
/* Fill the progeny recursively, depth-first. */
......@@ -151,7 +156,7 @@ int cell_link_foreign_parts(struct cell *c, struct part *parts) {
int count = 0;
for (int k = 0; k < 8; k++) {
if (c->progeny[k] != NULL) {
count += cell_link_foreign_parts(c->progeny[k], parts);
count += cell_link_foreign_parts(c->progeny[k], &parts[count]);
}
}
return count;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment