From 1acf40fe81d2df68156e373be1775b3b97c48707 Mon Sep 17 00:00:00 2001
From: sebherbert <sherbert@pasteur.fr>
Date: Wed, 21 Aug 2019 18:15:02 +0200
Subject: [PATCH] Fixes the overlap face to cell crash

Error introduced in commit 46c3e745a97dfdc5267c51dfeb84ff2e37a1d48a about parallelization
---
 MainScripts/surface3D_combine.m | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/MainScripts/surface3D_combine.m b/MainScripts/surface3D_combine.m
index 03eb675..a0ad80d 100644
--- a/MainScripts/surface3D_combine.m
+++ b/MainScripts/surface3D_combine.m
@@ -427,11 +427,11 @@ for meshTri = 1:size(dataCurv.faces,1) % USE A PARFOR HERE IF POSSIBLE !
             localFace2Cell(bioCell) = bioCell;
         end
     end
-    Face2Cell{meshTri} = localFace2Cell;
+    Face2Cell{meshTri} = unique(localFace2Cell(localFace2Cell>0));
 end
 
 dataCells.cell2Face = cell2Face;
-dataCells.Face2Cell = unique(localFace2Cell)>0;
+dataCells.Face2Cell = Face2Cell;
 
 fprintf('Total time = %.1fs\n',toc);
 
@@ -587,7 +587,7 @@ function overCoveredCells = checkOverCovered(dataCells,dataCurv)
 % list cells covered by a downwards oriented face
 
 downFaces = dataCurv.normalF(3,:)<0;
-overCoveredCells = unique(vertcat(dataCells.Face2Cell{downFaces}));
+overCoveredCells = unique(horzcat(dataCells.Face2Cell{downFaces}))';
 
 end
 
-- 
GitLab