From e7f3137aba39bf4fbd0b2f8536f1574ebe5e74c9 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <schaller@strw.leidenuniv.nl> Date: Thu, 1 Nov 2018 14:36:01 +0000 Subject: [PATCH] Use the correct number of engine policies when writing them to a snapshot. --- src/common_io.c | 2 +- src/space.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common_io.c b/src/common_io.c index 9e1eb0854c..5ea80f6519 100644 --- a/src/common_io.c +++ b/src/common_io.c @@ -378,7 +378,7 @@ void io_write_engine_policy(hid_t h_file, const struct engine* e) { const hid_t h_grp = H5Gcreate1(h_file, "/Policy", 0); if (h_grp < 0) error("Error while creating policy group"); - for (int i = 1; i <= engine_maxpolicy; ++i) + for (int i = 1; i < engine_maxpolicy; ++i) if (e->policy & (1 << i)) io_write_attribute_i(h_grp, engine_policy_names[i + 1], 1); else diff --git a/src/space.c b/src/space.c index 91d5c6ca0e..5164236d57 100644 --- a/src/space.c +++ b/src/space.c @@ -2631,9 +2631,9 @@ void space_list_useful_top_level_cells(struct space *s) { s->nr_local_cells_with_tasks++; } - const int has_particles = (c->hydro.count > 0) || (c->grav.count > 0) || - (c->stars.count > 0) || - (c->grav.multipole != NULL && c->grav.multipole->m_pole.M_000 > 0.f); + const int has_particles = + (c->hydro.count > 0) || (c->grav.count > 0) || (c->stars.count > 0) || + (c->grav.multipole != NULL && c->grav.multipole->m_pole.M_000 > 0.f); if (has_particles) { s->cells_with_particles_top[s->nr_cells_with_particles] = i; -- GitLab