Commit b27c40b1 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Fixed a bug (reported by Stefan) that was leading to the creation of external...

Fixed a bug (reported by Stefan) that was leading to the creation of external gravity pair tasks in scheduler_splittasks()
parent 7c2f75fa
......@@ -1379,6 +1379,9 @@ void engine_count_and_link_tasks(struct engine *e) {
engine_addlink(e, &ci->grav, t);
engine_addlink(e, &cj->grav, t);
}
if (t->subtype == task_subtype_external_grav) {
error("Found a pair/external-gravity task...");
}
/* Link sub-self tasks to cells. */
} else if (t->type == task_type_sub_self) {
......@@ -1407,8 +1410,6 @@ void engine_count_and_link_tasks(struct engine *e) {
}
if (t->subtype == task_subtype_external_grav) {
error("Found a sub-pair/external-gravity task...");
engine_addlink(e, &ci->grav, t);
engine_addlink(e, &cj->grav, t);
}
}
}
......
......@@ -1279,7 +1279,7 @@ void *runner_main(void *data) {
else if (t->subtype == task_subtype_external_grav)
runner_do_grav_external(r, ci, 1);
else
error("Unknown task subtype.");
error("Unknown/invalid task subtype (%d).", t->subtype);
break;
case task_type_pair:
......@@ -1293,10 +1293,8 @@ void *runner_main(void *data) {
runner_dopair2_force(r, ci, cj);
else if (t->subtype == task_subtype_grav)
runner_dopair_grav(r, ci, cj, 1);
else if (t->subtype == task_subtype_external_grav)
error("Found a pair/external-gravity task...");
else
error("Unknown task subtype.");
error("Unknown/invalid task subtype (%d).", t->subtype);
break;
case task_type_sub_self:
......@@ -1313,7 +1311,7 @@ void *runner_main(void *data) {
else if (t->subtype == task_subtype_external_grav)
runner_do_grav_external(r, ci, 1);
else
error("Unknown task subtype.");
error("Unknown/invalid task subtype (%d).", t->subtype);
break;
case task_type_sub_pair:
......@@ -1327,10 +1325,8 @@ void *runner_main(void *data) {
runner_dosub_pair2_force(r, ci, cj, t->flags, 1);
else if (t->subtype == task_subtype_grav)
runner_dosub_grav(r, ci, cj, 1);
else if (t->subtype == task_subtype_external_grav)
error("Found a sub-pair/external-gravity task...");
else
error("Unknown task subtype.");
error("Unknown/invalid task subtype (%d).", t->subtype);
break;
case task_type_sort:
......@@ -1386,7 +1382,7 @@ void *runner_main(void *data) {
runner_do_sourceterms(r, t->ci, 1);
break;
default:
error("Unknown task type.");
error("Unknown/invalid task type (%d).", t->type);
}
/* We're done with this task, see if we get a next one. */
......
......@@ -183,16 +183,19 @@ static void scheduler_splittask(struct task *t, struct scheduler *s) {
ci->progeny[k], NULL, 0),
s);
/* Make a task for each pair of progeny. */
for (int j = 0; j < 8; j++)
if (ci->progeny[j] != NULL)
for (int k = j + 1; k < 8; k++)
if (ci->progeny[k] != NULL)
scheduler_splittask(
scheduler_addtask(s, task_type_pair, t->subtype,
pts[j][k], 0, ci->progeny[j],
ci->progeny[k], 0),
s);
/* Make a task for each pair of progeny unless it's ext. gravity. */
if (t->subtype != task_subtype_external_grav) {
for (int j = 0; j < 8; j++)
if (ci->progeny[j] != NULL)
for (int k = j + 1; k < 8; k++)
if (ci->progeny[k] != NULL)
scheduler_splittask(
scheduler_addtask(s, task_type_pair, t->subtype,
pts[j][k], 0, ci->progeny[j],
ci->progeny[k], 0),
s);
}
}
}
......
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