From d71b839320b10c6ce86b72fef489780a4c1d5069 Mon Sep 17 00:00:00 2001
From: Henry <Henry>
Date: Thu, 11 Jun 2015 17:45:25 +0100
Subject: [PATCH] polyMesh::findCell: Call tetBasePtIs for CELL_TETS to ensure
 parallel consistency Resolves additional bug-report
 http://www.openfoam.org/mantisbt/view.php?id=1544

---
 src/OpenFOAM/meshes/polyMesh/polyMesh.C | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMesh.C
index 66365f9fec9..1c9a6203f80 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyMesh.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.C
@@ -1483,6 +1483,21 @@ Foam::label Foam::polyMesh::findCell
         return -1;
     }
 
+    if
+    (
+        Pstream::parRun()
+     && (decompMode == FACE_DIAG_TRIS || decompMode == CELL_TETS)
+    )
+    {
+        // Force construction of face-diagonal decomposition before testing
+        // for zero cells.
+        //
+        // If parallel running a local domain might have zero cells so never
+        // construct the face-diagonal decomposition which uses parallel
+        // transfers.
+        (void)tetBasePtIs();
+    }
+
     if (decompMode == CELL_TETS)
     {
         // Advanced search method utilizing an octree
@@ -1501,15 +1516,6 @@ Foam::label Foam::polyMesh::findCell
         // Approximate search avoiding the construction of an octree
         // and cell decomposition
 
-        if (Pstream::parRun() && decompMode == FACE_DIAG_TRIS)
-        {
-            // Force construction of face-diagonal decomposition before testing
-            // for zero cells. If parallel running a local domain might have
-            // zero cells so never construct the face-diagonal decomposition
-            // (which uses parallel transfers)
-            (void)tetBasePtIs();
-        }
-
         // Find the nearest cell centre to this location
         label celli = findNearestCell(p);
 
-- 
GitLab