From a186289d6b7edd3b37162add8a5afdba95389888 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Tue, 17 Dec 2019 11:19:43 +0100
Subject: [PATCH] Already use the thread-parallel Green function calculation
 when using a mesh of size 32.

---
 src/mesh_gravity.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mesh_gravity.c b/src/mesh_gravity.c
index 758274767c..8a0c895392 100644
--- a/src/mesh_gravity.c
+++ b/src/mesh_gravity.c
@@ -463,8 +463,10 @@ void mesh_apply_Green_function(struct threadpool* tp, fftw_complex* frho,
   data.k_fac = M_PI / (double)N;
 
   /* Parallelize the Green function application using the threadpool
-     to split the x-axis loop over the threads. */
-  if (N < 64) {
+     to split the x-axis loop over the threads.
+     The array is N x N x (N/2). We use the thread to each deal with
+     a range [i_min, i_max[ x N x (N/2) */
+  if (N < 32) {
     mesh_apply_Green_function_mapper(frho, N, &data);
   } else {
     threadpool_map(tp, mesh_apply_Green_function_mapper, frho, N,
-- 
GitLab