From f42be0fb42405cce93141661d8cae2ddfaed061d Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Mon, 2 Apr 2012 10:47:22 +0100
Subject: [PATCH] ENH: polyMeshFromShapeMesh: construct parallel

---
 .../meshes/polyMesh/polyMeshFromShapeMesh.C   | 23 +++++++++++++++----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshFromShapeMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMeshFromShapeMesh.C
index bf8c028ccc8..18a725bbec0 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyMeshFromShapeMesh.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyMeshFromShapeMesh.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -614,10 +614,17 @@ Foam::polyMesh::polyMesh
 
     label nAllPatches = boundaryFaces.size();
 
-    if (nFaces > defaultPatchStart)
+
+    label nDefaultFaces = nFaces - defaultPatchStart;
+    if (syncPar)
+    {
+        reduce(nDefaultFaces, sumOp<label>());
+    }
+
+    if (nDefaultFaces > 0)
     {
         WarningIn("polyMesh::polyMesh(... construct from shapes...)")
-            << "Found " << nFaces - defaultPatchStart
+            << "Found " << nDefaultFaces
             << " undefined faces in mesh; adding to default patch." << endl;
 
         // Check if there already exists a defaultFaces patch as last patch
@@ -883,10 +890,16 @@ Foam::polyMesh::polyMesh
 
     label nAllPatches = boundaryFaces.size();
 
-    if (nFaces > defaultPatchStart)
+    label nDefaultFaces = nFaces - defaultPatchStart;
+    if (syncPar)
+    {
+        reduce(nDefaultFaces, sumOp<label>());
+    }
+
+    if (nDefaultFaces > 0)
     {
         WarningIn("polyMesh::polyMesh(... construct from shapes...)")
-            << "Found " << nFaces - defaultPatchStart
+            << "Found " << nDefaultFaces
             << " undefined faces in mesh; adding to default patch." << endl;
 
         // Check if there already exists a defaultFaces patch as last patch
-- 
GitLab