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
d578629b
Commit
d578629b
authored
Aug 21, 2017
by
Matthieu Schaller
Browse files
Restored the old behaviour of the external gravity tasks.
parent
b3575963
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/cell.c
View file @
d578629b
...
...
@@ -1401,8 +1401,13 @@ void cell_activate_sorts(struct cell *c, int sid, struct scheduler *s) {
}
/**
* @brief Traverse a sub-cell task and activate the drift and sort tasks along
* the way.
* @brief Traverse a sub-cell task and activate the hydro drift tasks that are
* required
* by a hydro task
*
* @param ci The first #cell we recurse in.
* @param cj The second #cell we recurse in.
* @param s The task #scheduler.
*/
void
cell_activate_subcell_tasks
(
struct
cell
*
ci
,
struct
cell
*
cj
,
struct
scheduler
*
s
)
{
...
...
@@ -1670,7 +1675,13 @@ void cell_activate_subcell_tasks(struct cell *ci, struct cell *cj,
}
/**
* @brief Traverse a sub-cell task and activate the gravity drift tasks
* @brief Traverse a sub-cell task and activate the gravity drift tasks that are
* required
* by a self gravity task.
*
* @param ci The first #cell we recurse in.
* @param cj The second #cell we recurse in.
* @param s The task #scheduler.
*/
void
cell_activate_subcell_grav_tasks
(
struct
cell
*
ci
,
struct
cell
*
cj
,
struct
scheduler
*
s
)
{
...
...
@@ -1795,6 +1806,40 @@ void cell_activate_subcell_grav_tasks(struct cell *ci, struct cell *cj,
}
}
/**
* @brief Traverse a sub-cell task and activate the gravity drift tasks that are
* required
* by an external gravity task.
*
* @param ci The #cell we recurse in.
* @param s The task #scheduler.
*/
void
cell_activate_subcell_external_grav_tasks
(
struct
cell
*
ci
,
struct
scheduler
*
s
)
{
/* Some constants */
const
struct
space
*
sp
=
s
->
space
;
const
struct
engine
*
e
=
sp
->
e
;
/* Do anything? */
if
(
!
cell_is_active
(
ci
,
e
))
return
;
/* Recurse? */
if
(
ci
->
split
)
{
/* Loop over all progenies (no need for pairs for self-gravity) */
for
(
int
j
=
0
;
j
<
8
;
j
++
)
{
if
(
ci
->
progeny
[
j
]
!=
NULL
)
{
cell_activate_subcell_external_grav_tasks
(
ci
->
progeny
[
j
],
s
);
}
}
}
else
{
/* We have reached the bottom of the tree: activate gpart drift */
cell_activate_drift_gpart
(
ci
,
s
);
}
}
/**
* @brief Un-skips all the tasks associated with a given cell and checks
* if the space needs to be rebuilt.
...
...
@@ -1987,7 +2032,10 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) {
scheduler_activate
(
s
,
t
);
/* Set the drifting flags */
if
(
t
->
type
==
task_type_self
)
{
if
(
t
->
type
==
task_type_self
&&
t
->
subtype
==
task_subtype_external_grav
)
{
cell_activate_subcell_external_grav_tasks
(
t
->
ci
,
s
);
}
else
if
(
t
->
type
==
task_type_self
&&
t
->
subtype
==
task_subtype_grav
)
{
cell_activate_subcell_grav_tasks
(
t
->
ci
,
NULL
,
s
);
}
else
if
(
t
->
type
==
task_type_pair
)
{
cell_activate_subcell_grav_tasks
(
t
->
ci
,
t
->
cj
,
s
);
...
...
src/cell.h
View file @
d578629b
...
...
@@ -408,6 +408,8 @@ void cell_activate_subcell_tasks(struct cell *ci, struct cell *cj,
struct
scheduler
*
s
);
void
cell_activate_subcell_grav_tasks
(
struct
cell
*
ci
,
struct
cell
*
cj
,
struct
scheduler
*
s
);
void
cell_activate_subcell_external_grav_tasks
(
struct
cell
*
ci
,
struct
scheduler
*
s
);
void
cell_activate_drift_part
(
struct
cell
*
c
,
struct
scheduler
*
s
);
void
cell_activate_drift_gpart
(
struct
cell
*
c
,
struct
scheduler
*
s
);
void
cell_activate_sorts
(
struct
cell
*
c
,
int
sid
,
struct
scheduler
*
s
);
...
...
src/engine.c
View file @
d578629b
...
...
@@ -196,7 +196,7 @@ void engine_make_hierarchical_tasks(struct engine *e, struct cell *c) {
scheduler_addunlock
(
s
,
c
->
kick2
,
c
->
timestep
);
scheduler_addunlock
(
s
,
c
->
timestep
,
c
->
kick1
);
/* Add the gravity tasks */
/* Add the
self-
gravity tasks */
if
(
is_self_gravity
)
{
/* Initialisation of the multipoles */
...
...
@@ -217,8 +217,10 @@ void engine_make_hierarchical_tasks(struct engine *e, struct cell *c) {
scheduler_addunlock
(
s
,
c
->
grav_down
,
c
->
kick2
);
}
/*
Generate the ghost
tasks
.
*/
/*
Add the hydrodynamics
tasks */
if
(
is_with_hydro
)
{
/* Generate the ghost tasks. */
c
->
ghost_in
=
scheduler_addtask
(
s
,
task_type_ghost
,
task_subtype_none
,
0
,
/* implicit = */
1
,
c
,
NULL
);
...
...
src/scheduler.c
View file @
d578629b
...
...
@@ -695,7 +695,7 @@ void scheduler_splittasks_mapper(void *map_data, int num_elements,
scheduler_splittask_gravity
(
t
,
s
);
}
else
if
(
t
->
type
==
task_type_grav_top_level
||
t
->
type
==
task_type_grav_ghost
)
{
/
/ MATTHIEU: for the future
/
* For future use */
}
else
{
error
(
"Unexpected task sub-type"
);
}
...
...
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