From 41ae941d9e57a81af35612e5117e1384518b0c54 Mon Sep 17 00:00:00 2001 From: John Helly <j.c.helly@durham.ac.uk> Date: Thu, 28 Oct 2021 15:17:43 +0100 Subject: [PATCH] Use zeroed out neutrino props instead of null pointer in standalone FoF --- examples/main_fof.c | 6 +++++- src/engine_maketasks.c | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/main_fof.c b/examples/main_fof.c index 5d9b42bb4e..3aa3c432ee 100644 --- a/examples/main_fof.c +++ b/examples/main_fof.c @@ -91,6 +91,7 @@ int main(int argc, char *argv[]) { struct gpart *gparts = NULL; struct gravity_props gravity_properties; struct fof_props fof_properties; + struct neutrino_props neutrino_properties; struct part *parts = NULL; struct phys_const prog_const; struct space s; @@ -554,6 +555,9 @@ int main(int argc, char *argv[]) { /* Do we have neutrino DM particles? */ const int with_neutrinos = N_total[swift_type_neutrino] > 0; + /* Zero out neutrino properties to avoid running neutrino tasks */ + bzero(&neutrino_properties, sizeof(struct neutrino_props)); + /* Initialize the space with these data. */ if (myrank == 0) clocks_gettime(&tic); space_init(&s, params, &cosmo, dim, /*hydro_props=*/NULL, parts, gparts, @@ -645,7 +649,7 @@ int main(int argc, char *argv[]) { engine_policies, talking, &reparttype, &us, &prog_const, &cosmo, /*hydro_properties=*/NULL, /*entropy_floor=*/NULL, &gravity_properties, /*stars_properties=*/NULL, /*black_holes_properties=*/NULL, - /*sink_properties=*/NULL, /*neutrino_properties=*/NULL, + /*sink_properties=*/NULL, &neutrino_properties, /*feedback_properties=*/NULL, /*rt_properties=*/NULL, &mesh, /*potential=*/NULL, /*cooling_func=*/NULL, /*starform=*/NULL, /*chemistry=*/NULL, diff --git a/src/engine_maketasks.c b/src/engine_maketasks.c index a75f64f44f..8338e0554e 100644 --- a/src/engine_maketasks.c +++ b/src/engine_maketasks.c @@ -1022,7 +1022,7 @@ void engine_make_hierarchical_tasks_common(struct engine *e, struct cell *c) { c, NULL); /* Weighting task for neutrinos after the last kick */ - if (e->neutrino_properties && e->neutrino_properties->use_delta_f) { + if (e->neutrino_properties->use_delta_f) { c->grav.neutrino_weight = scheduler_addtask( s, task_type_neutrino_weight, task_subtype_none, 0, 0, c, NULL); scheduler_addunlock(s, c->kick1, c->grav.neutrino_weight); -- GitLab