Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
91236c7f
Commit
91236c7f
authored
Jul 10, 2019
by
Matthieu Schaller
Browse files
Added communication tasks for the BH mergers.
parent
f874b6c9
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/cell.c
View file @
91236c7f
...
...
@@ -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.
*
...
...
src/cell.h
View file @
91236c7f
...
...
@@ -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
);
...
...
src/runner.c
View file @
91236c7f
...
...
@@ -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
b
parts) 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
)
{
...
...
src/task.c
View file @
91236c7f
...
...
@@ -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. */
...
...
src/task.h
View file @
91236c7f
...
...
@@ -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
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment