From e92975075af2f7eb5e9d1aae8d4b7f5f5eee8ae9 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 12 Jun 2023 15:21:20 +0200 Subject: [PATCH] ENH: sum reduction of nPoints/nFaces/nCells in a single call (globalMeshData) STYLE: use labelRange instead of identity(...) for communicator --- .../procFacesGAMGProcAgglomeration.C | 3 +- .../polyMesh/globalMeshData/globalMeshData.C | 50 +++++-------------- .../polyMesh/globalMeshData/globalMeshData.H | 14 +++--- 3 files changed, 21 insertions(+), 46 deletions(-) diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGProcAgglomerations/procFacesGAMGProcAgglomeration/procFacesGAMGProcAgglomeration.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGProcAgglomerations/procFacesGAMGProcAgglomeration/procFacesGAMGProcAgglomeration.C index d537dae584..52baecc75b 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGProcAgglomerations/procFacesGAMGProcAgglomeration/procFacesGAMGProcAgglomeration.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGProcAgglomerations/procFacesGAMGProcAgglomeration/procFacesGAMGProcAgglomeration.C @@ -152,7 +152,7 @@ Foam::procFacesGAMGProcAgglomeration::processorAgglomeration UPstream::communicator singleCellMeshComm ( mesh.comm(), - labelList(Foam::one{}, 0) // only processor 0 + labelRange(1) // Processor 0 only ); scalarField faceWeights; @@ -197,7 +197,6 @@ Foam::procFacesGAMGProcAgglomeration::processorAgglomeration } Pstream::broadcast(fineToCoarse, mesh.comm()); - singleCellMeshComm.reset(); return tfineToCoarse; } diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C index feba605416..7fd3cb883b 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C @@ -2504,8 +2504,8 @@ Foam::autoPtr Foam::globalMeshData::mergePoints const globalIndex globalPPoints(meshPoints.size()); labelList patchToCoupled(meshPoints.size(), -1); - label nCoupled = 0; labelList coupledToGlobalPatch(pointSlavesMap.constructSize(), -1); + //label nCoupled = 0; // Note: loop over patch since usually smaller forAll(meshPoints, patchPointi) @@ -2518,7 +2518,7 @@ Foam::autoPtr Foam::globalMeshData::mergePoints { patchToCoupled[patchPointi] = iter(); coupledToGlobalPatch[iter()] = globalPPoints.toGlobal(patchPointi); - nCoupled++; + //++nCoupled; } } @@ -2718,55 +2718,31 @@ void Foam::globalMeshData::updateMesh() UPstream::communicator dupComm ( UPstream::worldComm, - identity(UPstream::nProcs(UPstream::worldComm)) + labelRange(UPstream::nProcs(UPstream::worldComm)) ); const label comm = dupComm.comm(); const label oldWarnComm = UPstream::commWarn(comm); + FixedList totals; - // Total number of faces. - nTotalFaces_ = returnReduce - ( - mesh_.nFaces(), - sumOp