From d730150e18b19e21ec70da9290d39828a52be73f Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Mon, 6 Dec 2010 15:51:08 +0000
Subject: [PATCH] ENH: globalPoints : disabled 'scheduled' mode for
 globalPoints construction

---
 .../polyMesh/globalMeshData/globalPoints.C    | 31 +++++++++++++++++--
 1 file changed, 28 insertions(+), 3 deletions(-)

diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C
index c5d632ec287..f79e874c79e 100644
--- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C
+++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C
@@ -1220,7 +1220,17 @@ void Foam::globalPoints::calculateSharedPoints
 
     // Do one exchange iteration to get neighbour points.
     {
-        PstreamBuffers pBufs(Pstream::defaultCommsType);
+        // Note: to use 'scheduled' would have to intersperse send and receive.
+        // So for now just use nonBlocking. Also globalPoints itself gets
+        // constructed by mesh.globalData().patchSchedule() so creates a loop.
+        PstreamBuffers pBufs
+        (
+            (
+                Pstream::defaultCommsType == Pstream::scheduled
+              ? Pstream::nonBlocking
+              : Pstream::defaultCommsType
+            )
+        );
         sendPatchPoints
         (
             mergeSeparated,
@@ -1251,7 +1261,14 @@ void Foam::globalPoints::calculateSharedPoints
 
     do
     {
-        PstreamBuffers pBufs(Pstream::defaultCommsType);
+        PstreamBuffers pBufs
+        (
+            (
+                Pstream::defaultCommsType == Pstream::scheduled
+              ? Pstream::nonBlocking
+              : Pstream::defaultCommsType
+            )
+        );
         sendPatchPoints
         (
             mergeSeparated,
@@ -1400,7 +1417,15 @@ void Foam::globalPoints::calculateSharedPoints
             Pout<< "Determined " << changedIndices.size() << " shared points."
                 << " Exchanging them" << endl;
         }
-        PstreamBuffers pBufs(Pstream::defaultCommsType);
+        PstreamBuffers pBufs
+        (
+            (
+                Pstream::defaultCommsType == Pstream::scheduled
+              ? Pstream::nonBlocking
+              : Pstream::defaultCommsType
+            )
+        );
+
         sendSharedPoints(mergeSeparated, pBufs, changedIndices);
         pBufs.finishedSends();
         receiveSharedPoints
-- 
GitLab