Commit 9293abcb authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Added the infrastructure for a new 'fixdt' kick task.

parent e32fe263
......@@ -59,8 +59,8 @@ pl.rcParams.update(PLOT_PARAMS)
# Tasks and subtypes. Indexed as in tasks.h.
TASKTYPES = ["none", "sort", "self", "pair", "sub", "init", "ghost", "drift",
"kick", "send", "recv", "grav_pp", "grav_mm", "grav_up",
"grav_down", "grav_external", "part_sort", "gpart_sort",
"kick", "kick_fixdt", "send", "recv", "grav_pp", "grav_mm",
"grav_up", "grav_down", "grav_external", "part_sort", "gpart_sort",
"split_cell", "rewait", "count"]
TASKCOLOURS = {"none": "black",
......@@ -72,6 +72,7 @@ TASKCOLOURS = {"none": "black",
"ghost": "cyan",
"drift": "maroon",
"kick": "green",
"kick_fixdt": "green",
"send": "yellow",
"recv": "magenta",
"grav_pp": "mediumorchid",
......
......@@ -65,8 +65,8 @@ pl.rcParams.update(PLOT_PARAMS)
# Tasks and subtypes. Indexed as in tasks.h.
TASKTYPES = ["none", "sort", "self", "pair", "sub", "init", "ghost", "drift",
"kick", "send", "recv", "grav_pp", "grav_mm", "grav_up",
"grav_down", "grav_external", "part_sort", "gpart_sort",
"kick", "kick_fixdt", "send", "recv", "grav_pp", "grav_mm",
"grav_up", "grav_down", "grav_external", "part_sort", "gpart_sort",
"split_cell", "rewait", "count"]
TASKCOLOURS = {"none": "black",
......@@ -78,6 +78,7 @@ TASKCOLOURS = {"none": "black",
"ghost": "cyan",
"drift": "maroon",
"kick": "green",
"kick_fixdt": "green",
"send": "yellow",
"recv": "magenta",
"grav_pp": "mediumorchid",
......
......@@ -112,6 +112,7 @@ void engine_make_hierarchical_tasks(struct engine *e, struct cell *c,
const int is_with_external_gravity =
(e->policy & engine_policy_external_gravity) ==
engine_policy_external_gravity;
const int is_fixdt = (e->policy & engine_policy_fixdt) == engine_policy_fixdt;
/* Am I the super-cell? */
if (super == NULL && (c->count > 0 || c->gcount > 0)) {
......@@ -130,9 +131,14 @@ void engine_make_hierarchical_tasks(struct engine *e, struct cell *c,
c->drift = scheduler_addtask(s, task_type_drift, task_subtype_none, 0, 0,
c, NULL, 0);
/* Add the kick task. */
c->kick = scheduler_addtask(s, task_type_kick, task_subtype_none, 0, 0, c,
NULL, 0);
/* Add the kick task that matches the policy. */
if (is_fixdt) {
c->kick = scheduler_addtask(s, task_type_kick_fixdt, task_subtype_none,
0, 0, c, NULL, 0);
} else {
c->kick = scheduler_addtask(s, task_type_kick, task_subtype_none, 0, 0,
c, NULL, 0);
}
if (c->count > 0) {
......@@ -2102,11 +2108,17 @@ void engine_step(struct engine *e) {
/* Build the masks corresponding to the policy */
unsigned int mask = 0, submask = 0;
/* We always have sort tasks and kick tasks */
/* We always have sort tasks and init tasks */
mask |= 1 << task_type_sort;
mask |= 1 << task_type_kick;
mask |= 1 << task_type_init;
/* Add the correct kick task */
if (e->policy & engine_policy_fixdt) {
mask |= 1 << task_type_kick_fixdt;
} else {
mask |= 1 << task_type_kick;
}
/* Add the tasks corresponding to hydro operations to the masks */
if (e->policy & engine_policy_hydro) {
......
......@@ -1371,6 +1371,9 @@ void *runner_main(void *data) {
case task_type_kick:
runner_do_kick(r, ci, 1);
break;
case task_type_kick_fixdt:
runner_do_kick(r, ci, 1);
break;
case task_type_send:
break;
case task_type_recv:
......
......@@ -47,10 +47,11 @@
/* Task type names. */
const char *taskID_names[task_type_count] = {
"none", "sort", "self", "pair", "sub",
"init", "ghost", "drift", "kick", "send",
"recv", "grav_pp", "grav_mm", "grav_up", "grav_down",
"grav_external", "part_sort", "gpart_sort", "split_cell", "rewait"};
"none", "sort", "self", "pair", "sub",
"init", "ghost", "drift", "kick", "kick_fixdt",
"send", "recv", "grav_pp", "grav_mm", "grav_up",
"grav_down", "grav_external", "part_sort", "gpart_sort", "split_cell",
"rewait"};
const char *subtaskID_names[task_type_count] = {"none", "density",
"force", "grav"};
......
......@@ -42,6 +42,7 @@ enum task_types {
task_type_ghost,
task_type_drift,
task_type_kick,
task_type_kick_fixdt,
task_type_send,
task_type_recv,
task_type_grav_pp,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment