Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
91236c7f
Commit
91236c7f
authored
6 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Added communication tasks for the BH mergers.
parent
f874b6c9
No related branches found
No related tags found
1 merge request
!863
Black holes mergers
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
src/cell.c
+22
-0
22 additions, 0 deletions
src/cell.c
src/cell.h
+4
-0
4 additions, 0 deletions
src/cell.h
src/runner.c
+11
-1
11 additions, 1 deletion
src/runner.c
src/task.c
+8
-7
8 additions, 7 deletions
src/task.c
src/task.h
+1
-0
1 addition, 0 deletions
src/task.h
with
46 additions
and
8 deletions
src/cell.c
+
22
−
0
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.
*
...
...
This diff is collapsed.
Click to expand it.
src/cell.h
+
4
−
0
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
);
...
...
This diff is collapsed.
Click to expand it.
src/runner.c
+
11
−
1
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
)
{
...
...
This diff is collapsed.
Click to expand it.
src/task.c
+
8
−
7
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. */
...
...
This diff is collapsed.
Click to expand it.
src/task.h
+
1
−
0
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
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment