From e2e484b9b1d077f265982fec3a7247d2f7a91a6c Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Sat, 9 Jun 2018 16:38:54 +0200
Subject: [PATCH] Make sure the gravity mesh side is an even number

---
 src/gravity_properties.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/gravity_properties.c b/src/gravity_properties.c
index 7989e97e33..92c347e529 100644
--- a/src/gravity_properties.c
+++ b/src/gravity_properties.c
@@ -57,6 +57,9 @@ void gravity_props_init(struct gravity_props *p, struct swift_params *params,
   p->r_cut_min = parser_get_opt_param_float(params, "Gravity:r_cut_min",
                                             gravity_props_default_r_cut_min);
 
+  if (p->mesh_size % 2 != 0)
+    error("The mesh side-length must be an even number.");
+
   if (p->a_smooth <= 0.)
     error("The mesh smoothing scale 'a_smooth' must be > 0.");
 
-- 
GitLab