From 1f1d559e204de16024dffe3a408116b70f83e0b6 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 8 Dec 2011 16:24:15 +0000 Subject: [PATCH] ENH: globalIndex: work in local mode --- .../meshes/polyMesh/globalMeshData/globalIndex.C | 14 +++++++++++--- .../meshes/polyMesh/globalMeshData/globalIndex.H | 7 ++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndex.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndex.C index a432ae889b..6765ee8378 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndex.C +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndex.C @@ -27,14 +27,22 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::globalIndex::globalIndex(const label localSize, const int tag) +Foam::globalIndex::globalIndex +( + const label localSize, + const int tag, + const bool parallel +) : offsets_(Pstream::nProcs()+1) { labelList localSizes(Pstream::nProcs()); localSizes[Pstream::myProcNo()] = localSize; - Pstream::gatherList(localSizes, tag); - Pstream::scatterList(localSizes, tag); + if (parallel) + { + Pstream::gatherList(localSizes, tag); + Pstream::scatterList(localSizes, tag); + } label offset = 0; offsets_[0] = 0; diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndex.H b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndex.H index 1bd8347050..c712066f4a 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndex.H +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndex.H @@ -72,7 +72,12 @@ public: // Constructors //- Construct from local max size - globalIndex(const label localSize, const int tag = Pstream::msgType()); + globalIndex + ( + const label localSize, + const int tag = Pstream::msgType(), + const bool parallel = true // use parallel comms + ); //- Construct from Istream globalIndex(Istream& is);