From 473e14418a038fa786c2ab888782458a5352ceee Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@esi-group.com> Date: Tue, 23 Aug 2022 15:58:32 +0200 Subject: [PATCH] ENH: more consistent use of broadcast, combineReduce etc. - broadcast : (replaces scatter) - combineReduce == combineGather + broadcast - listCombineReduce == listCombineGather + broadcast - mapCombineReduce == mapCombineGather + broadcast - allGatherList == gatherList + scatterList Before settling on a more consistent naming convention, some intermediate namings were used in OpenFOAM-v2206: - combineReduce (2206: combineAllGather) - listCombineReduce (2206: listCombineAllGather) - mapCombineReduce (2206: mapCombineAllGather) --- .../test/IndirectList/Test-IndirectList.C | 2 +- applications/test/Tuple2/Test-Tuple2.C | 8 +++--- .../Test-decomposedBlockData.C | 2 +- .../test/globalIndex/Test-globalIndex.C | 2 +- applications/test/minMax1/Test-minMax1.C | 6 +--- .../Test-parallel-communicators.C | 2 +- .../Test-parallel-nonBlocking.C | 4 +-- .../extrudeToRegionMesh/extrudeToRegionMesh.C | 8 +++--- .../conformalVoronoiMeshConformToSurface.C | 4 +-- .../generation/snappyHexMesh/snappyHexMesh.C | 10 ++++--- .../manipulation/checkMesh/checkTopology.C | 6 +--- .../manipulation/createPatch/createPatch.C | 2 +- .../splitMeshRegions/splitMeshRegions.C | 2 +- .../foamFormatConvert/foamFormatConvert.C | 8 +++--- .../parLagrangianDistributor.C | 17 +++++------ .../parLagrangianDistributorTemplates.C | 11 ++------ .../redistributePar/redistributePar.C | 10 +++---- .../foamToEnsight/findCloudFields.H | 2 +- .../foamToVTK/convertLagrangian.H | 6 ++-- .../particleTracks/particleTracks.C | 2 +- .../particleTracksSamplerTemplates.C | 3 +- .../postChannel/channelIndexTemplates.C | 2 +- .../surfaceMeshExtract/surfaceMeshExtract.C | 28 +++++++++---------- .../surfaceRedistributePar.C | 2 +- .../Lists/SortableList/ParSortableList.C | 2 +- src/OpenFOAM/db/IOobjectList/IOobjectList.C | 6 ++-- .../fields/Fields/Field/FieldFunctions.C | 8 +++--- src/OpenFOAM/fields/Fields/Field/FieldOps.C | 4 +-- .../procFacesGAMGProcAgglomeration.C | 4 +-- .../polyMesh/globalMeshData/globalMeshData.C | 8 +++--- .../mapDistribute/mapDistributeBase.H | 4 +-- .../polyMesh/syncTools/syncToolsTemplates.C | 4 +-- .../globalIndexAndTransform.C | 4 +-- .../primitives/random/Random/Random.C | 26 ++++++++--------- .../random/Random/RandomTemplates.C | 18 ++++++------ .../extrudePatchMesh/extrudePatchMesh.C | 2 +- .../fvMeshDistribute/fvMeshDistribute.C | 2 +- .../polyTopoChange/hexRef8/hexRef8.C | 4 +-- src/fileFormats/vtk/file/foamVtkFileWriter.H | 2 +- .../faGlobalMeshData/faGlobalMeshData.C | 2 +- .../turbulentDFSEMInletFvPatchVectorField.C | 2 +- .../fvMesh/fvMeshSubset/fvMeshSubset.C | 2 +- src/functionObjects/field/Curle/Curle.C | 2 +- .../field/DMD/DMDModels/derived/STDMD/STDMD.C | 24 ++++++++-------- .../columnAverage/columnAverageTemplates.C | 4 +-- .../field/externalCoupled/externalCoupled.C | 2 +- .../extractEulerianParticles.C | 4 +-- .../regionSizeDistribution.C | 4 +-- .../field/streamLine/streamLineBase.C | 2 +- .../forces/propellerInfo/propellerInfo.C | 4 +-- .../lagrangian/vtkCloud/vtkCloudTemplates.C | 9 ++---- src/functionObjects/utilities/abort/abort.C | 8 +++--- .../utilities/areaWrite/areaWrite.C | 2 +- .../utilities/areaWrite/areaWriteTemplates.C | 12 +++----- .../utilities/parProfiling/parProfiling.C | 1 - .../utilities/systemCall/systemCall.C | 4 +-- src/lagrangian/basic/Cloud/CloudIO.C | 2 +- .../ParticleZoneInfo/ParticleZoneInfo.C | 3 +- .../CellZoneInjection/CellZoneInjection.C | 2 +- .../InflationInjection/InflationInjection.C | 4 +-- .../InjectedParticleDistributionInjection.C | 17 ++++------- .../InjectedParticleInjection.C | 14 ++++------ .../PatchInjection/patchInjectionBase.C | 2 +- .../clouds/Templates/SprayCloud/SprayCloudI.H | 2 +- .../movement/lumpedPointMovement.C | 6 ++-- .../meshRefinement/meshRefinement.C | 2 +- .../meshRefinement/meshRefinementBaffles.C | 10 +++---- .../snappyHexMeshDriver/snappyRefineDriver.C | 6 ++-- src/meshTools/coupling/externalFileCoupler.C | 12 ++++---- .../mappedPolyPatch/mappedPatchBase.C | 2 +- .../multiWorld/multiWorldConnectionsObject.C | 9 ++---- .../output/vtk/topoSet/foamVtkWriteTopoSet.H | 8 +++--- src/meshTools/regionSplit2D/regionSplit2D.C | 2 +- .../triSurfaceMesh/triSurfaceMesh.C | 4 +-- .../cellSources/nearestToCell/nearestToCell.C | 2 +- .../faceSources/regionToFace/regionToFace.C | 2 +- .../planeToFaceZone/planeToFaceZone.C | 4 +-- .../nearestToPoint/nearestToPoint.C | 2 +- .../NURBS3DVolume/NURBS3DVolume.C | 4 +-- .../cellVolumeWeightCellCellStencil.C | 4 +-- .../inverseDistanceCellCellStencil.C | 4 +-- .../trackingInverseDistanceCellCellStencil.C | 2 +- src/overset/regionsToCell/findRefCells.C | 4 +-- .../decompositionMethod/decompositionMethod.C | 4 +-- .../multiLevelDecomp/multiLevelDecomp.C | 8 ++---- .../faReconstruct/faMeshReconstructor.C | 19 +++++-------- .../singleLayerRegion/singleLayerRegion.C | 2 +- .../rigidBodyMotion/rigidBodyMotion.C | 2 +- src/sampling/probes/patchProbes.C | 2 +- src/sampling/probes/patchProbesTemplates.C | 4 +-- src/sampling/probes/probesTemplates.C | 4 +-- src/sampling/sampledSet/cloud/cloudSet.C | 4 +-- .../sampledSet/patchCloud/patchCloudSet.C | 2 +- .../sampledSet/patchSeed/patchSeedSet.C | 6 +--- .../sampledSet/sampledSets/sampledSets.C | 2 +- .../sampledSet/shortestPath/shortestPathSet.C | 2 +- .../sampledMeshedSurface.C | 2 +- .../sampledSurfaces/sampledSurfaces.C | 2 +- .../surface/isoSurface/isoSurfacePoint.C | 2 +- .../sixDoFRigidBodyMotion.C | 2 +- .../TDACChemistryModel/TDACChemistryModel.C | 2 +- .../solarLoad/faceReflecting/faceReflecting.C | 4 +-- .../radiationModels/viewFactor/viewFactor.C | 10 ++----- 103 files changed, 248 insertions(+), 307 deletions(-) diff --git a/applications/test/IndirectList/Test-IndirectList.C b/applications/test/IndirectList/Test-IndirectList.C index eb22bf3b308..399d43906c7 100644 --- a/applications/test/IndirectList/Test-IndirectList.C +++ b/applications/test/IndirectList/Test-IndirectList.C @@ -182,7 +182,7 @@ int main(int argc, char *argv[]) // MPI barrier bool barrier = true; - Pstream::scatter(barrier); + Pstream::broadcast(barrier); } diff --git a/applications/test/Tuple2/Test-Tuple2.C b/applications/test/Tuple2/Test-Tuple2.C index 95df0e5a421..9163f14e548 100644 --- a/applications/test/Tuple2/Test-Tuple2.C +++ b/applications/test/Tuple2/Test-Tuple2.C @@ -138,8 +138,8 @@ int main() maxFirstEqOp<label>()(maxIndexed, item); } - Pstream::combineAllGather(minIndexed, minFirstEqOp<label>()); - Pstream::combineAllGather(maxIndexed, maxFirstEqOp<label>()); + Pstream::combineReduce(minIndexed, minFirstEqOp<label>()); + Pstream::combineReduce(maxIndexed, maxFirstEqOp<label>()); Info<< "Min indexed: " << minIndexed << nl << "Max indexed: " << maxIndexed << nl; @@ -156,8 +156,8 @@ int main() maxIndexed = maxFirstOp<label>()(maxIndexed, item); } - Pstream::combineAllGather(minIndexed, minFirstEqOp<label>()); - Pstream::combineAllGather(maxIndexed, maxFirstEqOp<label>()); + Pstream::combineReduce(minIndexed, minFirstEqOp<label>()); + Pstream::combineReduce(maxIndexed, maxFirstEqOp<label>()); Info<< "Min indexed: " << minIndexed << nl << "Max indexed: " << maxIndexed << nl; diff --git a/applications/test/decomposedBlockData/Test-decomposedBlockData.C b/applications/test/decomposedBlockData/Test-decomposedBlockData.C index 1aa698ba8e0..81d62397cd7 100644 --- a/applications/test/decomposedBlockData/Test-decomposedBlockData.C +++ b/applications/test/decomposedBlockData/Test-decomposedBlockData.C @@ -60,7 +60,7 @@ int main(int argc, char *argv[]) Info<< "Reading " << file << nl << endl; decomposedBlockData data ( - Pstream::worldComm, + UPstream::worldComm, IOobject ( file, diff --git a/applications/test/globalIndex/Test-globalIndex.C b/applications/test/globalIndex/Test-globalIndex.C index c743c1316b8..d1f1c851ddf 100644 --- a/applications/test/globalIndex/Test-globalIndex.C +++ b/applications/test/globalIndex/Test-globalIndex.C @@ -204,7 +204,7 @@ int main(int argc, char *argv[]) labelPair inOut; pointField allCcs(globalNumbering.gather(mesh.cellCentres())); inOut[0] = allCcs.size(); - Pstream::scatter(allCcs); + Pstream::broadcast(allCcs); inOut[1] = allCcs.size(); Pout<< " " << inOut << endl; diff --git a/applications/test/minMax1/Test-minMax1.C b/applications/test/minMax1/Test-minMax1.C index 586b6f0384a..f5b762a7fc0 100644 --- a/applications/test/minMax1/Test-minMax1.C +++ b/applications/test/minMax1/Test-minMax1.C @@ -234,11 +234,7 @@ int main(int argc, char *argv[]) Pout<< "hashed: " << hashed << nl; - Pstream::mapCombineGather - ( - hashed, - plusEqOp<scalarMinMax>() - ); + Pstream::mapCombineReduce(hashed, plusEqOp<scalarMinMax>()); Info<< "reduced: " << hashed << nl; diff --git a/applications/test/parallel-communicators/Test-parallel-communicators.C b/applications/test/parallel-communicators/Test-parallel-communicators.C index 6c4662d0118..635841d6fd4 100644 --- a/applications/test/parallel-communicators/Test-parallel-communicators.C +++ b/applications/test/parallel-communicators/Test-parallel-communicators.C @@ -167,7 +167,7 @@ int main(int argc, char *argv[]) ( localValue, sumOp<scalar>(), - Pstream::msgType(), + UPstream::msgType(), comm ); Pout<< "sum :" << sum << endl; diff --git a/applications/test/parallel-nonBlocking/Test-parallel-nonBlocking.C b/applications/test/parallel-nonBlocking/Test-parallel-nonBlocking.C index a1885891d86..fc13771c73d 100644 --- a/applications/test/parallel-nonBlocking/Test-parallel-nonBlocking.C +++ b/applications/test/parallel-nonBlocking/Test-parallel-nonBlocking.C @@ -125,13 +125,13 @@ int main(int argc, char *argv[]) scalar data1 = 1.0; label request1 = -1; { - Foam::reduce(data1, sumOp<scalar>(), Pstream::msgType(), request1); + Foam::reduce(data1, sumOp<scalar>(), UPstream::msgType(), request1); } scalar data2 = 0.1; label request2 = -1; { - Foam::reduce(data2, sumOp<scalar>(), Pstream::msgType(), request2); + Foam::reduce(data2, sumOp<scalar>(), UPstream::msgType(), request2); } diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C index 20b8d48da90..e6854ac097a 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C @@ -661,8 +661,8 @@ void countExtrudePatches } // Synchronise decision. Actual numbers are not important, just make // sure that they're > 0 on all processors. - Pstream::listCombineAllGather(zoneSidePatch, plusEqOp<label>()); - Pstream::listCombineAllGather(zoneZonePatch, plusEqOp<label>()); + Pstream::listCombineReduce(zoneSidePatch, plusEqOp<label>()); + Pstream::listCombineReduce(zoneZonePatch, plusEqOp<label>()); } @@ -1848,7 +1848,7 @@ int main(int argc, char *argv[]) const primitiveFacePatch extrudePatch(std::move(zoneFaces), mesh.points()); - Pstream::listCombineAllGather(isInternal, orEqOp<bool>()); + Pstream::listCombineReduce(isInternal, orEqOp<bool>()); // Check zone either all internal or all external faces checkZoneInside(mesh, zoneNames, zoneID, extrudeMeshFaces, isInternal); @@ -2309,7 +2309,7 @@ int main(int argc, char *argv[]) } // Reduce - Pstream::mapCombineAllGather(globalSum, plusEqOp<point>()); + Pstream::mapCombineReduce(globalSum, plusEqOp<point>()); forAll(localToGlobalRegion, localRegionI) { diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C index 0fe385e0bd4..bc1ccb10c5e 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C @@ -729,7 +729,7 @@ Foam::label Foam::conformalVoronoiMesh::synchroniseSurfaceTrees } } - Pstream::listCombineAllGather(hits, plusEqOp<labelHashSet>()); + Pstream::listCombineReduce(hits, plusEqOp<labelHashSet>()); forAll(surfaceHits, eI) { @@ -816,7 +816,7 @@ Foam::label Foam::conformalVoronoiMesh::synchroniseEdgeTrees } } - Pstream::listCombineAllGather(hits, plusEqOp<labelHashSet>()); + Pstream::listCombineReduce(hits, plusEqOp<labelHashSet>()); forAll(featureEdgeHits, eI) { diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C index 508bdcb2d8d..28242fdf149 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C @@ -416,10 +416,12 @@ void extractSurface // Allocate zone/patch for all patches HashTable<label> compactZoneID(1024); - forAllConstIters(patchSize, iter) + if (Pstream::master()) { - label sz = compactZoneID.size(); - compactZoneID.insert(iter.key(), sz); + forAllConstIters(patchSize, iter) + { + compactZoneID.insert(iter.key(), compactZoneID.size()); + } } Pstream::broadcast(compactZoneID); @@ -431,7 +433,7 @@ void extractSurface label patchi = bMesh.findPatchID(iter.key()); if (patchi != -1) { - patchToCompactZone[patchi] = iter(); + patchToCompactZone[patchi] = iter.val(); } } diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C b/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C index 82af0aa1522..da07bf76ce6 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C @@ -588,11 +588,7 @@ Foam::label Foam::checkTopology } } - Pstream::listCombineAllGather - ( - regionDisconnected, - andEqOp<bool>() - ); + Pstream::listCombineReduce(regionDisconnected, andEqOp<bool>()); } diff --git a/applications/utilities/mesh/manipulation/createPatch/createPatch.C b/applications/utilities/mesh/manipulation/createPatch/createPatch.C index f15ad18ce16..0681cd9d772 100644 --- a/applications/utilities/mesh/manipulation/createPatch/createPatch.C +++ b/applications/utilities/mesh/manipulation/createPatch/createPatch.C @@ -714,7 +714,7 @@ void syncPoints } // Combine - globally consistent - Pstream::listCombineAllGather(sharedPts, cop); + Pstream::listCombineReduce(sharedPts, cop); // Now we will all have the same information. Merge it back with // my local information. diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C index fd68ceb34ad..4b5ceee7b7a 100644 --- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C +++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C @@ -1114,7 +1114,7 @@ label findCorrespondingRegion } } - Pstream::listCombineAllGather(cellsInZone, plusEqOp<label>()); + Pstream::listCombineReduce(cellsInZone, plusEqOp<label>()); // Pick region with largest overlap of zoneI label regionI = findMax(cellsInZone); diff --git a/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C b/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C index 6abc6c70203..d45307c33e0 100644 --- a/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C +++ b/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C @@ -223,7 +223,7 @@ bool writeOptionalMeshObject // Make sure all know if there is a valid class name wordList classNames(1, io.headerClassName()); - Pstream::combineAllGather(classNames, uniqueEqOp<word>()); + Pstream::combineReduce(classNames, uniqueEqOp<word>()); // Check for correct type if (classNames[0] == T::typeName) @@ -429,7 +429,7 @@ int main(int argc, char *argv[]) ) ); - Pstream::combineAllGather(lagrangianDirs, uniqueEqOp<fileName>()); + Pstream::combineReduce(lagrangianDirs, uniqueEqOp<fileName>()); if (!lagrangianDirs.empty()) { @@ -466,7 +466,7 @@ int main(int argc, char *argv[]) ) ); - Pstream::combineAllGather(cloudDirs, uniqueEqOp<fileName>()); + Pstream::combineReduce(cloudDirs, uniqueEqOp<fileName>()); forAll(cloudDirs, i) { @@ -492,7 +492,7 @@ int main(int argc, char *argv[]) ); // Combine with all other cloud objects - Pstream::combineAllGather(cloudFields, uniqueEqOp<word>()); + Pstream::combineReduce(cloudFields, uniqueEqOp<word>()); for (const word& name : cloudFields) { diff --git a/applications/utilities/parallelProcessing/redistributePar/parLagrangianDistributor.C b/applications/utilities/parallelProcessing/redistributePar/parLagrangianDistributor.C index 08b7977b272..ef20c1cec0f 100644 --- a/applications/utilities/parallelProcessing/redistributePar/parLagrangianDistributor.C +++ b/applications/utilities/parallelProcessing/redistributePar/parLagrangianDistributor.C @@ -89,10 +89,11 @@ void Foam::parLagrangianDistributor::findClouds } // Synchronise cloud names - Pstream::combineGather(cloudNames, ListOps::uniqueEqOp<word>()); - Pstream::broadcast(cloudNames); + Pstream::combineReduce(cloudNames, ListOps::uniqueEqOp<word>()); + Foam::sort(cloudNames); // Consistent order - objectNames.setSize(cloudNames.size()); + objectNames.clear(); + objectNames.resize(cloudNames.size()); for (const fileName& localCloudName : localCloudDirs) { @@ -124,11 +125,11 @@ void Foam::parLagrangianDistributor::findClouds } } - // Synchronise objectNames - forAll(objectNames, i) + // Synchronise objectNames (per cloud) + for (wordList& objNames : objectNames) { - Pstream::combineGather(objectNames[i], ListOps::uniqueEqOp<word>()); - Pstream::broadcast(objectNames[i]); + Pstream::combineReduce(objNames, ListOps::uniqueEqOp<word>()); + Foam::sort(objNames); // Consistent order } } @@ -291,7 +292,7 @@ Foam::parLagrangianDistributor::distributeLagrangianPositions nsTransPs[sendProcI] = subMap[sendProcI].size(); } // Send sizes across. Note: blocks. - Pstream::combineAllGather(sizes, Pstream::listEq()); + Pstream::combineReduce(sizes, Pstream::listEq()); labelListList constructMap(Pstream::nProcs()); label constructSize = 0; diff --git a/applications/utilities/parallelProcessing/redistributePar/parLagrangianDistributorTemplates.C b/applications/utilities/parallelProcessing/redistributePar/parLagrangianDistributorTemplates.C index a04291d961f..68e13363e1d 100644 --- a/applications/utilities/parallelProcessing/redistributePar/parLagrangianDistributorTemplates.C +++ b/applications/utilities/parallelProcessing/redistributePar/parLagrangianDistributorTemplates.C @@ -51,14 +51,9 @@ Foam::wordList Foam::parLagrangianDistributor::filterObjects : objects.names<Container>(selectedFields) ); - // Parallel synchronise - // - Combine names from all processors - - Pstream::combineGather(fieldNames, ListOps::uniqueEqOp<word>()); - Pstream::broadcast(fieldNames); - - // Sort for consistent order on all processors - Foam::sort(fieldNames); + // Parallel synchronise - combine names from all processors + Pstream::combineReduce(fieldNames, ListOps::uniqueEqOp<word>()); + Foam::sort(fieldNames); // Consistent order return fieldNames; } diff --git a/applications/utilities/parallelProcessing/redistributePar/redistributePar.C b/applications/utilities/parallelProcessing/redistributePar/redistributePar.C index 7afd6abd276..b5fa4d1f197 100644 --- a/applications/utilities/parallelProcessing/redistributePar/redistributePar.C +++ b/applications/utilities/parallelProcessing/redistributePar/redistributePar.C @@ -132,7 +132,7 @@ void createTimeDirs(const fileName& path) //Pstream::parRun(oldParRun); // Restore parallel state masterTimeDirs = localTimeDirs; } - Pstream::scatter(masterTimeDirs); + Pstream::broadcast(masterTimeDirs); //DebugVar(masterTimeDirs); //DebugVar(localTimeDirs); @@ -1168,7 +1168,7 @@ int main(int argc, char *argv[]) bool nfs = true; { List<fileName> roots(1, args.rootPath()); - Pstream::combineAllGather(roots, ListOps::uniqueEqOp<fileName>()); + Pstream::combineReduce(roots, ListOps::uniqueEqOp<fileName>()); nfs = (roots.size() == 1); } @@ -1203,7 +1203,7 @@ int main(int argc, char *argv[]) } } // If master changed to decompose mode make sure all nodes know about it - Pstream::scatter(decompose); + Pstream::broadcast(decompose); // If running distributed we have problem of new processors not finding @@ -1288,7 +1288,7 @@ int main(int argc, char *argv[]) // use the times list from the master processor // and select a subset based on the command-line options instantList timeDirs = timeSelector::select(runTime.times(), args); - Pstream::scatter(timeDirs); + Pstream::broadcast(timeDirs); if (timeDirs.empty()) { @@ -2067,7 +2067,7 @@ int main(int argc, char *argv[]) args )[0].value(); } - Pstream::scatter(masterTime); + Pstream::broadcast(masterTime); Info<< "Setting time to that of master or undecomposed case : " << masterTime << endl; runTime.setTime(masterTime, 0); diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/findCloudFields.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/findCloudFields.H index 30adf8ed22f..f761cbff793 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/findCloudFields.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/findCloudFields.H @@ -101,7 +101,7 @@ if (timeDirs.size() && doLagrangian) { for (auto& cloudFields : regionCloudFields) { - Pstream::mapCombineAllGather + Pstream::mapCombineReduce ( cloudFields, HashTableOps::plusEqOp<word>() diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/convertLagrangian.H b/applications/utilities/postProcessing/dataConversion/foamToVTK/convertLagrangian.H index 94659d14ded..f4af230525d 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/convertLagrangian.H +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/convertLagrangian.H @@ -46,11 +46,9 @@ if (doLagrangian) if (Pstream::parRun()) { // Synchronise cloud names - Pstream::combineGather(cloudNames, ListOps::uniqueEqOp<word>()); - Pstream::broadcast(cloudNames); + Pstream::combineReduce(cloudNames, ListOps::uniqueEqOp<word>()); } - // Consistent order - Foam::sort(cloudNames); + Foam::sort(cloudNames); // Consistent order for (const word& cloudName : cloudNames) { diff --git a/applications/utilities/postProcessing/lagrangian/particleTracks/particleTracks.C b/applications/utilities/postProcessing/lagrangian/particleTracks/particleTracks.C index d68800a141d..edd58ceb13e 100644 --- a/applications/utilities/postProcessing/lagrangian/particleTracks/particleTracks.C +++ b/applications/utilities/postProcessing/lagrangian/particleTracks/particleTracks.C @@ -186,7 +186,7 @@ int main(int argc, char *argv[]) const label maxNProcs = returnReduce(maxIds.size(), maxOp<label>()); maxIds.resize(maxNProcs, -1); - Pstream::listCombineAllGather(maxIds, maxEqOp<label>()); + Pstream::listCombineReduce(maxIds, maxEqOp<label>()); // From ids to count const labelList numIds = maxIds + 1; diff --git a/applications/utilities/postProcessing/lagrangian/particleTracks/particleTracksSamplerTemplates.C b/applications/utilities/postProcessing/lagrangian/particleTracks/particleTracksSamplerTemplates.C index d43b0eb7f7d..a29b40b69ac 100644 --- a/applications/utilities/postProcessing/lagrangian/particleTracks/particleTracksSamplerTemplates.C +++ b/applications/utilities/postProcessing/lagrangian/particleTracks/particleTracksSamplerTemplates.C @@ -77,8 +77,7 @@ Foam::label Foam::particleTracksSampler::setTrackFields if (Pstream::parRun()) { - Pstream::combineGather(fieldNames, ListOps::uniqueEqOp<word>()); - Pstream::broadcast(fieldNames); + Pstream::combineReduce(fieldNames, ListOps::uniqueEqOp<word>()); } for (const word& fieldName : fieldNames) diff --git a/applications/utilities/postProcessing/miscellaneous/postChannel/channelIndexTemplates.C b/applications/utilities/postProcessing/miscellaneous/postChannel/channelIndexTemplates.C index 61c70dd170e..e0ca2042b62 100644 --- a/applications/utilities/postProcessing/miscellaneous/postChannel/channelIndexTemplates.C +++ b/applications/utilities/postProcessing/miscellaneous/postChannel/channelIndexTemplates.C @@ -40,7 +40,7 @@ Foam::Field<T> Foam::channelIndex::regionSum(const Field<T>& cellField) const } // Global sum - Pstream::listCombineAllGather(regionField, plusEqOp<T>()); + Pstream::listCombineReduce(regionField, plusEqOp<T>()); return regionField; } diff --git a/applications/utilities/surface/surfaceMeshExtract/surfaceMeshExtract.C b/applications/utilities/surface/surfaceMeshExtract/surfaceMeshExtract.C index 341566fb948..c833d486c6b 100644 --- a/applications/utilities/surface/surfaceMeshExtract/surfaceMeshExtract.C +++ b/applications/utilities/surface/surfaceMeshExtract/surfaceMeshExtract.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2021 OpenCFD Ltd. + Copyright (C) 2017-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -302,17 +302,19 @@ int main(int argc, char *argv[]) Pstream::mapCombineGather(patchSize, plusEqOp<label>()); Pstream::mapCombineGather(zoneSize, plusEqOp<label>()); - // Allocate compact numbering for all patches/faceZones - forAllConstIters(patchSize, iter) + if (Pstream::master()) { - compactZoneID.insert(iter.key(), compactZoneID.size()); - } + // Allocate compact numbering for all patches/faceZones + forAllConstIters(patchSize, iter) + { + compactZoneID.insert(iter.key(), compactZoneID.size()); + } - forAllConstIters(zoneSize, iter) - { - compactZoneID.insert(iter.key(), compactZoneID.size()); + forAllConstIters(zoneSize, iter) + { + compactZoneID.insert(iter.key(), compactZoneID.size()); + } } - Pstream::broadcast(compactZoneID); @@ -391,13 +393,9 @@ int main(int argc, char *argv[]) // Gather all faces List<faceList> gatheredFaces(Pstream::nProcs()); gatheredFaces[Pstream::myProcNo()] = allBoundary.localFaces(); - forAll(gatheredFaces[Pstream::myProcNo()], i) + for (face& f : gatheredFaces[Pstream::myProcNo()]) { - inplaceRenumber - ( - pointToGlobal, - gatheredFaces[Pstream::myProcNo()][i] - ); + inplaceRenumber(pointToGlobal, f); } Pstream::gatherList(gatheredFaces); diff --git a/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C b/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C index fbf65a4ffda..3b8552ea553 100644 --- a/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C +++ b/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C @@ -252,7 +252,7 @@ int main(int argc, char *argv[]) dict.add("bounds", bbs); // Scatter patch information - Pstream::scatter(s.patches()); + Pstream::broadcast(s.patches()); // Construct distributedTrisurfaceMesh from components IOobject notReadIO(io); diff --git a/src/OpenFOAM/containers/Lists/SortableList/ParSortableList.C b/src/OpenFOAM/containers/Lists/SortableList/ParSortableList.C index 5e66e78be7c..c6ce91be386 100644 --- a/src/OpenFOAM/containers/Lists/SortableList/ParSortableList.C +++ b/src/OpenFOAM/containers/Lists/SortableList/ParSortableList.C @@ -202,7 +202,7 @@ void Foam::ParSortableList<Type>::sort() getPivots(sortedPivots, pivots); } - Pstream::scatter(pivots); + Pstream::broadcast(pivots); if (debug) { diff --git a/src/OpenFOAM/db/IOobjectList/IOobjectList.C b/src/OpenFOAM/db/IOobjectList/IOobjectList.C index cdfd9e97dae..ae82fd62462 100644 --- a/src/OpenFOAM/db/IOobjectList/IOobjectList.C +++ b/src/OpenFOAM/db/IOobjectList/IOobjectList.C @@ -90,12 +90,10 @@ void Foam::IOobjectList::syncNames(wordList& objNames) if (Pstream::parRun()) { // Synchronize names - Pstream::combineGather(objNames, ListOps::uniqueEqOp<word>()); - Pstream::broadcast(objNames); + Pstream::combineReduce(objNames, ListOps::uniqueEqOp<word>()); } - // Consistent order on all processors - Foam::sort(objNames); + Foam::sort(objNames); // Consistent order } diff --git a/src/OpenFOAM/fields/Fields/Field/FieldFunctions.C b/src/OpenFOAM/fields/Fields/Field/FieldFunctions.C index 9111ce62f9b..00bd0cc54e9 100644 --- a/src/OpenFOAM/fields/Fields/Field/FieldFunctions.C +++ b/src/OpenFOAM/fields/Fields/Field/FieldFunctions.C @@ -579,7 +579,7 @@ template<class Type> \ ReturnType gFunc(const UList<Type>& f, const label comm) \ { \ ReturnType res = Func(f); \ - reduce(res, rFunc##Op<ReturnType>(), Pstream::msgType(), comm); \ + reduce(res, rFunc##Op<ReturnType>(), UPstream::msgType(), comm); \ return res; \ } \ TMP_UNARY_FUNCTION(ReturnType, gFunc) @@ -611,7 +611,7 @@ typename scalarProduct<Type, Type>::type gSumProd typedef typename scalarProduct<Type, Type>::type prodType; prodType result = sumProd(f1, f2); - reduce(result, sumOp<prodType>(), Pstream::msgType(), comm); + reduce(result, sumOp<prodType>(), UPstream::msgType(), comm); return result; } @@ -624,7 +624,7 @@ Type gSumCmptProd ) { Type SumProd = sumCmptProd(f1, f2); - reduce(SumProd, sumOp<Type>(), Pstream::msgType(), comm); + reduce(SumProd, sumOp<Type>(), UPstream::msgType(), comm); return SumProd; } @@ -637,7 +637,7 @@ Type gAverage { label n = f.size(); Type s = sum(f); - sumReduce(s, n, Pstream::msgType(), comm); + sumReduce(s, n, UPstream::msgType(), comm); if (n > 0) { diff --git a/src/OpenFOAM/fields/Fields/Field/FieldOps.C b/src/OpenFOAM/fields/Fields/Field/FieldOps.C index 4d010e9e0bd..4da68f50286 100644 --- a/src/OpenFOAM/fields/Fields/Field/FieldOps.C +++ b/src/OpenFOAM/fields/Fields/Field/FieldOps.C @@ -172,7 +172,7 @@ Foam::Tuple2<T1,T2> Foam::FieldOps::findMinData result.second() = data[i]; } - Pstream::combineAllGather(result, minFirstEqOp<T1>()); + Pstream::combineReduce(result, minFirstEqOp<T1>()); return result; } @@ -193,7 +193,7 @@ Foam::Tuple2<T1,T2> Foam::FieldOps::findMaxData result.second() = data[i]; } - Pstream::combineAllGather(result, maxFirstEqOp<T1>()); + Pstream::combineReduce(result, maxFirstEqOp<T1>()); return result; } 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 bb2fc9cd5f0..2256aa117bd 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGProcAgglomerations/procFacesGAMGProcAgglomeration/procFacesGAMGProcAgglomeration.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGProcAgglomerations/procFacesGAMGProcAgglomeration/procFacesGAMGProcAgglomeration.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2016 OpenFOAM Foundation - Copyright (C) 2019-2020 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -196,7 +196,7 @@ Foam::procFacesGAMGProcAgglomeration::processorAgglomeration fineToCoarse = labelUIndList(oldToNew, fineToCoarse)(); } - Pstream::scatter(fineToCoarse, Pstream::msgType(), mesh.comm()); + Pstream::broadcast(fineToCoarse, mesh.comm()); UPstream::freeCommunicator(singleCellMeshComm); return tfineToCoarse; diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C index 8627307f8d8..4cd6e6f2e6a 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C @@ -1934,7 +1934,7 @@ Foam::pointField Foam::globalMeshData::geometricSharedPoints() const pointField sharedPoints(mesh_.points(), sharedPointLabels()); // Append from all processors, globally consistent - Pstream::combineAllGather(sharedPoints, ListOps::appendEqOp<point>()); + Pstream::combineReduce(sharedPoints, ListOps::appendEqOp<point>()); // Merge tolerance scalar tolDim = matchTol_ * mesh_.bounds().mag(); @@ -2730,7 +2730,7 @@ void Foam::globalMeshData::updateMesh() ( mesh_.nFaces(), sumOp<label>(), - Pstream::msgType(), + UPstream::msgType(), comm ); @@ -2743,7 +2743,7 @@ void Foam::globalMeshData::updateMesh() ( mesh_.nCells(), sumOp<label>(), - Pstream::msgType(), + UPstream::msgType(), comm ); @@ -2756,7 +2756,7 @@ void Foam::globalMeshData::updateMesh() ( mesh_.nPoints(), sumOp<label>(), - Pstream::msgType(), + UPstream::msgType(), comm ); diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeBase.H b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeBase.H index 30908213a83..a92dd574c7c 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeBase.H +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeBase.H @@ -412,7 +412,7 @@ public: const globalIndex&, labelList& elements, List<Map<label>>& compactMap, - const int tag = Pstream::msgType(), + const int tag = UPstream::msgType(), const label comm = UPstream::worldComm ); @@ -426,7 +426,7 @@ public: const globalIndex&, labelListList& cellCells, List<Map<label>>& compactMap, - const int tag = Pstream::msgType(), + const int tag = UPstream::msgType(), const label comm = UPstream::worldComm ); diff --git a/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C b/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C index b2d3e03e955..524ef8746a8 100644 --- a/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C +++ b/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C @@ -322,7 +322,7 @@ void Foam::syncTools::syncPointMap } // Broadcast: send merged values to all - Pstream::scatter(sharedPointValues); + Pstream::broadcast(sharedPointValues); } // Merge sharedPointValues (keyed on sharedPointAddr) into @@ -667,7 +667,7 @@ void Foam::syncTools::syncEdgeMap } // Broadcast: send merged values to all - Pstream::scatter(sharedEdgeValues); + Pstream::broadcast(sharedEdgeValues); } diff --git a/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransform.C b/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransform.C index 1a763056d2e..b67c2c02bec 100644 --- a/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransform.C +++ b/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransform.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -269,7 +269,7 @@ void Foam::globalIndexAndTransform::determineTransforms() } transforms_.transfer(localTransforms); - Pstream::scatter(transforms_); + Pstream::broadcast(transforms_); } diff --git a/src/OpenFOAM/primitives/random/Random/Random.C b/src/OpenFOAM/primitives/random/Random/Random.C index 2094b063409..73da1f7bdaa 100644 --- a/src/OpenFOAM/primitives/random/Random/Random.C +++ b/src/OpenFOAM/primitives/random/Random/Random.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2017-2020 OpenCFD Ltd. + Copyright (C) 2017-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -143,14 +143,14 @@ Foam::label Foam::Random::position(const label& start, const label& end) template<> Foam::scalar Foam::Random::globalSample01() { - scalar value(-GREAT); + scalar value(0); if (Pstream::master()) { value = scalar01(); } - Pstream::scatter(value); + Pstream::broadcast(value); return value; } @@ -159,14 +159,14 @@ Foam::scalar Foam::Random::globalSample01() template<> Foam::label Foam::Random::globalSample01() { - label value(labelMin); + label value(0); if (Pstream::master()) { value = round(scalar01()); } - Pstream::scatter(value); + Pstream::broadcast(value); return value; } @@ -175,14 +175,14 @@ Foam::label Foam::Random::globalSample01() template<> Foam::scalar Foam::Random::globalGaussNormal() { - scalar value(-GREAT); + scalar value(0); if (Pstream::master()) { value = GaussNormal<scalar>(); } - Pstream::scatter(value); + Pstream::broadcast(value); return value; } @@ -191,14 +191,14 @@ Foam::scalar Foam::Random::globalGaussNormal() template<> Foam::label Foam::Random::globalGaussNormal() { - label value(labelMin); + label value(0); if (Pstream::master()) { value = GaussNormal<label>(); } - Pstream::scatter(value); + Pstream::broadcast(value); return value; } @@ -211,14 +211,14 @@ Foam::scalar Foam::Random::globalPosition const scalar& end ) { - scalar value(-GREAT); + scalar value(0); if (Pstream::master()) { value = position<scalar>(start, end); } - Pstream::scatter(value); + Pstream::broadcast(value); return value; } @@ -231,14 +231,14 @@ Foam::label Foam::Random::globalPosition const label& end ) { - label value(labelMin); + label value(0); if (Pstream::master()) { value = position<label>(start, end); } - Pstream::scatter(value); + Pstream::broadcast(value); return value; } diff --git a/src/OpenFOAM/primitives/random/Random/RandomTemplates.C b/src/OpenFOAM/primitives/random/Random/RandomTemplates.C index de1379170d5..ab4d0ed55d6 100644 --- a/src/OpenFOAM/primitives/random/Random/RandomTemplates.C +++ b/src/OpenFOAM/primitives/random/Random/RandomTemplates.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2015 OpenFOAM Foundation - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -92,14 +92,14 @@ void Foam::Random::shuffle(UList<Type>& values) template<class Type> Type Foam::Random::globalSample01() { - Type value = -GREAT*pTraits<Type>::one; + Type value(Zero); if (Pstream::master()) { value = sample01<Type>(); } - Pstream::scatter(value); + Pstream::broadcast(value); return value; } @@ -108,14 +108,14 @@ Type Foam::Random::globalSample01() template<class Type> Type Foam::Random::globalGaussNormal() { - Type value = -GREAT*pTraits<Type>::one; + Type value(Zero); if (Pstream::master()) { value = GaussNormal<Type>(); } - Pstream::scatter(value); + Pstream::broadcast(value); return value; } @@ -124,14 +124,14 @@ Type Foam::Random::globalGaussNormal() template<class Type> Type Foam::Random::globalPosition(const Type& start, const Type& end) { - Type value = -GREAT*pTraits<Type>::one; + Type value(Zero); if (Pstream::master()) { value = position<Type>(start, end); } - Pstream::scatter(value); + Pstream::broadcast(value); return value; } @@ -140,14 +140,12 @@ Type Foam::Random::globalPosition(const Type& start, const Type& end) template<class Type> void Foam::Random::globalRandomise01(Type& value) { - value = -GREAT*pTraits<Type>::one; - if (Pstream::master()) { value = sample01<Type>(); } - Pstream::scatter(value); + Pstream::broadcast(value); } diff --git a/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.C b/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.C index a0b06807e0f..58b5657bd1e 100644 --- a/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.C +++ b/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.C @@ -228,7 +228,7 @@ void Foam::extrudePatchMesh::extrudeMesh(polyPatchList& regionPatches) } // Reduce - Pstream::mapCombineAllGather(globalSum, plusEqOp<point>()); + Pstream::mapCombineReduce(globalSum, plusEqOp<point>()); forAll(localToGlobalRegion, localRegionI) { diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C index fd8416cd2a2..5751e519c3a 100644 --- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C +++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C @@ -216,7 +216,7 @@ Foam::wordList Foam::fvMeshDistribute::mergeWordList(const wordList& procNames) } } } - Pstream::scatter(mergedNames); + Pstream::broadcast(mergedNames); return mergedNames; } diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8.C index 1073465ab11..512fbcb8b5f 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8.C @@ -436,7 +436,7 @@ Foam::scalar Foam::hexRef8::getLevel0EdgeLength() const // Get the minimum per level over all processors. Note minimum so if // cells are not cubic we use the smallest edge side. - Pstream::listCombineAllGather(typEdgeLenSqr, minEqOp<scalar>()); + Pstream::listCombineReduce(typEdgeLenSqr, minEqOp<scalar>()); if (debug) { @@ -470,7 +470,7 @@ Foam::scalar Foam::hexRef8::getLevel0EdgeLength() const } } - Pstream::listCombineAllGather(maxEdgeLenSqr, maxEqOp<scalar>()); + Pstream::listCombineReduce(maxEdgeLenSqr, maxEqOp<scalar>()); if (debug) { diff --git a/src/fileFormats/vtk/file/foamVtkFileWriter.H b/src/fileFormats/vtk/file/foamVtkFileWriter.H index 248b6a9004c..98f47939508 100644 --- a/src/fileFormats/vtk/file/foamVtkFileWriter.H +++ b/src/fileFormats/vtk/file/foamVtkFileWriter.H @@ -263,7 +263,7 @@ public: virtual bool open ( const fileName& file, - bool parallel = Pstream::parRun() + bool parallel = UPstream::parRun() ); //- End the file contents and close the file after writing. diff --git a/src/finiteArea/faMesh/faGlobalMeshData/faGlobalMeshData.C b/src/finiteArea/faMesh/faGlobalMeshData/faGlobalMeshData.C index 0c8e68f8f4d..d83324d1b0d 100644 --- a/src/finiteArea/faMesh/faGlobalMeshData/faGlobalMeshData.C +++ b/src/finiteArea/faMesh/faGlobalMeshData/faGlobalMeshData.C @@ -118,7 +118,7 @@ void Foam::faGlobalMeshData::updateMesh() sharedPointLabels_ = sharedPointLabels.toc(); - Pstream::combineAllGather(globalList, plusEqOp<labelField>()); + Pstream::combineReduce(globalList, plusEqOp<labelField>()); nGlobalPoints_ = 0; for (label i=0; i<globalList.size(); ++i) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.C index 4c36356947d..b31a781d3a9 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.C @@ -164,7 +164,7 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::initialisePatch() sumTriMagSf_ = Zero; sumTriMagSf_[Pstream::myProcNo() + 1] = sum(triMagSf); - Pstream::listCombineAllGather(sumTriMagSf_, maxEqOp<scalar>()); + Pstream::listCombineReduce(sumTriMagSf_, maxEqOp<scalar>()); for (label i = 1; i < triMagSf.size(); ++i) { diff --git a/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubset.C b/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubset.C index 308a5530090..3dba1abcd66 100644 --- a/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubset.C +++ b/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubset.C @@ -1042,7 +1042,7 @@ void Foam::fvMeshSubset::reset // Get patch sizes (up to nextPatchID). // Note that up to nextPatchID the globalPatchMap is an identity so // no need to index through that. - Pstream::listCombineAllGather(globalPatchSizes, plusEqOp<label>()); + Pstream::listCombineReduce(globalPatchSizes, plusEqOp<label>()); // Now all processors have all the patchnames. // Decide: if all processors have the same patch names and size is zero diff --git a/src/functionObjects/field/Curle/Curle.C b/src/functionObjects/field/Curle/Curle.C index a03bf0fd93a..813d976130a 100644 --- a/src/functionObjects/field/Curle/Curle.C +++ b/src/functionObjects/field/Curle/Curle.C @@ -223,7 +223,7 @@ bool Foam::functionObjects::Curle::execute() pDash /= 4*mathematical::pi; - Pstream::listCombineAllGather(pDash, plusEqOp<scalar>()); + Pstream::listCombineReduce(pDash, plusEqOp<scalar>()); if (surfaceWriterPtr_) { diff --git a/src/functionObjects/field/DMD/DMDModels/derived/STDMD/STDMD.C b/src/functionObjects/field/DMD/DMDModels/derived/STDMD/STDMD.C index 2ef2efe23e0..206f7025d08 100644 --- a/src/functionObjects/field/DMD/DMDModels/derived/STDMD/STDMD.C +++ b/src/functionObjects/field/DMD/DMDModels/derived/STDMD/STDMD.C @@ -188,8 +188,8 @@ void Foam::DMDModels::STDMD::compress() q.subColumn(i) = EVecs.subColumn(permutation[i]); } } - Pstream::scatter(G_); - Pstream::scatter(q); + Pstream::broadcast(G_); + Pstream::broadcast(q); // Update "Q" Q_ = Q_*q; @@ -357,8 +357,8 @@ reducedKoopmanOperator() A1 = RxInv_*RMatrix(MatrixTools::pinv(Rx*(G_^Rx))); Rx.clear(); } - Pstream::scatter(RxInv_); - Pstream::scatter(A1); + Pstream::broadcast(RxInv_); + Pstream::broadcast(A1); Info<< tab << "Computing A2" << endl; SMatrix A2(Qupper_ & Qlower_); @@ -452,15 +452,15 @@ bool Foam::DMDModels::STDMD::eigendecomposition(SMatrix& Atilde) evals_ = cp; } } - Pstream::scatter(fail); + Pstream::broadcast(fail); if (fail) { return false; } - Pstream::scatter(evals_); - Pstream::scatter(evecs_); + Pstream::broadcast(evals_); + Pstream::broadcast(evecs_); return true; } @@ -503,8 +503,8 @@ void Foam::DMDModels::STDMD::frequencies() it = std::find_if(std::next(it), freqs_.cend(), margin); } } - Pstream::scatter(freqs_); - Pstream::scatter(freqsi_); + Pstream::broadcast(freqs_); + Pstream::broadcast(freqsi_); } @@ -567,7 +567,7 @@ void Foam::DMDModels::STDMD::amplitudes() } } } - Pstream::scatter(amps_); + Pstream::broadcast(amps_); } @@ -648,8 +648,8 @@ void Foam::DMDModels::STDMD::magnitudes() std::sort(magsi_.begin(), magsi_.end(), descend); } - Pstream::scatter(mags_); - Pstream::scatter(magsi_); + Pstream::broadcast(mags_); + Pstream::broadcast(magsi_); } diff --git a/src/functionObjects/field/columnAverage/columnAverageTemplates.C b/src/functionObjects/field/columnAverage/columnAverageTemplates.C index 50d40abe8ff..ab95a2b48fd 100644 --- a/src/functionObjects/field/columnAverage/columnAverageTemplates.C +++ b/src/functionObjects/field/columnAverage/columnAverageTemplates.C @@ -87,8 +87,8 @@ bool Foam::functionObjects::columnAverage::columnAverageField } // Global sum - Pstream::listCombineAllGather(regionField, plusEqOp<Type>()); - Pstream::listCombineAllGather(regionCount, plusEqOp<label>()); + Pstream::listCombineReduce(regionField, plusEqOp<Type>()); + Pstream::listCombineReduce(regionCount, plusEqOp<label>()); forAll(regionField, regioni) { diff --git a/src/functionObjects/field/externalCoupled/externalCoupled.C b/src/functionObjects/field/externalCoupled/externalCoupled.C index 0feb198e422..4b45fb5df17 100644 --- a/src/functionObjects/field/externalCoupled/externalCoupled.C +++ b/src/functionObjects/field/externalCoupled/externalCoupled.C @@ -430,7 +430,7 @@ void Foam::functionObjects::externalCoupled::initCoupling() || isFile(dir/"patchFaces"); } - Pstream::scatter(geomExists); + Pstream::broadcast(geomExists); if (!geomExists) { diff --git a/src/functionObjects/field/extractEulerianParticles/extractEulerianParticles/extractEulerianParticles.C b/src/functionObjects/field/extractEulerianParticles/extractEulerianParticles/extractEulerianParticles.C index b97268833d4..d0ae95a7927 100644 --- a/src/functionObjects/field/extractEulerianParticles/extractEulerianParticles/extractEulerianParticles.C +++ b/src/functionObjects/field/extractEulerianParticles/extractEulerianParticles/extractEulerianParticles.C @@ -333,7 +333,7 @@ void Foam::functionObjects::extractEulerianParticles::calculateAddressing // Create map from new regions to slots in particles list // - filter through new-to-new addressing to identify new particles - Pstream::listCombineAllGather(newToNewRegion, maxEqOp<label>()); + Pstream::listCombineReduce(newToNewRegion, maxEqOp<label>()); label nParticle = -1; labelHashSet newRegions; @@ -352,7 +352,7 @@ void Foam::functionObjects::extractEulerianParticles::calculateAddressing // Accumulate old region data or create a new particle if there is no // mapping from the old-to-new region - Pstream::listCombineAllGather(oldToNewRegion, maxEqOp<label>()); + Pstream::listCombineReduce(oldToNewRegion, maxEqOp<label>()); List<eulerianParticle> newParticles(newRegionToParticleMap.size()); forAll(oldToNewRegion, oldRegioni) diff --git a/src/functionObjects/field/regionSizeDistribution/regionSizeDistribution.C b/src/functionObjects/field/regionSizeDistribution/regionSizeDistribution.C index 3292d9e2afd..eac6555f3de 100644 --- a/src/functionObjects/field/regionSizeDistribution/regionSizeDistribution.C +++ b/src/functionObjects/field/regionSizeDistribution/regionSizeDistribution.C @@ -66,7 +66,7 @@ static Map<Type> regionSum(const regionSplit& regions, const Field<Type>& fld) regionToSum(regioni, Type(Zero)) += fld[celli]; } - Pstream::mapCombineAllGather(regionToSum, plusEqOp<Type>()); + Pstream::mapCombineReduce(regionToSum, plusEqOp<Type>()); return regionToSum; } @@ -214,7 +214,7 @@ Foam::functionObjects::regionSizeDistribution::findPatchRegions // Make sure all the processors have the same set of regions - Pstream::mapCombineAllGather(patchRegions, minEqOp<label>()); + Pstream::mapCombineReduce(patchRegions, minEqOp<label>()); return patchRegions; } diff --git a/src/functionObjects/field/streamLine/streamLineBase.C b/src/functionObjects/field/streamLine/streamLineBase.C index d29e4363139..71a476e83a8 100644 --- a/src/functionObjects/field/streamLine/streamLineBase.C +++ b/src/functionObjects/field/streamLine/streamLineBase.C @@ -800,7 +800,7 @@ bool Foam::functionObjects::streamLineBase::writeToFile() // File names generated on the master but setProperty needed everywher - Pstream::scatter(outputFileNames); + Pstream::broadcast(outputFileNames); forAllConstIters(outputFileNames, iter) { diff --git a/src/functionObjects/forces/propellerInfo/propellerInfo.C b/src/functionObjects/forces/propellerInfo/propellerInfo.C index b7d3d5d6605..96f120b79f0 100644 --- a/src/functionObjects/forces/propellerInfo/propellerInfo.C +++ b/src/functionObjects/forces/propellerInfo/propellerInfo.C @@ -470,7 +470,7 @@ void Foam::functionObjects::propellerInfo::updateSampleDiskCells() } } - Pstream::listCombineAllGather(pointMask_, orEqOp<bool>()); + Pstream::listCombineReduce(pointMask_, orEqOp<bool>()); } @@ -785,7 +785,7 @@ Foam::tmp<Foam::Field<Type>> Foam::functionObjects::propellerInfo::interpolate } } - Pstream::listCombineAllGather(field, maxEqOp<Type>()); + Pstream::listCombineReduce(field, maxEqOp<Type>()); return tfield; } diff --git a/src/functionObjects/lagrangian/vtkCloud/vtkCloudTemplates.C b/src/functionObjects/lagrangian/vtkCloud/vtkCloudTemplates.C index 0917da8c468..c28bc1fe4c7 100644 --- a/src/functionObjects/lagrangian/vtkCloud/vtkCloudTemplates.C +++ b/src/functionObjects/lagrangian/vtkCloud/vtkCloudTemplates.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018-2021 OpenCFD Ltd. + Copyright (C) 2018-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -56,11 +56,8 @@ Foam::wordList Foam::functionObjects::vtkCloud::writeFields // Thus need to resolve names between all processors. wordList fieldNames(obrTmp.names<IOField<Type>>()); - Pstream::combineGather(fieldNames, ListOps::uniqueEqOp<word>()); - Pstream::broadcast(fieldNames); - - // Consistent order on all processors - Foam::sort(fieldNames); + Pstream::combineReduce(fieldNames, ListOps::uniqueEqOp<word>()); + Foam::sort(fieldNames); // Consistent order for (const word& fieldName : fieldNames) { diff --git a/src/functionObjects/utilities/abort/abort.C b/src/functionObjects/utilities/abort/abort.C index c8a8e0d531d..639072e7d80 100644 --- a/src/functionObjects/utilities/abort/abort.C +++ b/src/functionObjects/utilities/abort/abort.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2016-2021 OpenCFD Ltd. + Copyright (C) 2016-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -218,9 +218,9 @@ bool Foam::functionObjects::abort::execute() } } - // Send to slaves. Also acts as an MPI barrier - label intAction(action); - Pstream::scatter(intAction); + // Send to sub-ranks. Also acts as an MPI barrier + int intAction(action); + Pstream::broadcast(intAction); action = Time::stopAtControls(intAction); diff --git a/src/functionObjects/utilities/areaWrite/areaWrite.C b/src/functionObjects/utilities/areaWrite/areaWrite.C index d352615f706..1d82cf271c7 100644 --- a/src/functionObjects/utilities/areaWrite/areaWrite.C +++ b/src/functionObjects/utilities/areaWrite/areaWrite.C @@ -267,7 +267,7 @@ bool Foam::areaWrite::write() } // Parallel consistency (no-op in serial) - Pstream::mapCombineAllGather(selected, HashSetOps::plusEqOp<word>()); + Pstream::mapCombineReduce(selected, HashSetOps::plusEqOp<word>()); missed.clear(); diff --git a/src/functionObjects/utilities/areaWrite/areaWriteTemplates.C b/src/functionObjects/utilities/areaWrite/areaWriteTemplates.C index b68d656a35d..ebb1ce3cc65 100644 --- a/src/functionObjects/utilities/areaWrite/areaWriteTemplates.C +++ b/src/functionObjects/utilities/areaWrite/areaWriteTemplates.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019-2021 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -73,16 +73,12 @@ void Foam::areaWrite::performAction { fieldNames = areaMesh.thisDb().names<GeoField>(fieldSelection_); - // With syncPar + // Synchronize names if (Pstream::parRun()) { - // Synchronize names - Pstream::combineGather(fieldNames, ListOps::uniqueEqOp<word>()); - Pstream::broadcast(fieldNames); + Pstream::combineReduce(fieldNames, ListOps::uniqueEqOp<word>()); } - - // Sort for consistent order on all processors - Foam::sort(fieldNames); + Foam::sort(fieldNames); // Consistent order } for (const word& fieldName : fieldNames) diff --git a/src/functionObjects/utilities/parProfiling/parProfiling.C b/src/functionObjects/utilities/parProfiling/parProfiling.C index d144dff1f04..3ba33caf6e7 100644 --- a/src/functionObjects/utilities/parProfiling/parProfiling.C +++ b/src/functionObjects/utilities/parProfiling/parProfiling.C @@ -27,7 +27,6 @@ License #include "parProfiling.H" #include "addToRunTimeSelectionTable.H" -#include "UPstream.H" #include "Pstream.H" #include "PstreamReduceOps.H" #include "profilingPstream.H" diff --git a/src/functionObjects/utilities/systemCall/systemCall.C b/src/functionObjects/utilities/systemCall/systemCall.C index 1538f38735d..f5252fa98a4 100644 --- a/src/functionObjects/utilities/systemCall/systemCall.C +++ b/src/functionObjects/utilities/systemCall/systemCall.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018-2020 OpenCFD Ltd. + Copyright (C) 2018-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -73,7 +73,7 @@ Foam::label Foam::functionObjects::systemCall::dispatch(const stringList& calls) // MPI barrier if (masterOnly_) { - Pstream::scatter(nCalls); + Pstream::broadcast(nCalls); } return nCalls; diff --git a/src/lagrangian/basic/Cloud/CloudIO.C b/src/lagrangian/basic/Cloud/CloudIO.C index 993fef90f16..d9eed027926 100644 --- a/src/lagrangian/basic/Cloud/CloudIO.C +++ b/src/lagrangian/basic/Cloud/CloudIO.C @@ -104,7 +104,7 @@ void Foam::Cloud<ParticleType>::writeCloudUniformProperties() const labelList np(Pstream::nProcs(), Zero); np[Pstream::myProcNo()] = ParticleType::particleCount_; - Pstream::listCombineAllGather(np, maxEqOp<label>()); + Pstream::listCombineReduce(np, maxEqOp<label>()); uniformPropsDict.add ( diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleZoneInfo/ParticleZoneInfo.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleZoneInfo/ParticleZoneInfo.C index 5f3c92bb17e..d01800976c8 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleZoneInfo/ParticleZoneInfo.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleZoneInfo/ParticleZoneInfo.C @@ -361,8 +361,7 @@ void Foam::ParticleZoneInfo<CloudType>::write() { // Find number of particles per proc labelList allMaxIDs(maxIDs_); - Pstream::listCombineGather(allMaxIDs, maxEqOp<label>()); - Pstream::broadcast(allMaxIDs); + Pstream::listCombineReduce(allMaxIDs, maxEqOp<label>()); // Combine into single list label n = returnReduce(data_.size(), sumOp<label>()); diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/CellZoneInjection/CellZoneInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/CellZoneInjection/CellZoneInjection.C index cade4faea94..4993effd616 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/CellZoneInjection/CellZoneInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/CellZoneInjection/CellZoneInjection.C @@ -120,7 +120,7 @@ void Foam::CellZoneInjection<CloudType>::setPositions globalPositions.localStart(Pstream::myProcNo()) ) = positions; - Pstream::listCombineAllGather(allPositions, minEqOp<point>()); + Pstream::listCombineReduce(allPositions, minEqOp<point>()); // Gather local cell tet and tet-point Ids, but leave non-local ids set -1 SubList<label> diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.C index 227aefcf5f7..d65aa96c979 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2015-2021 OpenCFD Ltd. + Copyright (C) 2015-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -417,7 +417,7 @@ Foam::label Foam::InflationInjection<CloudType>::parcelsToInject newParticles_ = combinedNewParticles; } - Pstream::scatter(newParticles_); + Pstream::broadcast(newParticles_); } return newParticles_.size(); diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectedParticleDistributionInjection/InjectedParticleDistributionInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectedParticleDistributionInjection/InjectedParticleDistributionInjection.C index 5dadeb83e6b..d033f433eb3 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectedParticleDistributionInjection/InjectedParticleDistributionInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectedParticleDistributionInjection/InjectedParticleDistributionInjection.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -62,8 +62,7 @@ void Foam::InjectedParticleDistributionInjection<CloudType>::initialise() { List<List<label>> procTag(Pstream::nProcs()); procTag[Pstream::myProcNo()].transfer(tag); - Pstream::gatherList(procTag); - Pstream::scatterList(procTag); + Pstream::allGatherList(procTag); tag = ListListOps::combine<List<label>> ( @@ -72,8 +71,7 @@ void Foam::InjectedParticleDistributionInjection<CloudType>::initialise() List<List<point>> procPosition(Pstream::nProcs()); procPosition[Pstream::myProcNo()].transfer(position); - Pstream::gatherList(procPosition); - Pstream::scatterList(procPosition); + Pstream::allGatherList(procPosition); position = ListListOps::combine<List<point>> ( @@ -82,8 +80,7 @@ void Foam::InjectedParticleDistributionInjection<CloudType>::initialise() List<List<vector>> procU(Pstream::nProcs()); procU[Pstream::myProcNo()].transfer(U); - Pstream::gatherList(procU); - Pstream::scatterList(procU); + Pstream::allGatherList(procU); U = ListListOps::combine<List<vector>> ( @@ -92,8 +89,7 @@ void Foam::InjectedParticleDistributionInjection<CloudType>::initialise() List<List<scalar>> procSOI(Pstream::nProcs()); procSOI[Pstream::myProcNo()].transfer(soi); - Pstream::gatherList(procSOI); - Pstream::scatterList(procSOI); + Pstream::allGatherList(procSOI); soi = ListListOps::combine<List<scalar>> ( @@ -102,8 +98,7 @@ void Foam::InjectedParticleDistributionInjection<CloudType>::initialise() List<List<scalar>> procD(Pstream::nProcs()); procD[Pstream::myProcNo()].transfer(d); - Pstream::gatherList(procD); - Pstream::scatterList(procD); + Pstream::allGatherList(procD); d = ListListOps::combine<List<scalar>> ( diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectedParticleInjection/InjectedParticleInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectedParticleInjection/InjectedParticleInjection.C index 1057ea9cd21..9e8b6597e4c 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectedParticleInjection/InjectedParticleInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectedParticleInjection/InjectedParticleInjection.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -62,8 +62,7 @@ void Foam::InjectedParticleInjection<CloudType>::initialise() { List<List<scalar>> procTime(Pstream::nProcs()); procTime[Pstream::myProcNo()].transfer(time); - Pstream::gatherList(procTime); - Pstream::scatterList(procTime); + Pstream::allGatherList(procTime); time = ListListOps::combine<List<scalar>> ( @@ -72,8 +71,7 @@ void Foam::InjectedParticleInjection<CloudType>::initialise() List<List<point>> procPosition(Pstream::nProcs()); procPosition[Pstream::myProcNo()].transfer(position); - Pstream::gatherList(procPosition); - Pstream::scatterList(procPosition); + Pstream::allGatherList(procPosition); position = ListListOps::combine<List<point>> ( @@ -82,8 +80,7 @@ void Foam::InjectedParticleInjection<CloudType>::initialise() List<List<scalar>> procD(Pstream::nProcs()); procD[Pstream::myProcNo()].transfer(diameter); - Pstream::gatherList(procD); - Pstream::scatterList(procD); + Pstream::allGatherList(procD); diameter = ListListOps::combine<List<scalar>> ( @@ -92,8 +89,7 @@ void Foam::InjectedParticleInjection<CloudType>::initialise() List<List<vector>> procU(Pstream::nProcs()); procU[Pstream::myProcNo()].transfer(U); - Pstream::gatherList(procU); - Pstream::scatterList(procU); + Pstream::allGatherList(procU); U = ListListOps::combine<List<vector>> ( diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/patchInjectionBase.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/patchInjectionBase.C index 2f5043d4187..36b5a7d8746 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/patchInjectionBase.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/patchInjectionBase.C @@ -114,7 +114,7 @@ void Foam::patchInjectionBase::updateMesh(const polyMesh& mesh) sumTriMagSf_ = Zero; sumTriMagSf_[Pstream::myProcNo() + 1] = sum(triMagSf); - Pstream::listCombineAllGather(sumTriMagSf_, maxEqOp<scalar>()); + Pstream::listCombineReduce(sumTriMagSf_, maxEqOp<scalar>()); for (label i = 1; i < triMagSf.size(); i++) { diff --git a/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloudI.H b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloudI.H index 4ce6c576bc6..8e2a817dab0 100644 --- a/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloudI.H +++ b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloudI.H @@ -181,7 +181,7 @@ inline Foam::scalar Foam::SprayCloud<CloudType>::penetration } } - Pstream::scatter(distance); + Pstream::broadcast(distance); return distance; } diff --git a/src/lumpedPointMotion/movement/lumpedPointMovement.C b/src/lumpedPointMotion/movement/lumpedPointMovement.C index 5a5d28929a7..dcfc841ad2b 100644 --- a/src/lumpedPointMotion/movement/lumpedPointMovement.C +++ b/src/lumpedPointMotion/movement/lumpedPointMovement.C @@ -880,7 +880,7 @@ Foam::List<Foam::scalar> Foam::lumpedPointMovement::areas } } - Pstream::listCombineAllGather(zoneAreas, plusEqOp<scalar>()); + Pstream::listCombineReduce(zoneAreas, plusEqOp<scalar>()); return zoneAreas; } @@ -1008,8 +1008,8 @@ bool Foam::lumpedPointMovement::forcesAndMoments Info<<"No pressure field" << endl; } - Pstream::listCombineAllGather(forces, plusEqOp<vector>()); - Pstream::listCombineAllGather(moments, plusEqOp<vector>()); + Pstream::listCombineReduce(forces, plusEqOp<vector>()); + Pstream::listCombineReduce(moments, plusEqOp<vector>()); return true; } diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C index 7e8ed9e1876..3122030b02b 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C @@ -1973,7 +1973,7 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::meshRefinement::balance labelList nProcCells(distributor.countCells(distribution)); Pout<< "Wanted distribution:" << nProcCells << endl; - Pstream::listCombineAllGather(nProcCells, plusEqOp<label>()); + Pstream::listCombineReduce(nProcCells, plusEqOp<label>()); Pout<< "Wanted resulting decomposition:" << endl; forAll(nProcCells, proci) diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C index cefd97b46e6..152ab788534 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C @@ -823,7 +823,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::createZoneBaffles if (nTotalBaffles > 0) { - Pstream::listCombineAllGather(nBaffles, plusEqOp<label>()); + Pstream::listCombineReduce(nBaffles, plusEqOp<label>()); Info<< nl << setf(ios_base::left) @@ -1953,7 +1953,7 @@ void Foam::meshRefinement::findCellZoneTopo // - region numbers are identical on all processors // - keepRegion is identical ,, // - cellZones are identical ,, - Pstream::listCombineAllGather(regionToCellZone, maxEqOp<label>()); + Pstream::listCombineReduce(regionToCellZone, maxEqOp<label>()); // Find the region containing the keepPoint @@ -2003,7 +2003,7 @@ void Foam::meshRefinement::findCellZoneTopo // - cellZones are identical ,, // This done at top of loop to account for geometric matching // not being synchronised. - Pstream::listCombineAllGather(regionToCellZone, maxEqOp<label>()); + Pstream::listCombineReduce(regionToCellZone, maxEqOp<label>()); bool changed = false; @@ -5862,7 +5862,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify // 2.Combine faceZoneNames allocated on different processors - Pstream::mapCombineAllGather(zonesToFaceZone, eqOp<word>()); + Pstream::mapCombineReduce(zonesToFaceZone, eqOp<word>()); // 3. Allocate faceZones from (now synchronised) faceZoneNames @@ -6085,7 +6085,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify nPosOrientation.find(faceToConnectedZone[faceI])() += n; } } - Pstream::mapCombineAllGather(nPosOrientation, plusEqOp<label>()); + Pstream::mapCombineReduce(nPosOrientation, plusEqOp<label>()); Info<< "Split " << nFreeStanding << " free-standing zone faces" diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.C b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.C index 7fc5cccc869..ff5af5aedfa 100644 --- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.C +++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.C @@ -3263,9 +3263,9 @@ void Foam::snappyRefineDriver::deleteSmallRegions nCellsPerRegion[regioni]++; nCellsPerZone[zonei]++; } - Pstream::listCombineAllGather(nCellsPerRegion, plusEqOp<label>()); - Pstream::listCombineAllGather(regionToZone, maxEqOp<label>()); - Pstream::listCombineAllGather(nCellsPerZone, plusEqOp<label>()); + Pstream::listCombineReduce(nCellsPerRegion, plusEqOp<label>()); + Pstream::listCombineReduce(regionToZone, maxEqOp<label>()); + Pstream::listCombineReduce(nCellsPerZone, plusEqOp<label>()); // Mark small regions. Note that all processors have the same information diff --git a/src/meshTools/coupling/externalFileCoupler.C b/src/meshTools/coupling/externalFileCoupler.C index 95c6611f3fb..19a544f3a2d 100644 --- a/src/meshTools/coupling/externalFileCoupler.C +++ b/src/meshTools/coupling/externalFileCoupler.C @@ -282,9 +282,9 @@ Foam::externalFileCoupler::waitForMaster() const } } - label intAction(action); - - Pstream::scatter(intAction); // Also acts as MPI barrier + // Send to sub-ranks. Also acts as an MPI barrier + int intAction(action); + Pstream::broadcast(intAction); return Time::stopAtControls(intAction); } @@ -326,9 +326,9 @@ Foam::externalFileCoupler::waitForSlave() const Log << type() << ": found lock file " << lck << endl; } - label intAction(action); - - Pstream::scatter(intAction); // Also acts as MPI barrier + // Send to sub-ranks. Also acts as an MPI barrier + int intAction(action); + Pstream::broadcast(intAction); return Time::stopAtControls(intAction); } diff --git a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C index a1ea79bf9e8..e4928adc3ba 100644 --- a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C +++ b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C @@ -668,7 +668,7 @@ void Foam::mappedPatchBase::findSamples // Find nearest - globally consistent - Pstream::listCombineAllGather + Pstream::listCombineReduce ( nearest, nearestWorldEqOp(), diff --git a/src/meshTools/multiWorld/multiWorldConnectionsObject.C b/src/meshTools/multiWorld/multiWorldConnectionsObject.C index f8d2c438ed9..21efa3169e7 100644 --- a/src/meshTools/multiWorld/multiWorldConnectionsObject.C +++ b/src/meshTools/multiWorld/multiWorldConnectionsObject.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2021 OpenCFD Ltd. + Copyright (C) 2021-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -241,12 +241,7 @@ void Foam::multiWorldConnections::createComms() if (Pstream::parRun()) { - Pstream::combineGather - ( - allConnections, - worldConnectBitOrEq() - ); - Pstream::scatter(allConnections); + Pstream::combineReduce(allConnections, worldConnectBitOrEq()); } // Check for mismatched connections diff --git a/src/meshTools/output/vtk/topoSet/foamVtkWriteTopoSet.H b/src/meshTools/output/vtk/topoSet/foamVtkWriteTopoSet.H index 5f5a60e0d16..220ecb151bd 100644 --- a/src/meshTools/output/vtk/topoSet/foamVtkWriteTopoSet.H +++ b/src/meshTools/output/vtk/topoSet/foamVtkWriteTopoSet.H @@ -70,7 +70,7 @@ bool writeTopoSet const topoSet& set, const vtk::outputOptions opts, const fileName& file, - bool parallel = Pstream::parRun() + bool parallel = UPstream::parRun() ); @@ -83,7 +83,7 @@ bool writeFaceSet const faceSet& set, const vtk::outputOptions opts, const fileName& file, - bool parallel = Pstream::parRun() + bool parallel = UPstream::parRun() ); @@ -96,7 +96,7 @@ bool writeCellSetFaces const cellSet& set, const vtk::outputOptions opts, const fileName& file, - bool parallel = Pstream::parRun() + bool parallel = UPstream::parRun() ); @@ -109,7 +109,7 @@ bool writePointSet const pointSet& set, const vtk::outputOptions opts, const fileName& file, - bool parallel = Pstream::parRun() + bool parallel = UPstream::parRun() ); diff --git a/src/meshTools/regionSplit2D/regionSplit2D.C b/src/meshTools/regionSplit2D/regionSplit2D.C index d11518a0622..dc22cde3509 100644 --- a/src/meshTools/regionSplit2D/regionSplit2D.C +++ b/src/meshTools/regionSplit2D/regionSplit2D.C @@ -139,7 +139,7 @@ Foam::regionSplit2D::regionSplit2D // Ensure regionToCompactAddr consistent across all processors // - not concerned about the op (keys are unique) // - map size will be the number of regions in the set of faces - Pstream::mapCombineAllGather(regionToCompactAddr, minEqOp<label>()); + Pstream::mapCombineReduce(regionToCompactAddr, minEqOp<label>()); nRegions_ = regionToCompactAddr.size(); diff --git a/src/meshTools/searchableSurfaces/triSurfaceMesh/triSurfaceMesh.C b/src/meshTools/searchableSurfaces/triSurfaceMesh/triSurfaceMesh.C index af5db52e6f4..1acd5127d0d 100644 --- a/src/meshTools/searchableSurfaces/triSurfaceMesh/triSurfaceMesh.C +++ b/src/meshTools/searchableSurfaces/triSurfaceMesh/triSurfaceMesh.C @@ -462,7 +462,7 @@ Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io, const readAction r) triSurface s2(actualFile); triSurface::transfer(s2); } - Pstream::scatter(triSurface::patches()); + Pstream::broadcast(triSurface::patches()); if (debug) { Pout<< "triSurfaceMesh(const IOobject& io) :" @@ -587,7 +587,7 @@ Foam::triSurfaceMesh::triSurfaceMesh triSurface s2(actualFile, surfType, scaleFactor); triSurface::transfer(s2); } - Pstream::scatter(triSurface::patches()); + Pstream::broadcast(triSurface::patches()); if (debug) { Pout<< "triSurfaceMesh(const IOobject& io) :" diff --git a/src/meshTools/topoSet/cellSources/nearestToCell/nearestToCell.C b/src/meshTools/topoSet/cellSources/nearestToCell/nearestToCell.C index d8560bc8287..5ee762e0390 100644 --- a/src/meshTools/topoSet/cellSources/nearestToCell/nearestToCell.C +++ b/src/meshTools/topoSet/cellSources/nearestToCell/nearestToCell.C @@ -85,7 +85,7 @@ void Foam::nearestToCell::combine(topoSet& set, const bool add) const ); } - Pstream::listCombineAllGather(nearest, mappedPatchBase::nearestEqOp()); + Pstream::listCombineReduce(nearest, mappedPatchBase::nearestEqOp()); for (const auto& near : nearest) { diff --git a/src/meshTools/topoSet/faceSources/regionToFace/regionToFace.C b/src/meshTools/topoSet/faceSources/regionToFace/regionToFace.C index 8bbec46fc45..0df7ba37df2 100644 --- a/src/meshTools/topoSet/faceSources/regionToFace/regionToFace.C +++ b/src/meshTools/topoSet/faceSources/regionToFace/regionToFace.C @@ -176,7 +176,7 @@ void Foam::regionToFace::combine(topoSet& set, const bool add) const } // Globally reduce - Pstream::combineAllGather(ni, mappedPatchBase::nearestEqOp()); + Pstream::combineReduce(ni, mappedPatchBase::nearestEqOp()); if (verbose_) { diff --git a/src/meshTools/topoSet/faceZoneSources/planeToFaceZone/planeToFaceZone.C b/src/meshTools/topoSet/faceZoneSources/planeToFaceZone/planeToFaceZone.C index 45fd131a9d8..c7cdff5f780 100644 --- a/src/meshTools/topoSet/faceZoneSources/planeToFaceZone/planeToFaceZone.C +++ b/src/meshTools/topoSet/faceZoneSources/planeToFaceZone/planeToFaceZone.C @@ -217,7 +217,7 @@ void Foam::planeToFaceZone::combine(faceZoneSet& fzSet, const bool add) const regionRegions[regioni].unset(regioni); } } - Pstream::listCombineAllGather(regionRegions, bitOrEqOp<bitSet>()); + Pstream::listCombineReduce(regionRegions, bitOrEqOp<bitSet>()); // Collapse the region connections into a map between each region // and the lowest numbered region that it connects to @@ -258,7 +258,7 @@ void Foam::planeToFaceZone::combine(faceZoneSet& fzSet, const bool add) const { ++ regionNFaces[regioni]; } - Pstream::listCombineAllGather(regionNFaces, plusEqOp<label>()); + Pstream::listCombineReduce(regionNFaces, plusEqOp<label>()); Info<< " Found " << nRegions << " contiguous regions with " << regionNFaces << " faces" << endl; diff --git a/src/meshTools/topoSet/pointSources/nearestToPoint/nearestToPoint.C b/src/meshTools/topoSet/pointSources/nearestToPoint/nearestToPoint.C index d2deace74a2..b5ec828161a 100644 --- a/src/meshTools/topoSet/pointSources/nearestToPoint/nearestToPoint.C +++ b/src/meshTools/topoSet/pointSources/nearestToPoint/nearestToPoint.C @@ -104,7 +104,7 @@ void Foam::nearestToPoint::combine(topoSet& set, const bool add) const } - Pstream::listCombineAllGather(nearest, mappedPatchBase::nearestEqOp()); + Pstream::listCombineReduce(nearest, mappedPatchBase::nearestEqOp()); for (const auto& near : nearest) { diff --git a/src/optimisation/adjointOptimisation/adjoint/parameterization/NURBS/NURBS3DVolume/NURBS3DVolume/NURBS3DVolume.C b/src/optimisation/adjointOptimisation/adjoint/parameterization/NURBS/NURBS3DVolume/NURBS3DVolume/NURBS3DVolume.C index 7c28e78019e..89839e07b65 100644 --- a/src/optimisation/adjointOptimisation/adjoint/parameterization/NURBS/NURBS3DVolume/NURBS3DVolume/NURBS3DVolume.C +++ b/src/optimisation/adjointOptimisation/adjoint/parameterization/NURBS/NURBS3DVolume/NURBS3DVolume/NURBS3DVolume.C @@ -1010,7 +1010,7 @@ Foam::vectorField Foam::NURBS3DVolume::computeControlPointSensitivities } // Sum contributions from all processors - Pstream::listCombineAllGather(controlPointDerivs, plusEqOp<vector>()); + Pstream::listCombineReduce(controlPointDerivs, plusEqOp<vector>()); return controlPointDerivs; } @@ -1095,7 +1095,7 @@ Foam::vectorField Foam::NURBS3DVolume::computeControlPointSensitivities } } // Sum contributions from all processors - Pstream::listCombineAllGather(controlPointDerivs, plusEqOp<vector>()); + Pstream::listCombineReduce(controlPointDerivs, plusEqOp<vector>()); return controlPointDerivs; } diff --git a/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C b/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C index 7883ca13c40..f57895b9582 100644 --- a/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C +++ b/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C @@ -377,7 +377,7 @@ void Foam::cellCellStencils::cellVolumeWeight::findHoles { // Synchronise region status on processors // (could instead swap status through processor patches) - Pstream::listCombineAllGather(regionType, maxEqOp<label>()); + Pstream::listCombineReduce(regionType, maxEqOp<label>()); // Communicate region status through interpolative cells labelList cellRegionType(labelUIndList(regionType, cellRegion)); @@ -754,7 +754,7 @@ bool Foam::cellCellStencils::cellVolumeWeight::update() { nCellsPerZone[zoneID[cellI]]++; } - Pstream::listCombineAllGather(nCellsPerZone, plusEqOp<label>()); + Pstream::listCombineReduce(nCellsPerZone, plusEqOp<label>()); Info<< typeName << " : detected " << nZones diff --git a/src/overset/cellCellStencil/inverseDistance/inverseDistanceCellCellStencil.C b/src/overset/cellCellStencil/inverseDistance/inverseDistanceCellCellStencil.C index a78a239fbd6..ee52182aacb 100644 --- a/src/overset/cellCellStencil/inverseDistance/inverseDistanceCellCellStencil.C +++ b/src/overset/cellCellStencil/inverseDistance/inverseDistanceCellCellStencil.C @@ -1118,7 +1118,7 @@ void Foam::cellCellStencils::inverseDistance::findHoles { // Synchronise region status on processors // (could instead swap status through processor patches) - Pstream::listCombineAllGather(regionType, maxEqOp<label>()); + Pstream::listCombineReduce(regionType, maxEqOp<label>()); DebugInfo<< FUNCTION_NAME << " : Gathered region type" << endl; @@ -1722,7 +1722,7 @@ bool Foam::cellCellStencils::inverseDistance::update() { nCellsPerZone[zoneID[cellI]]++; } - Pstream::listCombineAllGather(nCellsPerZone, plusEqOp<label>()); + Pstream::listCombineReduce(nCellsPerZone, plusEqOp<label>()); const boundBox& allBb(mesh_.bounds()); diff --git a/src/overset/cellCellStencil/trackingInverseDistance/trackingInverseDistanceCellCellStencil.C b/src/overset/cellCellStencil/trackingInverseDistance/trackingInverseDistanceCellCellStencil.C index 66da7861bf0..9b91a0f5bf9 100644 --- a/src/overset/cellCellStencil/trackingInverseDistance/trackingInverseDistanceCellCellStencil.C +++ b/src/overset/cellCellStencil/trackingInverseDistance/trackingInverseDistanceCellCellStencil.C @@ -517,7 +517,7 @@ Foam::cellCellStencils::trackingInverseDistance::trackingInverseDistance { nCellsPerZone[zoneID[celli]]++; } - Pstream::listCombineAllGather(nCellsPerZone, plusEqOp<label>()); + Pstream::listCombineReduce(nCellsPerZone, plusEqOp<label>()); meshParts_.setSize(nZones); forAll(meshParts_, zonei) diff --git a/src/overset/regionsToCell/findRefCells.C b/src/overset/regionsToCell/findRefCells.C index b949b80ec14..0704f355ba0 100644 --- a/src/overset/regionsToCell/findRefCells.C +++ b/src/overset/regionsToCell/findRefCells.C @@ -68,7 +68,7 @@ void Foam::setRefCells } } - Pstream::listCombineAllGather(regionNeedReference, orEqOp<bool>()); + Pstream::listCombineReduce(regionNeedReference, orEqOp<bool>()); } @@ -188,7 +188,7 @@ void Foam::setRefCells } } - Pstream::listCombineAllGather(hasRef, plusEqOp<label>()); + Pstream::listCombineReduce(hasRef, plusEqOp<label>()); forAll(hasRef, regionI) { diff --git a/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.C b/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.C index 588a233c991..28d7e1dc78a 100644 --- a/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.C +++ b/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.C @@ -480,7 +480,7 @@ void Foam::decompositionMethod::calcCellCells // Create global cell numbers // ~~~~~~~~~~~~~~~~~~~~~~~~~~ - const globalIndex globalAgglom(nLocalCoarse, Pstream::worldComm, parallel); + const globalIndex globalAgglom(nLocalCoarse, UPstream::worldComm, parallel); // Get agglomerate owner on other side of coupled faces @@ -673,7 +673,7 @@ void Foam::decompositionMethod::calcCellCells // Create global cell numbers // ~~~~~~~~~~~~~~~~~~~~~~~~~~ - const globalIndex globalAgglom(nLocalCoarse, Pstream::worldComm, parallel); + const globalIndex globalAgglom(nLocalCoarse, UPstream::worldComm, parallel); // Get agglomerate owner on other side of coupled faces diff --git a/src/parallel/decompose/decompositionMethods/multiLevelDecomp/multiLevelDecomp.C b/src/parallel/decompose/decompositionMethods/multiLevelDecomp/multiLevelDecomp.C index e541e49a7cb..f291df37ffa 100644 --- a/src/parallel/decompose/decompositionMethods/multiLevelDecomp/multiLevelDecomp.C +++ b/src/parallel/decompose/decompositionMethods/multiLevelDecomp/multiLevelDecomp.C @@ -419,11 +419,7 @@ void Foam::multiLevelDecomp::decompose label nPoints = returnReduce(domainPoints.size(), sumOp<label>()); - Pstream::listCombineAllGather - ( - nOutsideConnections, - plusEqOp<label>() - ); + Pstream::listCombineReduce(nOutsideConnections, plusEqOp<label>()); label nPatches = 0; label nFaces = 0; for (const label nConnect : nOutsideConnections) @@ -530,7 +526,7 @@ void Foam::multiLevelDecomp::decompose } reduce(nPoints, sumOp<label>()); - Pstream::listCombineAllGather + Pstream::listCombineReduce ( nOutsideConnections, plusEqOp<label>() diff --git a/src/parallel/reconstruct/faReconstruct/faMeshReconstructor.C b/src/parallel/reconstruct/faReconstruct/faMeshReconstructor.C index 7516828651c..e8b33457852 100644 --- a/src/parallel/reconstruct/faReconstruct/faMeshReconstructor.C +++ b/src/parallel/reconstruct/faReconstruct/faMeshReconstructor.C @@ -101,7 +101,7 @@ void Foam::faMeshReconstructor::calcAddressing ? 0 : singlePatchFaceLabels_.first() ); - Pstream::scatter(patchFirstMeshfacei); + Pstream::broadcast(patchFirstMeshfacei); for (label& facei : faFaceProcAddr_) { @@ -169,7 +169,7 @@ void Foam::faMeshReconstructor::calcAddressing } // Broadcast the same information everywhere - Pstream::scatter(singlePatchFaceLabels_); + Pstream::broadcast(singlePatchFaceLabels_); // ------------------ @@ -283,7 +283,7 @@ void Foam::faMeshReconstructor::calcAddressing mpm[mp[i]] = i; } } - Pstream::scatter(mpm); + Pstream::broadcast(mpm); // Rewrite pointToGlobal according to the correct point order for (label& pointi : pointToGlobal) @@ -299,8 +299,8 @@ void Foam::faMeshReconstructor::calcAddressing } // Broadcast the same information everywhere - Pstream::scatter(singlePatchFaces_); - Pstream::scatter(singlePatchPoints_); + Pstream::broadcast(singlePatchFaces_); + Pstream::broadcast(singlePatchPoints_); // Now have enough global information to determine global edge mappings @@ -383,13 +383,8 @@ void Foam::faMeshReconstructor::calcAddressing // OR patchEdgeLabels = // UIndirectList<label>(faEdgeProcAddr_, fap.edgeLabels()); - - // Collect from all processors - Pstream::combineAllGather - ( - patchEdgeLabels, - ListOps::appendEqOp<label>() - ); + // Combine from all processors + Pstream::combineReduce(patchEdgeLabels, ListOps::appendEqOp<label>()); // Sorted order will be the original non-decomposed order Foam::sort(patchEdgeLabels); diff --git a/src/regionModels/regionModel/singleLayerRegion/singleLayerRegion.C b/src/regionModels/regionModel/singleLayerRegion/singleLayerRegion.C index fb2f8375090..ff95490d56e 100644 --- a/src/regionModels/regionModel/singleLayerRegion/singleLayerRegion.C +++ b/src/regionModels/regionModel/singleLayerRegion/singleLayerRegion.C @@ -142,7 +142,7 @@ void Foam::regionModels::singleLayerRegion::initialise() } } - Pstream::listCombineAllGather(passivePatchIDs_, maxEqOp<label>()); + Pstream::listCombineReduce(passivePatchIDs_, maxEqOp<label>()); magSf.field() = 0.5*(magSf + passiveMagSf); magSf.correctBoundaryConditions(); diff --git a/src/rigidBodyDynamics/rigidBodyMotion/rigidBodyMotion.C b/src/rigidBodyDynamics/rigidBodyMotion/rigidBodyMotion.C index 1430ad67fd1..cc03840da3e 100644 --- a/src/rigidBodyDynamics/rigidBodyMotion/rigidBodyMotion.C +++ b/src/rigidBodyDynamics/rigidBodyMotion/rigidBodyMotion.C @@ -190,7 +190,7 @@ void Foam::RBD::rigidBodyMotion::solve solver_->solve(tau, fx); } - Pstream::scatter(motionState_); + Pstream::broadcast(motionState_); // Update the body-state to correspond to the current joint-state forwardDynamicsCorrection(motionState_); diff --git a/src/sampling/probes/patchProbes.C b/src/sampling/probes/patchProbes.C index 7ea65d3c0fd..08515512e43 100644 --- a/src/sampling/probes/patchProbes.C +++ b/src/sampling/probes/patchProbes.C @@ -166,7 +166,7 @@ void Foam::patchProbes::findElements(const fvMesh& mesh) // Find nearest - globally consistent - Pstream::listCombineAllGather(nearest, mappedPatchBase::nearestEqOp()); + Pstream::listCombineReduce(nearest, mappedPatchBase::nearestEqOp()); oldPoints_.resize(this->size()); diff --git a/src/sampling/probes/patchProbesTemplates.C b/src/sampling/probes/patchProbesTemplates.C index 1666236eb7c..c8c82e5ce00 100644 --- a/src/sampling/probes/patchProbesTemplates.C +++ b/src/sampling/probes/patchProbesTemplates.C @@ -111,7 +111,7 @@ Foam::patchProbes::sample(const VolumeField<Type>& vField) const } } - Pstream::listCombineAllGather(values, isNotEqOp<Type>()); + Pstream::listCombineReduce(values, isNotEqOp<Type>()); return tvalues; } @@ -141,7 +141,7 @@ Foam::patchProbes::sample(const SurfaceField<Type>& sField) const } } - Pstream::listCombineAllGather(values, isNotEqOp<Type>()); + Pstream::listCombineReduce(values, isNotEqOp<Type>()); return tvalues; } diff --git a/src/sampling/probes/probesTemplates.C b/src/sampling/probes/probesTemplates.C index ea5bef4b5e4..72c44fc9146 100644 --- a/src/sampling/probes/probesTemplates.C +++ b/src/sampling/probes/probesTemplates.C @@ -225,7 +225,7 @@ Foam::probes::sample(const VolumeField<Type>& vField) const } } - Pstream::listCombineAllGather(values, isNotEqOp<Type>()); + Pstream::listCombineReduce(values, isNotEqOp<Type>()); return tvalues; } @@ -248,7 +248,7 @@ Foam::probes::sample(const SurfaceField<Type>& sField) const } } - Pstream::listCombineAllGather(values, isNotEqOp<Type>()); + Pstream::listCombineReduce(values, isNotEqOp<Type>()); return tvalues; } diff --git a/src/sampling/sampledSet/cloud/cloudSet.C b/src/sampling/sampledSet/cloud/cloudSet.C index 48f61a1eb8d..42045d473ce 100644 --- a/src/sampling/sampledSet/cloud/cloudSet.C +++ b/src/sampling/sampledSet/cloud/cloudSet.C @@ -84,8 +84,8 @@ void Foam::cloudSet::calcSamples minFoundProc[i] = foundProc[i]; } } - Pstream::listCombineAllGather(minFoundProc, minEqOp<label>()); - Pstream::listCombineAllGather(maxFoundProc, maxEqOp<label>()); + Pstream::listCombineReduce(minFoundProc, minEqOp<label>()); + Pstream::listCombineReduce(maxFoundProc, maxEqOp<label>()); DynamicField<point> missingPoints(sampleCoords_.size()); diff --git a/src/sampling/sampledSet/patchCloud/patchCloudSet.C b/src/sampling/sampledSet/patchCloud/patchCloudSet.C index f97a1848ffe..3b3a9567fc8 100644 --- a/src/sampling/sampledSet/patchCloud/patchCloudSet.C +++ b/src/sampling/sampledSet/patchCloud/patchCloudSet.C @@ -155,7 +155,7 @@ void Foam::patchCloudSet::calcSamples // Find nearest - globally consistent - Pstream::listCombineAllGather(nearest, mappedPatchBase::nearestEqOp()); + Pstream::listCombineReduce(nearest, mappedPatchBase::nearestEqOp()); if (debug && Pstream::master()) diff --git a/src/sampling/sampledSet/patchSeed/patchSeedSet.C b/src/sampling/sampledSet/patchSeed/patchSeedSet.C index 390300e4cd3..b2efaa46ce2 100644 --- a/src/sampling/sampledSet/patchSeed/patchSeedSet.C +++ b/src/sampling/sampledSet/patchSeed/patchSeedSet.C @@ -178,11 +178,7 @@ void Foam::patchSeedSet::calcSamples // 2. Reduce on master. Select nearest processor. // Find nearest - globally consistent - Pstream::listCombineAllGather - ( - nearest, - mappedPatchBase::nearestEqOp() - ); + Pstream::listCombineReduce(nearest, mappedPatchBase::nearestEqOp()); // 3. Pick up my local faces that have won diff --git a/src/sampling/sampledSet/sampledSets/sampledSets.C b/src/sampling/sampledSet/sampledSets/sampledSets.C index 63248a47aeb..cafe0ef3307 100644 --- a/src/sampling/sampledSet/sampledSets/sampledSets.C +++ b/src/sampling/sampledSet/sampledSets/sampledSets.C @@ -196,7 +196,7 @@ Foam::IOobjectList Foam::sampledSets::preCheckFields(unsigned request) // Parallel consistency (no-op in serial) // Probably not needed... - /// Pstream::mapCombineAllGather(selected, HashSetOps::plusEqOp<word>()); + /// Pstream::mapCombineReduce(selected, HashSetOps::plusEqOp<word>()); DynamicList<label> missed(fieldSelection_.size()); diff --git a/src/sampling/sampledSet/shortestPath/shortestPathSet.C b/src/sampling/sampledSet/shortestPath/shortestPathSet.C index 8e09eabfdfd..12fb3059ef6 100644 --- a/src/sampling/sampledSet/shortestPath/shortestPathSet.C +++ b/src/sampling/sampledSet/shortestPath/shortestPathSet.C @@ -264,7 +264,7 @@ void Foam::shortestPathSet::sync celli, Tuple2<point, bool>(origin, findMinDistance) ); - Pstream::combineAllGather + Pstream::combineReduce ( searchData, [](ProcData& x, const ProcData& y) diff --git a/src/sampling/sampledSurface/sampledMeshedSurface/sampledMeshedSurface.C b/src/sampling/sampledSurface/sampledMeshedSurface/sampledMeshedSurface.C index 24b0180a92c..2cb85c8425b 100644 --- a/src/sampling/sampledSurface/sampledMeshedSurface/sampledMeshedSurface.C +++ b/src/sampling/sampledSurface/sampledMeshedSurface/sampledMeshedSurface.C @@ -227,7 +227,7 @@ bool Foam::sampledMeshedSurface::update(const meshSearch& meshSearcher) // See which processor has the nearest. Mark and subset // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Pstream::listCombineAllGather(nearest, minFirstEqOp<scalar>{}); + Pstream::listCombineReduce(nearest, minFirstEqOp<scalar>{}); labelList cellOrFaceLabels(fc.size(), -1); diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C index aaa102c9bb6..d187fb3b76d 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C @@ -119,7 +119,7 @@ Foam::IOobjectList Foam::sampledSurfaces::preCheckFields() } // Parallel consistency (no-op in serial) - Pstream::mapCombineAllGather(selected, HashSetOps::plusEqOp<word>()); + Pstream::mapCombineReduce(selected, HashSetOps::plusEqOp<word>()); DynamicList<label> missed(fieldSelection_.size()); diff --git a/src/sampling/surface/isoSurface/isoSurfacePoint.C b/src/sampling/surface/isoSurface/isoSurfacePoint.C index b4be87d417c..348a2bce344 100644 --- a/src/sampling/surface/isoSurface/isoSurfacePoint.C +++ b/src/sampling/surface/isoSurface/isoSurfacePoint.C @@ -262,7 +262,7 @@ void Foam::isoSurfacePoint::syncUnseparatedPoints } // Globally consistent - Pstream::listCombineAllGather(sharedPts, minEqOp<point>()); + Pstream::listCombineReduce(sharedPts, minEqOp<point>()); // Now we will all have the same information. Merge it back with // my local information. diff --git a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.C b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.C index 6e3d91d315e..8240a1305cb 100644 --- a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.C +++ b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.C @@ -323,7 +323,7 @@ void Foam::sixDoFRigidBodyMotion::update } } - Pstream::scatter(motionState_); + Pstream::broadcast(motionState_); } diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/TDACChemistryModel/TDACChemistryModel.C b/src/thermophysicalModels/chemistryModel/chemistryModel/TDACChemistryModel/TDACChemistryModel.C index 8bfbca15fb5..6d355fbe236 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/TDACChemistryModel/TDACChemistryModel.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/TDACChemistryModel/TDACChemistryModel.C @@ -867,7 +867,7 @@ Foam::scalar Foam::TDACChemistryModel<ReactionThermo, ThermoType>::solve if (reduced && Pstream::parRun()) { List<bool> active(composition.active()); - Pstream::listCombineAllGather(active, orEqOp<bool>()); + Pstream::listCombineReduce(active, orEqOp<bool>()); forAll(active, i) { diff --git a/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceReflecting/faceReflecting.C b/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceReflecting/faceReflecting.C index db623f1d845..2013255abcd 100644 --- a/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceReflecting/faceReflecting.C +++ b/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceReflecting/faceReflecting.C @@ -329,8 +329,8 @@ void Foam::faceReflecting::calculate() // Distribute ray indexes to all proc's // Make sure all the processors have the same information - Pstream::listCombineAllGather(refDisDirsIndex, maxEqOp<label>()); - Pstream::mapCombineAllGather(refFacesDirIndex, minEqOp<label>()); + Pstream::listCombineReduce(refDisDirsIndex, maxEqOp<label>()); + Pstream::mapCombineReduce(refFacesDirIndex, minEqOp<label>()); scalar maxBounding = 5.0*mag(mesh_.bounds().max() - mesh_.bounds().min()); diff --git a/src/thermophysicalModels/radiation/radiationModels/viewFactor/viewFactor.C b/src/thermophysicalModels/radiation/radiationModels/viewFactor/viewFactor.C index 29e9994da5d..4ead682bbba 100644 --- a/src/thermophysicalModels/radiation/radiationModels/viewFactor/viewFactor.C +++ b/src/thermophysicalModels/radiation/radiationModels/viewFactor/viewFactor.C @@ -977,13 +977,9 @@ void Foam::radiation::viewFactor::calculate() qrExt[compactGlobalIds[i]] = compactCoarseHo[i]; } - Pstream::listCombineGather(T4, maxEqOp<scalar>()); - Pstream::listCombineGather(E, maxEqOp<scalar>()); - Pstream::listCombineGather(qrExt, maxEqOp<scalar>()); - - Pstream::listCombineScatter(T4); - Pstream::listCombineScatter(E); - Pstream::listCombineScatter(qrExt); + Pstream::listCombineReduce(T4, maxEqOp<scalar>()); + Pstream::listCombineReduce(E, maxEqOp<scalar>()); + Pstream::listCombineReduce(qrExt, maxEqOp<scalar>()); if (Pstream::master()) { -- GitLab