diff --git a/src/cell.c b/src/cell.c index d0df3d2ebbcc04accea7316a8b4934e053d327b8..678d12dd7708960803d225e1bf2fff12e6cab7bd 100644 --- a/src/cell.c +++ b/src/cell.c @@ -840,7 +840,6 @@ int cell_is_drift_needed(struct cell *c, int ti_current) { return 0; } - /** * @brief Set the super-cell pointers for all cells in a hierarchy. * @@ -850,20 +849,15 @@ int cell_is_drift_needed(struct cell *c, int ti_current) { void cell_set_super(struct cell *c, struct cell *super) { /* Are we in a cell with some kind of self/pair task ? */ - if (c->nr_tasks > 0) super = c; + if (super == NULL && c->nr_tasks > 0) super = c; - //message("depth=%d nr_tasks=%d super=%p", c->depth, c->nr_tasks, super); - /* Set the super-cell */ c->super = super; - if(c->super == NULL) - message("depth=%d nr_tasks=%d super=%p count=%d loc=[%f %f %f], width=%f", - c->depth, c->nr_tasks, super, - c->count, c->loc[0], c->loc[1], c->loc[2], c->width[0]); - - /* Recurse if we are not in a hierarchy without any tasks. */ - if (c->split && super != NULL) + //if (c->nr_tasks == 0 && super == NULL) message("No tasks here"); + + /* Recurse */ + if (c->split) for (int k = 0; k < 8; k++) if (c->progeny[k] != NULL) cell_set_super(c->progeny[k], super); } diff --git a/src/engine.c b/src/engine.c index 78fd1a734fbdce836a2f1482c06c948d58ad645a..8e7b68fb5749bc97de4d997a86b8a135c4d3668b 100644 --- a/src/engine.c +++ b/src/engine.c @@ -120,48 +120,55 @@ void engine_addlink(struct engine *e, struct link **l, struct task *t) { * @param c The #cell. * @param gsuper The gsuper #cell. */ -void engine_make_gravity_hierarchical_tasks(struct engine *e, struct cell *c) { - - struct scheduler *s = &e->sched; - const int is_with_external_gravity = - (e->policy & engine_policy_external_gravity); - const int is_fixdt = (e->policy & engine_policy_fixdt); - - /* Are we in a cell with self/pair tasks ? */ - if (c->super == c) { - - /* Local tasks only... */ - if (c->nodeID == e->nodeID) { +/* void engine_make_gravity_hierarchical_tasks(struct engine *e, struct cell *c) + * { */ + +/* struct scheduler *s = &e->sched; */ +/* const int is_with_external_gravity = */ +/* (e->policy & engine_policy_external_gravity); */ +/* const int is_fixdt = (e->policy & engine_policy_fixdt); */ + +/* /\* Are we in a cell with self/pair tasks ? *\/ */ +/* if (c->super == c) { */ + +/* /\* Local tasks only... *\/ */ +/* if (c->nodeID == e->nodeID) { */ + +/* /\* Add the init task. *\/ */ +/* if (c->init == NULL) */ +/* c->init = scheduler_addtask(s, task_type_init, task_subtype_none, 0, + * 0, */ +/* c, NULL, 0); */ + +/* /\* Add the kick task that matches the policy. *\/ */ +/* if (is_fixdt) { */ +/* if (c->kick == NULL) */ +/* c->kick = scheduler_addtask(s, task_type_kick_fixdt, */ +/* task_subtype_none, 0, 0, c, NULL, 0); + */ +/* } else { */ +/* if (c->kick == NULL) */ +/* c->kick = scheduler_addtask(s, task_type_kick, task_subtype_none, + * 0, */ +/* 0, c, NULL, 0); */ +/* } */ + +/* /\* External gravity task *\/ */ +/* if (is_with_external_gravity && c->grav_external == NULL) */ +/* c->grav_external = scheduler_addtask( */ +/* s, task_type_grav_external, task_subtype_none, 0, 0, c, NULL, 0); + */ +/* } */ - /* Add the init task. */ - if (c->init == NULL) - c->init = scheduler_addtask(s, task_type_init, task_subtype_none, 0, 0, - c, NULL, 0); +/* } else { */ - /* Add the kick task that matches the policy. */ - if (is_fixdt) { - if (c->kick == NULL) - c->kick = scheduler_addtask(s, task_type_kick_fixdt, - task_subtype_none, 0, 0, c, NULL, 0); - } else { - if (c->kick == NULL) - c->kick = scheduler_addtask(s, task_type_kick, task_subtype_none, 0, - 0, c, NULL, 0); - } - - /* External gravity task */ - if (is_with_external_gravity) - c->grav_external = scheduler_addtask( - s, task_type_grav_external, task_subtype_none, 0, 0, c, NULL, 0); - } - - /* Recurse. */ - if (c->split) - for (int k = 0; k < 8; k++) - if (c->progeny[k] != NULL) - engine_make_gravity_hierarchical_tasks(e, c->progeny[k]); - } -} +/* /\* Recurse. *\/ */ +/* if (c->split) */ +/* for (int k = 0; k < 8; k++) */ +/* if (c->progeny[k] != NULL) */ +/* engine_make_gravity_hierarchical_tasks(e, c->progeny[k]); */ +/* } */ +/* } */ /** * @brief Generate the hydro hierarchical tasks for a hierarchy of cells - @@ -173,11 +180,13 @@ void engine_make_gravity_hierarchical_tasks(struct engine *e, struct cell *c) { * @param c The #cell. * @param super The super #cell. */ -void engine_make_hydro_hierarchical_tasks(struct engine *e, struct cell *c) { +void engine_make_hierarchical_tasks(struct engine *e, struct cell *c) { struct scheduler *s = &e->sched; const int is_fixdt = (e->policy & engine_policy_fixdt); const int is_with_cooling = (e->policy & engine_policy_cooling); + const int is_with_external_gravity = + (e->policy & engine_policy_external_gravity); /* Are we in a cell with self/pair tasks ? */ if (c->super == c) { @@ -186,19 +195,16 @@ void engine_make_hydro_hierarchical_tasks(struct engine *e, struct cell *c) { if (c->nodeID == e->nodeID) { /* Add the init task. */ - if (c->init == NULL) - c->init = scheduler_addtask(s, task_type_init, task_subtype_none, 0, 0, - c, NULL, 0); + c->init = scheduler_addtask(s, task_type_init, task_subtype_none, 0, 0, c, + NULL, 0); /* Add the kick task that matches the policy. */ if (is_fixdt) { - if (c->kick == NULL) - c->kick = scheduler_addtask(s, task_type_kick_fixdt, - task_subtype_none, 0, 0, c, NULL, 0); + c->kick = scheduler_addtask(s, task_type_kick_fixdt, task_subtype_none, + 0, 0, c, NULL, 0); } else { - if (c->kick == NULL) - c->kick = scheduler_addtask(s, task_type_kick, task_subtype_none, 0, - 0, c, NULL, 0); + c->kick = scheduler_addtask(s, task_type_kick, task_subtype_none, 0, 0, + c, NULL, 0); } /* Generate the ghost task. */ @@ -211,16 +217,24 @@ void engine_make_hydro_hierarchical_tasks(struct engine *e, struct cell *c) { task_subtype_none, 0, 0, c, NULL, 0); #endif + /* External gravity task */ + if (is_with_external_gravity) // && c->grav_external == NULL) + c->grav_external = scheduler_addtask( + s, task_type_grav_external, task_subtype_none, 0, 0, c, NULL, 0); + + /* Cooling task */ if (is_with_cooling) c->cooling = scheduler_addtask(s, task_type_cooling, task_subtype_none, 0, 0, c, NULL, 0); } + } else { + /* Recurse. */ if (c->split) for (int k = 0; k < 8; k++) if (c->progeny[k] != NULL) - engine_make_hydro_hierarchical_tasks(e, c->progeny[k]); + engine_make_hierarchical_tasks(e, c->progeny[k]); } } @@ -1874,14 +1888,7 @@ void engine_maketasks(struct engine *e) { for (int k = 0; k < nr_cells; k++) cell_set_super(&cells[k], NULL); /* Append hierarchical tasks to each cells */ - if (e->policy & engine_policy_hydro) - for (int k = 0; k < nr_cells; k++) - engine_make_hydro_hierarchical_tasks(e, &cells[k]); - - if ((e->policy & engine_policy_self_gravity) || - (e->policy & engine_policy_external_gravity)) - for (int k = 0; k < nr_cells; k++) - engine_make_gravity_hierarchical_tasks(e, &cells[k]); + for (int k = 0; k < nr_cells; k++) engine_make_hierarchical_tasks(e, &cells[k]); /* Run through the tasks and make force tasks for each density task. Each force task depends on the cell ghosts and unlocks the kick task