From 5629e2d60ab22f465255698b65e7ac0b3339022b Mon Sep 17 00:00:00 2001
From: Anthony <anthony.schrapffer@polytechnique.fr>
Date: Thu, 16 Apr 2020 17:49:02 +0200
Subject: [PATCH] Improvement of the truncate

---
 Truncate.py | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/Truncate.py b/Truncate.py
index bdcdb61..7ccbafe 100755
--- a/Truncate.py
+++ b/Truncate.py
@@ -72,6 +72,7 @@ class trunc:
            if self.max_ops_num_core == self.numop:
                self.step2(hydrosuper, part, "core")
                hydrosuper.killbas(self.tokill, self.totakeover, self.numops)
+               #print("Step 2,iter {0} Rank {1}, maxops : {2}".format(i,part.rank,np.max(self.numops)))
 
                max_bas = part.domainmax(np.max(self.basin_count))
                if part.rank == 0:
@@ -90,7 +91,7 @@ class trunc:
                comm.Barrier()
            i += 1 
 
-        
+         
         # Step 3 : HTUs with the same ID          
         i = 1       
         self.max_ops_num_halo = self.numop; self.max_ops_num_core = self.numop
@@ -131,7 +132,7 @@ class trunc:
             comm.Barrier()
             i += 1
 
-        
+                
         # Step 5 : Brutal method  
         self.step5(hydrosuper, part)
         hydrosuper.killbas(self.tokill, self.totakeover, self.numops)
@@ -330,7 +331,13 @@ class trunc:
         if len(A)>1:
             B = self.fetch[npt][A]
             changes.append([A[k]+1 for k in np.argsort(B)])
-            
+        # We are working on core, it's ok to check outflow_grid = 0        
+        A = np.where(self.outflow_grid[npt] == 0)[0]
+        if len(A)>1:
+            B = self.fetch[npt][A]
+            changes.append([A[k]+1 for k in np.argsort(B)])
+
+    
         return changes 
 
     def get_changes_step2(self, npt, neigh_domain):
-- 
GitLab