From f1b22eac7b23f98787ffb4a779a057f2f0f28177 Mon Sep 17 00:00:00 2001
From: POLCHER Jan <jan.polcher@lmd.jussieu.fr>
Date: Mon, 2 Mar 2020 18:29:36 +0100
Subject: [PATCH] Added a function to get maximum over the entire domain.

---
 Partition.py      | 5 +++++
 RoutingPreProc.py | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/Partition.py b/Partition.py
index 5ec2df3..1d7b68a 100644
--- a/Partition.py
+++ b/Partition.py
@@ -543,3 +543,8 @@ class partition :
             ERROR("Unforessen rank for variable to summed over the core region.")
             sys.exit()
         return y
+    #
+    # Function to find max value over the entire domain
+    #
+    def domainmax(self, x) :
+        return max(self.comm.allgather(x))
diff --git a/RoutingPreProc.py b/RoutingPreProc.py
index 668a112..9c2066c 100644
--- a/RoutingPreProc.py
+++ b/RoutingPreProc.py
@@ -139,7 +139,7 @@ else :
 #
 nbpt = len(sub_index)
 sub_pts = np.array(list(len(sub_index[i][0]) for i in range(len(sub_index))))
-nbvmax = max(sub_pts)
+nbvmax = part.domainmax(max(sub_pts))
 print("nbpt : ", nbpt)
 print("nbvmax : ", nbvmax)
 print("nbasmax : ", nbasmax)
-- 
GitLab