From dee26e624fe61ff20df36a8db0dfbad7f7194f8c Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <matthieu.schaller@durham.ac.uk> Date: Tue, 23 Feb 2016 10:55:01 +0000 Subject: [PATCH] Fixed segfault in MPI mode. --- src/cell.c | 3 ++- src/engine.c | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/cell.c b/src/cell.c index 032efcac4d..3778406767 100644 --- a/src/cell.c +++ b/src/cell.c @@ -557,8 +557,9 @@ void cell_init_parts(struct cell *c, void *data) { struct part *p = c->parts; struct xpart *xp = c->xparts; + const int count = c->count; - for (int i = 0; i < c->count; ++i) { + for (int i = 0; i < count; ++i) { p[i].ti_begin = 0; p[i].ti_end = 0; xp[i].v_full[0] = p[i].v[0]; diff --git a/src/engine.c b/src/engine.c index 076561a1bf..9c89080ef8 100644 --- a/src/engine.c +++ b/src/engine.c @@ -1720,14 +1720,14 @@ void engine_init_particles(struct engine *e) { struct space *s = e->s; - message("Initialising particles"); - - engine_prepare(e); + if(e->nodeID == 0) message("Initialising particles"); /* Make sure all particles are ready to go */ /* i.e. clean-up any stupid state in the ICs */ space_map_cells_pre(s, 1, cell_init_parts, NULL); + engine_prepare(e); + engine_marktasks(e); // printParticle(e->s->parts, 1000, e->s->nr_parts); -- GitLab