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

Added communication tasks for the BH mergers.

parent f874b6c9
No related branches found
No related tags found
1 merge request!863Black holes mergers
......@@ -612,6 +612,28 @@ void cell_unpack_part_swallow(struct cell *c,
}
}
void cell_pack_bpart_swallow(const struct cell *c,
struct black_holes_bpart_data *data) {
const size_t count = c->black_holes.count;
const struct bpart *bparts = c->black_holes.parts;
for (size_t i = 0; i < count; ++i) {
data[i] = bparts[i].merger_data;
}
}
void cell_unpack_bpart_swallow(struct cell *c,
const struct black_holes_bpart_data *data) {
const size_t count = c->black_holes.count;
struct bpart *bparts = c->black_holes.parts;
for (size_t i = 0; i < count; ++i) {
bparts[i].merger_data = data[i];
}
}
/**
* @brief Unpack the data of a given cell and its sub-cells.
*
......
......@@ -818,6 +818,10 @@ void cell_pack_part_swallow(const struct cell *c,
struct black_holes_part_data *data);
void cell_unpack_part_swallow(struct cell *c,
const struct black_holes_part_data *data);
void cell_pack_bpart_swallow(const struct cell *c,
struct black_holes_bpart_data *data);
void cell_unpack_bpart_swallow(struct cell *c,
const struct black_holes_bpart_data *data);
int cell_pack_tags(const struct cell *c, int *tags);
int cell_unpack_tags(const int *tags, struct cell *c);
int cell_pack_end_step_hydro(struct cell *c, struct pcell_step_hydro *pcell);
......
......@@ -3990,13 +3990,15 @@ void runner_do_bh_swallow(struct runner *r, struct cell *c, int timer) {
} else {
/* Loop over all the gas particles in the cell
* Note that the cell (and hence the parts) may be local or foreign. */
* Note that the cell (and hence the bparts) may be local or foreign. */
const size_t nr_cell_bparts = c->black_holes.count;
for (size_t k = 0; k < nr_cell_bparts; k++) {
/* Get a handle on the part. */
struct bpart *const cell_bp = &cell_bparts[k];
message("OO");
/* Ignore inhibited particles (they have already been removed!) */
if (bpart_is_inhibited(cell_bp, e)) continue;
......@@ -4004,6 +4006,8 @@ void runner_do_bh_swallow(struct runner *r, struct cell *c, int timer) {
const long long swallow_id =
black_holes_get_bpart_swallow_id(&cell_bp->merger_data);
message("%lld", swallow_id);
/* Has this particle been flagged for swallowing? */
if (swallow_id >= 0) {
......@@ -4741,6 +4745,8 @@ void *runner_main(void *data) {
free(t->buff);
} else if (t->subtype == task_subtype_part_swallow) {
free(t->buff);
} else if (t->subtype == task_subtype_bpart_merger) {
free(t->buff);
}
break;
case task_type_recv:
......@@ -4771,6 +4777,10 @@ void *runner_main(void *data) {
cell_unpack_part_swallow(ci,
(struct black_holes_part_data *)t->buff);
free(t->buff);
} else if (t->subtype == task_subtype_bpart_merger) {
cell_unpack_bpart_swallow(ci,
(struct black_holes_bpart_data *)t->buff);
free(t->buff);
} else if (t->subtype == task_subtype_limiter) {
runner_do_recv_part(r, ci, 0, 1);
} else if (t->subtype == task_subtype_gpart) {
......
......@@ -100,13 +100,14 @@ const char *taskID_names[task_type_count] = {"none",
/* Sub-task type names. */
const char *subtaskID_names[task_subtype_count] = {
"none", "density", "gradient", "force",
"limiter", "grav", "external_grav", "tend_part",
"tend_gpart", "tend_spart", "tend_bpart", "xv",
"rho", "part_swallow", "gpart", "multipole",
"spart", "stars_density", "stars_feedback", "sf_count",
"bpart_rho", "bpart_swallow", "bpart_feedback", "bh_density",
"bh_swallow", "do_gas_swallow", "do_bh_swallow", "bh_feedback"};
"none", "density", "gradient", "force",
"limiter", "grav", "external_grav", "tend_part",
"tend_gpart", "tend_spart", "tend_bpart", "xv",
"rho", "part_swallow", "bpart_merger", "gpart",
"multipole", "spart", "stars_density", "stars_feedback",
"sf_count", "bpart_rho", "bpart_swallow", "bpart_feedback",
"bh_density", "bh_swallow", "do_gas_swallow", "do_bh_swallow",
"bh_feedback"};
#ifdef WITH_MPI
/* MPI communicators for the subtypes. */
......
......@@ -113,6 +113,7 @@ enum task_subtypes {
task_subtype_xv,
task_subtype_rho,
task_subtype_part_swallow,
task_subtype_bpart_merger,
task_subtype_gpart,
task_subtype_multipole,
task_subtype_spart,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment