Commit 4aca34c7 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Only link the foreign stars and black holes if we are actually running with stars and black holes

parent d3493f3e
......@@ -1256,6 +1256,9 @@ void engine_allocate_foreign_particles(struct engine *e) {
#ifdef WITH_MPI
const int nr_proxies = e->nr_proxies;
const int with_hydro = e->policy & engine_policy_hydro;
const int with_stars = e->policy & engine_policy_stars;
const int with_black_holes = e->policy & engine_policy_black_holes;
struct space *s = e->s;
ticks tic = getticks();
......@@ -1284,6 +1287,17 @@ void engine_allocate_foreign_particles(struct engine *e) {
}
}
if (!with_hydro && count_parts_in)
error(
"Not running with hydro but about to receive gas particles in "
"proxies!");
if (!with_stars && count_sparts_in)
error("Not running with stars but about to receive stars in proxies!");
if (!with_black_holes && count_bparts_in)
error(
"Not running with black holes but about to receive black holes in "
"proxies!");
if (e->verbose)
message("Counting number of foreign particles took %.3f %s.",
clocks_from_ticks(getticks() - tic), clocks_getunit());
......@@ -1365,14 +1379,20 @@ void engine_allocate_foreign_particles(struct engine *e) {
gparts = &gparts[count_gparts];
}
/* For stars, we just use the numbers in the top-level cells */
cell_link_sparts(e->proxies[k].cells_in[j], sparts);
sparts =
&sparts[e->proxies[k].cells_in[j]->stars.count + space_extra_sparts];
if (with_stars) {
/* For black holes, we just use the numbers in the top-level cells */
cell_link_bparts(e->proxies[k].cells_in[j], bparts);
bparts = &bparts[e->proxies[k].cells_in[j]->black_holes.count];
/* For stars, we just use the numbers in the top-level cells */
cell_link_sparts(e->proxies[k].cells_in[j], sparts);
sparts = &sparts[e->proxies[k].cells_in[j]->stars.count +
space_extra_sparts];
}
if (with_black_holes) {
/* For black holes, we just use the numbers in the top-level cells */
cell_link_bparts(e->proxies[k].cells_in[j], bparts);
bparts = &bparts[e->proxies[k].cells_in[j]->black_holes.count];
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment