diff --git a/applications/test/IndirectList/Test-IndirectList.C b/applications/test/IndirectList/Test-IndirectList.C index eb22bf3b3083073940adc3bbec5edf02a2cdca5b..399d43906c7d5e442b56e52909c01211489890fc 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 95df0e5a4218411f5b12f90d8b36d5ccd66a77ac..9163f14e5488981e81d648ae335eabcf22f6b3a0 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 1aa698ba8e0dffc128e5346ca128c810fe28de08..81d62397cd7d5702f84faaa606c64f88c9e961fe 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 c743c1316b8b20831eca5c0dd2b4e1e435bbcaa8..d1f1c851ddf3cbd7e52f5e1d832eee0db79e59ae 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 586b6f0384acf8a660fbc8bc07278507e963cce2..f5b762a7fc01a7e4d70ffaa900fb48e0f1f18d83 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 6c4662d01187ffe0ebb873b486540b1264b3c1ef..635841d6fd4c588f972797858d9a18c3f08f085c 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 a1885891d8623f4d8d5293736ab99ad5063c9264..fc13771c73d6f75615bbfcafc9bdcdf51fd72577 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 20b8d48da90ba665a18a84c0de292f3c507e12c5..e6854ac097ad9af6a3416ff2e7c3b8ffd35ff6cb 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 0fe385e0bd433069d3f117e2c0300392e82f93ef..bc1ccb10c5e286b5faddfa22fd49e2d3fa8a12a2 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 508bdcb2d8dd6ee2231602a4054b4919bf1114f6..28242fdf149ec2a3460fe45458abc5043fc50dcb 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 82af0aa15220cd49e89c04a0f06f74cfe698e48f..da07bf76ce6ec9ad05bae63a558497c576afdcb1 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 f15ad18ce168fb38295a7f8d39d40efa18668da4..0681cd9d772b85a0f60b9a2911fb571cbc6bef7d 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 fd68ceb34ada05569736dc0498869af570ad126d..4b5ceee7b7a2bd2cf440bde503161c0ad6509fc7 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 6abc6c702032e8b12a43979c9e62be6d0639913d..d45307c33e06e670b7cf6500e10a4939b31b9fa7 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 08b7977b27231ea6837dd8ccd36b18b087786938..ef20c1cec0f0bc2fe24ecc7c7c1b8ef015f4094b 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 a04291d961fa386a7cea415e54a0d42729e1428c..68e13363e1de46fb1c110a41a892f498ae81c4ac 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 7afd6abd276c6bd3b66f5fea03f10d9dfc5e37f4..b5fa4d1f19706e66b34520a50c8047e676c52c33 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 30adf8ed22f5537bee500504da14d00ee4145941..f761cbff793c3defbd22f0d6e90bce51fe003ee2 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 94659d14dede5683740a408be3ea8f6cfcf61cce..f4af230525d5e939f7c470757f1a70d97a4c5759 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 d68800a141d3fdc7ba65094dc0a60145524189e8..edd58ceb13e4aa7961eab3aa54d147e1cd71c218 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 d43b0eb7f7de7018c6461d2301bfcaba256115ca..a29b40b69ac6a4e5f0f027483693ac15bf533251 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 61c70dd170e5636dee40bcc4aecbb7d7f24368ca..e0ca2042b6252cec3094ac6cb7bae890e189258b 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 341566fb948c5fd952a160fdb54183e312e20260..c833d486c6b007262f79455b4b2fa4d98f11e795 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 fbf65a4ffda511717308a7be91c85a5aacace00d..3b8552ea5530f910077e62c9c7a79814124f24e4 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 5e66e78be7c2a6f9582d0404bcf4e55ca47cde3c..c6ce91be386f8c4f1847fbaa26af939f3ca79fe6 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 cdfd9e97daea5ae95a6651d657d0a6e169a15c55..ae82fd62462ba53368fa0f904f57fac2cb63a349 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 9111ce62f9b4219255add36e73728c4cffcf9303..00bd0cc54e9b6c9e80865be429a472b1a75885a2 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 4d010e9e0bd852dc7cdb9520e7258fae392249f8..4da68f502860ea81829e36f5654133e3131f8a54 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 bb2fc9cd5f0f2789273a10e43379a63ab5c483ea..2256aa117bd0b7e9b160845284892a6c11ba9bef 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 8627307f8d82dfd27cef609f2dd760ccea99faad..4cd6e6f2e6aed7786efe6fb91c5230aa452376e8 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 30908213a8354255f63fea5905f8c44ba410227d..a92dd574c7c538f941b708e4cf4c82ccfb86822a 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 b2d3e03e955ae80cc8ef061e4ceaa15388f11bac..524ef8746a8c8f31226cc073d0d6847286d3f8e6 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 1a763056d2ee8bd9b248a69883ff1e1388962f4d..b67c2c02bec61dade0250da9a949f334af14f8cb 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 2094b06340936cecef437d092e4826a8ce7a0bfd..73da1f7bdaae4be0e2cba266832bb10b9aa21509 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 de1379170d5b3534cd4849c4d03ca2fdbf0af900..ab4d0ed55d6bc93fed62f5fce4b8d21c8aec8211 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 a0b06807e0fd2b318fc3b0bf31e777185186f900..58b5657bd1ed67bc6161aaa81c98eeacc5414340 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 fd8416cd2a288cd05d0836de347321a1ee0825ce..5751e519c3a01213a9ddb1caf8619107e634d00c 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 1073465ab11777e9bf32bbb5392b722fb9b18ffa..512fbcb8b5f5b40406bf6d74fb2bd1a7623ec04c 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 248b6a9004c730d7d8546bf3f1722903420efbc6..98f4793950811e659902daf9b482b9a5b32506e6 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 0c8e68f8f4d397763eca1b30d129558ab526c4fa..d83324d1b0d02058a3c3e070719e7b0a3b7bdbbf 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 4c36356947d493879e88f2ab0fa0ca22de93a553..b31a781d3a94bb8d454bf294daefecd86d2be5ef 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 308a55300901718f904c1b6e1e33dc98b8ebec00..3dba1abcd66aaf545a42a2ff22d69e476682f1df 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 a03bf0fd93a1a039c858e2d1800da65a6434fec6..813d976130a952e4f41740e4364f4cc0bbf8ee57 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 2ef2efe23e0da53a4bd29b58c8a5b5e6eec35891..206f7025d08ea188c85bbbd27a0f618e8f16fe76 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 50d40abe8ff058ff5885b9f940068b2f62d5c632..ab95a2b48fd9c920f1b52963780f0a31377b8acb 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 0feb198e422f48f8480064d424097d762fcfec49..4b45fb5df17bd3371d7c660617bdfd884a88c247 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 b97268833d4f69faa0531d88a865500fc1768b26..d0ae95a792728ce5893513239b5cd5395e867c2d 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 3292d9e2afda78b00e2066c9625236a0e76384b5..eac6555f3de885a43dee901b1efb881fbc7b7014 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 d29e43631395bc10980c1f6a2faeaf4824d6e292..71a476e83a8307e3db1677993ce50e5adc8f31e7 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 b7d3d5d66055d557323e3dbcf8f72d9a7e8b9992..96f120b79f05b70c38c09c74d82ab464dd45f9c6 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 0917da8c4684361887856840662450f318424b56..c28bc1fe4c7a062b0afb21e07bcdf3c8f33ffd8b 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 c8a8e0d531d90d81d14816d9370457018277ec6b..639072e7d80d682772528b7b25402793445ffdde 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 d352615f70658cf0a8aecdc7e5339fecf2f15ae3..1d82cf271c7c1d226a310141e45b1cd4a517f7bd 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 b68d656a35d7b1c85a4fa9ff27b58b9b92d68226..ebb1ce3cc651160bed2ce89ca0bbb83666f24cd4 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 d144dff1f04da63c1927039ef8121da4eb57b207..3ba33caf6e793fd34dd9810704355a3f80531bf7 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 1538f38735d61d907e608be3b80f4db5fdd6293d..f5252fa98a490c1e5ef47aba0431c2af6e09ede0 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 993fef90f16c13d31dba7df1ddbb2a639b68b016..d9eed0279266512d91f155e2911030aea3a18c4b 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 5f3c92bb17e0eba288ca0cfe0c21bcf5d903d163..d01800976c8d0f10e2e76ae3482830a499473618 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 cade4faea94035b33d806b223d878790c5cb0a52..4993effd6165738520d927d90fed52cb3a0b737d 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 227aefcf5f788611a6ad764804f2942e39299877..d65aa96c979b9aa5e4932913c215b7703e5e02ab 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 5dadeb83e6be4af088ba8224ffb7f27eeae0d165..d033f433eb313963562674602b1aa3bacdba1908 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 1057ea9cd21e9f89b001fc4d39a88cd09e8393dd..9e8b6597e4c99f08c7663b053ff56a523a3bb3e2 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 2f5043d4187f35deb33356f24175b5c9cda75e26..36b5a7d8746c9cb4ee5255d00e7df72f90f5f562 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 4ce6c576bc6c1560aa81ab8323486611767bcbbf..8e2a817dab00797cf900603b00066a6f44089cc1 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 5a5d28929a7c10d06f3269c8e359deae89ff688b..dcfc841ad2b630a74174bd90192a47ec88f3b6bc 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 7e8ed9e18765a6038508af9ce499574929e04764..3122030b02bcbba9816de80b2d87c94bdc221118 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 cefd97b46e6d9e3fa67ef93b1e0f107f16a70d3a..152ab7885343bf42a44c4ee89079832479d9ea0a 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 7fc5cccc86950aeeb39e905c0587eea09abf8530..ff5af5aedfabba766b92c2a6cce0065d620caf2b 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 95c6611f3fb46032501c33de92671b35c82d8307..19a544f3a2d3d4ee3afd4e5e27007f63705c8c8c 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 a1ea79bf9e8bcfcd37751ac57a54dded657b10f2..e4928adc3ba4133b951efe0b077070ef19fe82d0 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 f8d2c438ed99c225117d6a6e5d7a5437e1003483..21efa3169e73e1f76dc50635eeec86251f7331cf 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 5f5a60e0d16c0ff136f92f5f6ff22c95195fc715..220ecb151bd0a5b1e51ced0f37304deccf5366f5 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 d11518a0622b863cab27e7ac0d2dff7903be0255..dc22cde350946b3b1506a8c5975c14b97e67d558 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 af5db52e6f4b28759043a94fd5e16447fbefea0b..1acd5127d0df2860692fbd04f739a7f532a42447 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 d8560bc828793b252a426a20090fd81fb62200aa..5ee762e03909c77b145f307151adc08fb913f127 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 8bbec46fc45c5c26d890a569095c3d3f35932157..0df7ba37df2a3bb7dd8f95db6a92656bad7e53c3 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 45fd131a9d87c82962f23b53247df40ce6ee7cf3..c7cdff5f780793a8185fd900e2d643eca11c4224 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 d2deace74a298eedd4dd873dcbb735d46b4f2097..b5ec828161a6aa6bd7ca9bec7797c488b1088707 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 7c28e78019eeb2e63d9dd530981cdd2a50ba1436..89839e07b65c30bd899e6c69a3f0c15ce5711ef4 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 7883ca13c4034ab3f71cb5eaf849c24bc3549415..f57895b9582ad919a2cfbf89e1cba070e61bb3cf 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 a78a239fbd65e9bf20abac6a9a136ecbc413ba9e..ee52182aacb367e9914f37e428ccce4010804253 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 66da7861bf0af39a0147a2fdb3da13d0cac6c29a..9b91a0f5bf989ef0c54ef00251a605c0a2e99c10 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 b949b80ec14912dcae7a38fa6fae185006921369..0704f355ba093f907750dbb1099314a6bf8f8d7e 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 588a233c991bacb15662e4ccef6443813fdda9fa..28d7e1dc78a0e4f18d339d4a344b29ac12c9fa01 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 e541e49a7cbcc2b40419e88da7088ffbc1099fa3..f291df37ffa0f6b6f90489d47a39d1e4a2327238 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 7516828651c8a9c42842286455c85e479f82997d..e8b33457852cf0566c9c4777085952948d4da5b0 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 fb2f83750902acfa070627d49239fdf97d81a8ad..ff95490d56efa68cef1f6f874ae6f0a6d3930d35 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 1430ad67fd1ff03ff5878f4e51d6c6c300266182..cc03840da3e66f653c676846a7617f52880abc75 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 7ea65d3c0fdb39ba975daa95115c27f9b8f83080..08515512e431e86fdcbfda809c65eb049c604ce6 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 1666236eb7c5364881aabbcdce50be1688cd4cfb..c8c82e5ce00ee5cd1a2c514b82b50b79f9c20720 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 ea5bef4b5e4b882e81ae0254d45f1d4fcc4575f1..72c44fc91468b63b95910a28daac81afeb0926f1 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 48f61a1eb8dcfb035c6b3b127db81a5d435f0534..42045d473ce83c5fbf58c4eea4ab914407c21748 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 f97a1848ffe2ad2aa4dcf2de5484142b72c5bf0d..3b3a9567fc8c49bb508b99b1795b9872bb6c7b76 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 390300e4cd3656694e568108614f07f26b330f56..b2efaa46ce2ef98aaa74886506cac29768fab8e0 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 63248a47aebcb74d40a2804a270846b53047d370..cafe0ef330725eece9a2455df714af20d22e8999 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 8e09eabfdfd4ce9d349e3b937ba6f939e2726f2b..12fb3059ef62f98bdbbdd6660308ee2486b72013 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 24b0180a92cc33ef01937f4c6c8d9e1d7041be15..2cb85c8425ba6347903d7758a188e9080e106cd2 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 aaa102c9bb69452b0da4fdcc9a02c7fdc801e9ed..d187fb3b76d925ca7a94ca1390d65d4fa374f7bc 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 b4be87d417c26cd133137687e5a162ab20d0bbf4..348a2bce3448d876265a537b09d53a459e936e83 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 6e3d91d315e618fb94c8e63971f0fe8f0ba31c5f..8240a1305cb3969fc767acd297ed58512063166f 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 8bfbca15fb523d64e1df0d281f872536d8d7c89a..6d355fbe236d546f3deadf8721ad8db45621e5ec 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 db623f1d845d57bbab3a665cfa5c226623f1fa07..2013255abcdedb8905b4f66049bf7b1672acf6ac 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 29e9994da5da9c8f92953569b2fb269c0a22255d..4ead682bbbad257ea83504e0d7d2d652205a699f 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()) {