diff --git a/src/cell.c b/src/cell.c index 3eb8b072de3fc26aefdfc6f4f8757ec10ee8280f..b9998653ce96937cc628739b670b63b17e4a7532 100644 --- a/src/cell.c +++ b/src/cell.c @@ -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. * diff --git a/src/cell.h b/src/cell.h index df5ef068501f54b7448582e13a5990ad115245c2..e24352e41113ccfc1a07ee0581e0b66481a8b3ba 100644 --- a/src/cell.h +++ b/src/cell.h @@ -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); diff --git a/src/runner.c b/src/runner.c index 8c33b0951798cbe1d476929ec93bf759bd8d2135..b22c9a644de1a569666d1a73b0970f43c44f114f 100644 --- a/src/runner.c +++ b/src/runner.c @@ -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) { diff --git a/src/task.c b/src/task.c index 20b5447b097dc9ea8c89e7140b6a6cc9b36ff64a..89b141ca60062223d45f1732aa5a191d67e2aab5 100644 --- a/src/task.c +++ b/src/task.c @@ -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. */ diff --git a/src/task.h b/src/task.h index a28e31c37bccb661c5a1ee496183c3652a428de4..b73a93076935c2c76fa6074761e7f63d21e90379 100644 --- a/src/task.h +++ b/src/task.h @@ -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,