From 695246ad5a7c92df8a088d922eb050db256df595 Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Thu, 28 Dec 2017 14:45:47 +0000
Subject: [PATCH] ENH: snappyHexMesh: directional refinement parallel

---
 .../snappyHexMeshDriver/snappyRefineDriver.C  | 25 +++++++++++++++++++
 .../snappyHexMeshDriver/snappyRefineDriver.H  | 20 ---------------
 2 files changed, 25 insertions(+), 20 deletions(-)

diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.C b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.C
index 15fe6edf80e..77dbedcecc3 100644
--- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.C
+++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.C
@@ -1586,6 +1586,8 @@ Foam::label Foam::snappyRefineDriver::directionalShellRefine
 
     labelList& cellLevel =
         const_cast<labelIOList&>(meshRefiner_.meshCutter().cellLevel());
+    labelList& pointLevel =
+        const_cast<labelIOList&>(meshRefiner_.meshCutter().pointLevel());
 
 
     // Determine the minimum and maximum cell levels that are candidates for
@@ -1705,6 +1707,17 @@ Foam::label Foam::snappyRefineDriver::directionalShellRefine
                     dirCellLevel
                 );
 
+                // Note: edges will have been split. The points might have
+                // inherited pointLevel from either side of the edge which
+                // might not be the same for coupled edges so sync
+                syncTools::syncPointList
+                (
+                    mesh,
+                    pointLevel,
+                    maxEqOp<label>(),
+                    labelMin
+                );
+
                 forAll(map().cellMap(), celli)
                 {
                     if (isRefineCell[map().cellMap()[celli]])
@@ -1712,6 +1725,18 @@ Foam::label Foam::snappyRefineDriver::directionalShellRefine
                         dirCellLevel[celli][dir]++;
                     }
                 }
+
+                // Do something with the pointLevel. See discussion about the
+                // cellLevel. Do we keep min/max ?
+                forAll(map().pointMap(), pointi)
+                {
+                    label oldPointi = map().pointMap()[pointi];
+                    if (map().reversePointMap()[oldPointi] != pointi)
+                    {
+                        // Is added point (splitting an edge)
+                        pointLevel[pointi]++;
+                    }
+                }
             }
         }
 
diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.H b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.H
index dc0936ae48a..3ac28db62b0 100644
--- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.H
+++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.H
@@ -146,26 +146,6 @@ class snappyRefineDriver
 
         // Directional refinement
 
-            //- Calculate direction of face (using geometry)
-            List<direction> faceDirection() const;
-
-            //- Check if level across (directed) face obeys 2:1
-            label faceConsistentRefinement
-            (
-                const PackedBoolList& isDirFace,
-                const List<labelVector>& dirCellLevel,
-                const direction dir,
-                const bool maxSet,
-                PackedBoolList& refineCell
-            ) const;
-            //- Make sure 2:1 refinement in given direction
-            labelList consistentDirectionalRefinement
-            (
-                const direction dir,
-                const List<labelVector>& dirCellLevel,
-                const labelUList& candidateCells,
-                const bool maxSet
-            ) const;
             //- Refine (directional) all cells inside/outside shell
             label directionalShellRefine
             (
-- 
GitLab