diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C index e7a6ee9833..6c9e7c46f8 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C @@ -86,14 +86,9 @@ void Foam::globalMeshData::initProcAddr() processorPatches_.resize(nNeighbours); - if (Pstream::parRun()) + if (UPstream::parRun()) { - PstreamBuffers pBufs - ( - Pstream::commsTypes::nonBlocking, - UPstream::msgType(), - mesh_.comm() - ); + PstreamBuffers pBufs(mesh_.comm()); // Send indices of my processor patches to my neighbours for (const label patchi : processorPatches_) @@ -180,15 +175,11 @@ void Foam::globalMeshData::calcSharedPoints() const if (pPoints.size()+transPPoints.size() > 0) { master[i] = masterNumbering.toGlobal(nMaster); - forAll(pPoints, j) - { - master[pPoints[j]] = master[i]; - } - forAll(transPPoints, j) - { - master[transPPoints[j]] = master[i]; - } - nMaster++; + + labelUIndList(master, pPoints) = master[i]; + labelUIndList(master, transPPoints) = master[i]; + + ++nMaster; } } @@ -325,9 +316,9 @@ void Foam::globalMeshData::calcSharedEdges() const const edgeList& edges = mesh_.edges(); - forAll(edges, edgeI) + forAll(edges, edgei) { - const edge& e = edges[edgeI]; + const edge& e = edges[edgei]; const auto e0Fnd = meshToShared.cfind(e[0]); @@ -343,26 +334,12 @@ void Foam::globalMeshData::calcSharedEdges() const // of the shared points) edge sharedEdge ( - sharedPtAddr[e0Fnd()], - sharedPtAddr[e1Fnd()] + sharedPtAddr[e0Fnd.val()], + sharedPtAddr[e1Fnd.val()] ); - auto iter = localShared.find(sharedEdge); - - if (!iter.good()) - { - // First occurrence of this point combination. Store. - localShared.insert(sharedEdge, labelList(1, edgeI)); - } - else - { - // Add this edge to list of edge labels. - labelList& edgeLabels = iter(); - - const label sz = edgeLabels.size(); - edgeLabels.setSize(sz+1); - edgeLabels[sz] = edgeI; - } + // Add this edge to list of edge labels + localShared(sharedEdge).push_back(edgei); } } } @@ -377,9 +354,9 @@ void Foam::globalMeshData::calcSharedEdges() const // used). But then this only gets done once so not too bothered about the // extra global communication. - EdgeMap