ENH: more consistent use of broadcast, combineReduce etc.

- broadcast           : (replaces scatter)
  - combineReduce       == combineGather + broadcast
  - listCombineReduce   == listCombineGather + broadcast
  - mapCombineReduce    == mapCombineGather + broadcast
  - allGatherList       == gatherList + scatterList

  Before settling on a more consistent naming convention,
  some intermediate namings were used in OpenFOAM-v2206:

    - combineReduce       (2206: combineAllGather)
    - listCombineReduce   (2206: listCombineAllGather)
    - mapCombineReduce    (2206: mapCombineAllGather)
This commit is contained in:
Mark Olesen 2022-08-23 15:58:32 +02:00 committed by Andrew Heather
parent b9c15b8585
commit 473e14418a
103 changed files with 248 additions and 307 deletions

View File

@ -182,7 +182,7 @@ int main(int argc, char *argv[])
// MPI barrier // MPI barrier
bool barrier = true; bool barrier = true;
Pstream::scatter(barrier); Pstream::broadcast(barrier);
} }

View File

@ -138,8 +138,8 @@ int main()
maxFirstEqOp<label>()(maxIndexed, item); maxFirstEqOp<label>()(maxIndexed, item);
} }
Pstream::combineAllGather(minIndexed, minFirstEqOp<label>()); Pstream::combineReduce(minIndexed, minFirstEqOp<label>());
Pstream::combineAllGather(maxIndexed, maxFirstEqOp<label>()); Pstream::combineReduce(maxIndexed, maxFirstEqOp<label>());
Info<< "Min indexed: " << minIndexed << nl Info<< "Min indexed: " << minIndexed << nl
<< "Max indexed: " << maxIndexed << nl; << "Max indexed: " << maxIndexed << nl;
@ -156,8 +156,8 @@ int main()
maxIndexed = maxFirstOp<label>()(maxIndexed, item); maxIndexed = maxFirstOp<label>()(maxIndexed, item);
} }
Pstream::combineAllGather(minIndexed, minFirstEqOp<label>()); Pstream::combineReduce(minIndexed, minFirstEqOp<label>());
Pstream::combineAllGather(maxIndexed, maxFirstEqOp<label>()); Pstream::combineReduce(maxIndexed, maxFirstEqOp<label>());
Info<< "Min indexed: " << minIndexed << nl Info<< "Min indexed: " << minIndexed << nl
<< "Max indexed: " << maxIndexed << nl; << "Max indexed: " << maxIndexed << nl;

View File

@ -60,7 +60,7 @@ int main(int argc, char *argv[])
Info<< "Reading " << file << nl << endl; Info<< "Reading " << file << nl << endl;
decomposedBlockData data decomposedBlockData data
( (
Pstream::worldComm, UPstream::worldComm,
IOobject IOobject
( (
file, file,

View File

@ -204,7 +204,7 @@ int main(int argc, char *argv[])
labelPair inOut; labelPair inOut;
pointField allCcs(globalNumbering.gather(mesh.cellCentres())); pointField allCcs(globalNumbering.gather(mesh.cellCentres()));
inOut[0] = allCcs.size(); inOut[0] = allCcs.size();
Pstream::scatter(allCcs); Pstream::broadcast(allCcs);
inOut[1] = allCcs.size(); inOut[1] = allCcs.size();
Pout<< " " << inOut << endl; Pout<< " " << inOut << endl;

View File

@ -234,11 +234,7 @@ int main(int argc, char *argv[])
Pout<< "hashed: " << hashed << nl; Pout<< "hashed: " << hashed << nl;
Pstream::mapCombineGather Pstream::mapCombineReduce(hashed, plusEqOp<scalarMinMax>());
(
hashed,
plusEqOp<scalarMinMax>()
);
Info<< "reduced: " << hashed << nl; Info<< "reduced: " << hashed << nl;

View File

@ -167,7 +167,7 @@ int main(int argc, char *argv[])
( (
localValue, localValue,
sumOp<scalar>(), sumOp<scalar>(),
Pstream::msgType(), UPstream::msgType(),
comm comm
); );
Pout<< "sum :" << sum << endl; Pout<< "sum :" << sum << endl;

View File

@ -125,13 +125,13 @@ int main(int argc, char *argv[])
scalar data1 = 1.0; scalar data1 = 1.0;
label request1 = -1; label request1 = -1;
{ {
Foam::reduce(data1, sumOp<scalar>(), Pstream::msgType(), request1); Foam::reduce(data1, sumOp<scalar>(), UPstream::msgType(), request1);
} }
scalar data2 = 0.1; scalar data2 = 0.1;
label request2 = -1; label request2 = -1;
{ {
Foam::reduce(data2, sumOp<scalar>(), Pstream::msgType(), request2); Foam::reduce(data2, sumOp<scalar>(), UPstream::msgType(), request2);
} }

View File

@ -661,8 +661,8 @@ void countExtrudePatches
} }
// Synchronise decision. Actual numbers are not important, just make // Synchronise decision. Actual numbers are not important, just make
// sure that they're > 0 on all processors. // sure that they're > 0 on all processors.
Pstream::listCombineAllGather(zoneSidePatch, plusEqOp<label>()); Pstream::listCombineReduce(zoneSidePatch, plusEqOp<label>());
Pstream::listCombineAllGather(zoneZonePatch, 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()); 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 // Check zone either all internal or all external faces
checkZoneInside(mesh, zoneNames, zoneID, extrudeMeshFaces, isInternal); checkZoneInside(mesh, zoneNames, zoneID, extrudeMeshFaces, isInternal);
@ -2309,7 +2309,7 @@ int main(int argc, char *argv[])
} }
// Reduce // Reduce
Pstream::mapCombineAllGather(globalSum, plusEqOp<point>()); Pstream::mapCombineReduce(globalSum, plusEqOp<point>());
forAll(localToGlobalRegion, localRegionI) forAll(localToGlobalRegion, localRegionI)
{ {

View File

@ -729,7 +729,7 @@ Foam::label Foam::conformalVoronoiMesh::synchroniseSurfaceTrees
} }
} }
Pstream::listCombineAllGather(hits, plusEqOp<labelHashSet>()); Pstream::listCombineReduce(hits, plusEqOp<labelHashSet>());
forAll(surfaceHits, eI) 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) forAll(featureEdgeHits, eI)
{ {

View File

@ -416,10 +416,12 @@ void extractSurface
// Allocate zone/patch for all patches // Allocate zone/patch for all patches
HashTable<label> compactZoneID(1024); HashTable<label> compactZoneID(1024);
forAllConstIters(patchSize, iter) if (Pstream::master())
{ {
label sz = compactZoneID.size(); forAllConstIters(patchSize, iter)
compactZoneID.insert(iter.key(), sz); {
compactZoneID.insert(iter.key(), compactZoneID.size());
}
} }
Pstream::broadcast(compactZoneID); Pstream::broadcast(compactZoneID);
@ -431,7 +433,7 @@ void extractSurface
label patchi = bMesh.findPatchID(iter.key()); label patchi = bMesh.findPatchID(iter.key());
if (patchi != -1) if (patchi != -1)
{ {
patchToCompactZone[patchi] = iter(); patchToCompactZone[patchi] = iter.val();
} }
} }

View File

@ -588,11 +588,7 @@ Foam::label Foam::checkTopology
} }
} }
Pstream::listCombineAllGather Pstream::listCombineReduce(regionDisconnected, andEqOp<bool>());
(
regionDisconnected,
andEqOp<bool>()
);
} }

View File

@ -714,7 +714,7 @@ void syncPoints
} }
// Combine - globally consistent // Combine - globally consistent
Pstream::listCombineAllGather(sharedPts, cop); Pstream::listCombineReduce(sharedPts, cop);
// Now we will all have the same information. Merge it back with // Now we will all have the same information. Merge it back with
// my local information. // my local information.

View File

@ -1114,7 +1114,7 @@ label findCorrespondingRegion
} }
} }
Pstream::listCombineAllGather(cellsInZone, plusEqOp<label>()); Pstream::listCombineReduce(cellsInZone, plusEqOp<label>());
// Pick region with largest overlap of zoneI // Pick region with largest overlap of zoneI
label regionI = findMax(cellsInZone); label regionI = findMax(cellsInZone);

View File

@ -223,7 +223,7 @@ bool writeOptionalMeshObject
// Make sure all know if there is a valid class name // Make sure all know if there is a valid class name
wordList classNames(1, io.headerClassName()); wordList classNames(1, io.headerClassName());
Pstream::combineAllGather(classNames, uniqueEqOp<word>()); Pstream::combineReduce(classNames, uniqueEqOp<word>());
// Check for correct type // Check for correct type
if (classNames[0] == T::typeName) 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()) 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) forAll(cloudDirs, i)
{ {
@ -492,7 +492,7 @@ int main(int argc, char *argv[])
); );
// Combine with all other cloud objects // Combine with all other cloud objects
Pstream::combineAllGather(cloudFields, uniqueEqOp<word>()); Pstream::combineReduce(cloudFields, uniqueEqOp<word>());
for (const word& name : cloudFields) for (const word& name : cloudFields)
{ {

View File

@ -89,10 +89,11 @@ void Foam::parLagrangianDistributor::findClouds
} }
// Synchronise cloud names // Synchronise cloud names
Pstream::combineGather(cloudNames, ListOps::uniqueEqOp<word>()); Pstream::combineReduce(cloudNames, ListOps::uniqueEqOp<word>());
Pstream::broadcast(cloudNames); Foam::sort(cloudNames); // Consistent order
objectNames.setSize(cloudNames.size()); objectNames.clear();
objectNames.resize(cloudNames.size());
for (const fileName& localCloudName : localCloudDirs) for (const fileName& localCloudName : localCloudDirs)
{ {
@ -124,11 +125,11 @@ void Foam::parLagrangianDistributor::findClouds
} }
} }
// Synchronise objectNames // Synchronise objectNames (per cloud)
forAll(objectNames, i) for (wordList& objNames : objectNames)
{ {
Pstream::combineGather(objectNames[i], ListOps::uniqueEqOp<word>()); Pstream::combineReduce(objNames, ListOps::uniqueEqOp<word>());
Pstream::broadcast(objectNames[i]); Foam::sort(objNames); // Consistent order
} }
} }
@ -291,7 +292,7 @@ Foam::parLagrangianDistributor::distributeLagrangianPositions
nsTransPs[sendProcI] = subMap[sendProcI].size(); nsTransPs[sendProcI] = subMap[sendProcI].size();
} }
// Send sizes across. Note: blocks. // Send sizes across. Note: blocks.
Pstream::combineAllGather(sizes, Pstream::listEq()); Pstream::combineReduce(sizes, Pstream::listEq());
labelListList constructMap(Pstream::nProcs()); labelListList constructMap(Pstream::nProcs());
label constructSize = 0; label constructSize = 0;

View File

@ -51,14 +51,9 @@ Foam::wordList Foam::parLagrangianDistributor::filterObjects
: objects.names<Container>(selectedFields) : objects.names<Container>(selectedFields)
); );
// Parallel synchronise // Parallel synchronise - combine names from all processors
// - Combine names from all processors Pstream::combineReduce(fieldNames, ListOps::uniqueEqOp<word>());
Foam::sort(fieldNames); // Consistent order
Pstream::combineGather(fieldNames, ListOps::uniqueEqOp<word>());
Pstream::broadcast(fieldNames);
// Sort for consistent order on all processors
Foam::sort(fieldNames);
return fieldNames; return fieldNames;
} }

View File

@ -132,7 +132,7 @@ void createTimeDirs(const fileName& path)
//Pstream::parRun(oldParRun); // Restore parallel state //Pstream::parRun(oldParRun); // Restore parallel state
masterTimeDirs = localTimeDirs; masterTimeDirs = localTimeDirs;
} }
Pstream::scatter(masterTimeDirs); Pstream::broadcast(masterTimeDirs);
//DebugVar(masterTimeDirs); //DebugVar(masterTimeDirs);
//DebugVar(localTimeDirs); //DebugVar(localTimeDirs);
@ -1168,7 +1168,7 @@ int main(int argc, char *argv[])
bool nfs = true; bool nfs = true;
{ {
List<fileName> roots(1, args.rootPath()); List<fileName> roots(1, args.rootPath());
Pstream::combineAllGather(roots, ListOps::uniqueEqOp<fileName>()); Pstream::combineReduce(roots, ListOps::uniqueEqOp<fileName>());
nfs = (roots.size() == 1); 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 // 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 // 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 // use the times list from the master processor
// and select a subset based on the command-line options // and select a subset based on the command-line options
instantList timeDirs = timeSelector::select(runTime.times(), args); instantList timeDirs = timeSelector::select(runTime.times(), args);
Pstream::scatter(timeDirs); Pstream::broadcast(timeDirs);
if (timeDirs.empty()) if (timeDirs.empty())
{ {
@ -2067,7 +2067,7 @@ int main(int argc, char *argv[])
args args
)[0].value(); )[0].value();
} }
Pstream::scatter(masterTime); Pstream::broadcast(masterTime);
Info<< "Setting time to that of master or undecomposed case : " Info<< "Setting time to that of master or undecomposed case : "
<< masterTime << endl; << masterTime << endl;
runTime.setTime(masterTime, 0); runTime.setTime(masterTime, 0);

View File

@ -101,7 +101,7 @@ if (timeDirs.size() && doLagrangian)
{ {
for (auto& cloudFields : regionCloudFields) for (auto& cloudFields : regionCloudFields)
{ {
Pstream::mapCombineAllGather Pstream::mapCombineReduce
( (
cloudFields, cloudFields,
HashTableOps::plusEqOp<word>() HashTableOps::plusEqOp<word>()

View File

@ -46,11 +46,9 @@ if (doLagrangian)
if (Pstream::parRun()) if (Pstream::parRun())
{ {
// Synchronise cloud names // Synchronise cloud names
Pstream::combineGather(cloudNames, ListOps::uniqueEqOp<word>()); Pstream::combineReduce(cloudNames, ListOps::uniqueEqOp<word>());
Pstream::broadcast(cloudNames);
} }
// Consistent order Foam::sort(cloudNames); // Consistent order
Foam::sort(cloudNames);
for (const word& cloudName : cloudNames) for (const word& cloudName : cloudNames)
{ {

View File

@ -186,7 +186,7 @@ int main(int argc, char *argv[])
const label maxNProcs = returnReduce(maxIds.size(), maxOp<label>()); const label maxNProcs = returnReduce(maxIds.size(), maxOp<label>());
maxIds.resize(maxNProcs, -1); maxIds.resize(maxNProcs, -1);
Pstream::listCombineAllGather(maxIds, maxEqOp<label>()); Pstream::listCombineReduce(maxIds, maxEqOp<label>());
// From ids to count // From ids to count
const labelList numIds = maxIds + 1; const labelList numIds = maxIds + 1;

View File

@ -77,8 +77,7 @@ Foam::label Foam::particleTracksSampler::setTrackFields
if (Pstream::parRun()) if (Pstream::parRun())
{ {
Pstream::combineGather(fieldNames, ListOps::uniqueEqOp<word>()); Pstream::combineReduce(fieldNames, ListOps::uniqueEqOp<word>());
Pstream::broadcast(fieldNames);
} }
for (const word& fieldName : fieldNames) for (const word& fieldName : fieldNames)

View File

@ -40,7 +40,7 @@ Foam::Field<T> Foam::channelIndex::regionSum(const Field<T>& cellField) const
} }
// Global sum // Global sum
Pstream::listCombineAllGather(regionField, plusEqOp<T>()); Pstream::listCombineReduce(regionField, plusEqOp<T>());
return regionField; return regionField;
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2021 OpenCFD Ltd. Copyright (C) 2017-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -302,17 +302,19 @@ int main(int argc, char *argv[])
Pstream::mapCombineGather(patchSize, plusEqOp<label>()); Pstream::mapCombineGather(patchSize, plusEqOp<label>());
Pstream::mapCombineGather(zoneSize, plusEqOp<label>()); Pstream::mapCombineGather(zoneSize, plusEqOp<label>());
// Allocate compact numbering for all patches/faceZones if (Pstream::master())
forAllConstIters(patchSize, iter)
{ {
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) forAllConstIters(zoneSize, iter)
{ {
compactZoneID.insert(iter.key(), compactZoneID.size()); compactZoneID.insert(iter.key(), compactZoneID.size());
}
} }
Pstream::broadcast(compactZoneID); Pstream::broadcast(compactZoneID);
@ -391,13 +393,9 @@ int main(int argc, char *argv[])
// Gather all faces // Gather all faces
List<faceList> gatheredFaces(Pstream::nProcs()); List<faceList> gatheredFaces(Pstream::nProcs());
gatheredFaces[Pstream::myProcNo()] = allBoundary.localFaces(); gatheredFaces[Pstream::myProcNo()] = allBoundary.localFaces();
forAll(gatheredFaces[Pstream::myProcNo()], i) for (face& f : gatheredFaces[Pstream::myProcNo()])
{ {
inplaceRenumber inplaceRenumber(pointToGlobal, f);
(
pointToGlobal,
gatheredFaces[Pstream::myProcNo()][i]
);
} }
Pstream::gatherList(gatheredFaces); Pstream::gatherList(gatheredFaces);

View File

@ -252,7 +252,7 @@ int main(int argc, char *argv[])
dict.add("bounds", bbs); dict.add("bounds", bbs);
// Scatter patch information // Scatter patch information
Pstream::scatter(s.patches()); Pstream::broadcast(s.patches());
// Construct distributedTrisurfaceMesh from components // Construct distributedTrisurfaceMesh from components
IOobject notReadIO(io); IOobject notReadIO(io);

View File

@ -202,7 +202,7 @@ void Foam::ParSortableList<Type>::sort()
getPivots(sortedPivots, pivots); getPivots(sortedPivots, pivots);
} }
Pstream::scatter(pivots); Pstream::broadcast(pivots);
if (debug) if (debug)
{ {

View File

@ -90,12 +90,10 @@ void Foam::IOobjectList::syncNames(wordList& objNames)
if (Pstream::parRun()) if (Pstream::parRun())
{ {
// Synchronize names // Synchronize names
Pstream::combineGather(objNames, ListOps::uniqueEqOp<word>()); Pstream::combineReduce(objNames, ListOps::uniqueEqOp<word>());
Pstream::broadcast(objNames);
} }
// Consistent order on all processors Foam::sort(objNames); // Consistent order
Foam::sort(objNames);
} }

View File

@ -579,7 +579,7 @@ template<class Type> \
ReturnType gFunc(const UList<Type>& f, const label comm) \ ReturnType gFunc(const UList<Type>& f, const label comm) \
{ \ { \
ReturnType res = Func(f); \ ReturnType res = Func(f); \
reduce(res, rFunc##Op<ReturnType>(), Pstream::msgType(), comm); \ reduce(res, rFunc##Op<ReturnType>(), UPstream::msgType(), comm); \
return res; \ return res; \
} \ } \
TMP_UNARY_FUNCTION(ReturnType, gFunc) TMP_UNARY_FUNCTION(ReturnType, gFunc)
@ -611,7 +611,7 @@ typename scalarProduct<Type, Type>::type gSumProd
typedef typename scalarProduct<Type, Type>::type prodType; typedef typename scalarProduct<Type, Type>::type prodType;
prodType result = sumProd(f1, f2); prodType result = sumProd(f1, f2);
reduce(result, sumOp<prodType>(), Pstream::msgType(), comm); reduce(result, sumOp<prodType>(), UPstream::msgType(), comm);
return result; return result;
} }
@ -624,7 +624,7 @@ Type gSumCmptProd
) )
{ {
Type SumProd = sumCmptProd(f1, f2); Type SumProd = sumCmptProd(f1, f2);
reduce(SumProd, sumOp<Type>(), Pstream::msgType(), comm); reduce(SumProd, sumOp<Type>(), UPstream::msgType(), comm);
return SumProd; return SumProd;
} }
@ -637,7 +637,7 @@ Type gAverage
{ {
label n = f.size(); label n = f.size();
Type s = sum(f); Type s = sum(f);
sumReduce(s, n, Pstream::msgType(), comm); sumReduce(s, n, UPstream::msgType(), comm);
if (n > 0) if (n > 0)
{ {

View File

@ -172,7 +172,7 @@ Foam::Tuple2<T1,T2> Foam::FieldOps::findMinData
result.second() = data[i]; result.second() = data[i];
} }
Pstream::combineAllGather(result, minFirstEqOp<T1>()); Pstream::combineReduce(result, minFirstEqOp<T1>());
return result; return result;
} }
@ -193,7 +193,7 @@ Foam::Tuple2<T1,T2> Foam::FieldOps::findMaxData
result.second() = data[i]; result.second() = data[i];
} }
Pstream::combineAllGather(result, maxFirstEqOp<T1>()); Pstream::combineReduce(result, maxFirstEqOp<T1>());
return result; return result;
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -196,7 +196,7 @@ Foam::procFacesGAMGProcAgglomeration::processorAgglomeration
fineToCoarse = labelUIndList(oldToNew, fineToCoarse)(); fineToCoarse = labelUIndList(oldToNew, fineToCoarse)();
} }
Pstream::scatter(fineToCoarse, Pstream::msgType(), mesh.comm()); Pstream::broadcast(fineToCoarse, mesh.comm());
UPstream::freeCommunicator(singleCellMeshComm); UPstream::freeCommunicator(singleCellMeshComm);
return tfineToCoarse; return tfineToCoarse;

View File

@ -1934,7 +1934,7 @@ Foam::pointField Foam::globalMeshData::geometricSharedPoints() const
pointField sharedPoints(mesh_.points(), sharedPointLabels()); pointField sharedPoints(mesh_.points(), sharedPointLabels());
// Append from all processors, globally consistent // Append from all processors, globally consistent
Pstream::combineAllGather(sharedPoints, ListOps::appendEqOp<point>()); Pstream::combineReduce(sharedPoints, ListOps::appendEqOp<point>());
// Merge tolerance // Merge tolerance
scalar tolDim = matchTol_ * mesh_.bounds().mag(); scalar tolDim = matchTol_ * mesh_.bounds().mag();
@ -2730,7 +2730,7 @@ void Foam::globalMeshData::updateMesh()
( (
mesh_.nFaces(), mesh_.nFaces(),
sumOp<label>(), sumOp<label>(),
Pstream::msgType(), UPstream::msgType(),
comm comm
); );
@ -2743,7 +2743,7 @@ void Foam::globalMeshData::updateMesh()
( (
mesh_.nCells(), mesh_.nCells(),
sumOp<label>(), sumOp<label>(),
Pstream::msgType(), UPstream::msgType(),
comm comm
); );
@ -2756,7 +2756,7 @@ void Foam::globalMeshData::updateMesh()
( (
mesh_.nPoints(), mesh_.nPoints(),
sumOp<label>(), sumOp<label>(),
Pstream::msgType(), UPstream::msgType(),
comm comm
); );

View File

@ -412,7 +412,7 @@ public:
const globalIndex&, const globalIndex&,
labelList& elements, labelList& elements,
List<Map<label>>& compactMap, List<Map<label>>& compactMap,
const int tag = Pstream::msgType(), const int tag = UPstream::msgType(),
const label comm = UPstream::worldComm const label comm = UPstream::worldComm
); );
@ -426,7 +426,7 @@ public:
const globalIndex&, const globalIndex&,
labelListList& cellCells, labelListList& cellCells,
List<Map<label>>& compactMap, List<Map<label>>& compactMap,
const int tag = Pstream::msgType(), const int tag = UPstream::msgType(),
const label comm = UPstream::worldComm const label comm = UPstream::worldComm
); );

View File

@ -322,7 +322,7 @@ void Foam::syncTools::syncPointMap
} }
// Broadcast: send merged values to all // Broadcast: send merged values to all
Pstream::scatter(sharedPointValues); Pstream::broadcast(sharedPointValues);
} }
// Merge sharedPointValues (keyed on sharedPointAddr) into // Merge sharedPointValues (keyed on sharedPointAddr) into
@ -667,7 +667,7 @@ void Foam::syncTools::syncEdgeMap
} }
// Broadcast: send merged values to all // Broadcast: send merged values to all
Pstream::scatter(sharedEdgeValues); Pstream::broadcast(sharedEdgeValues);
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -269,7 +269,7 @@ void Foam::globalIndexAndTransform::determineTransforms()
} }
transforms_.transfer(localTransforms); transforms_.transfer(localTransforms);
Pstream::scatter(transforms_); Pstream::broadcast(transforms_);
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd. Copyright (C) 2017-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -143,14 +143,14 @@ Foam::label Foam::Random::position(const label& start, const label& end)
template<> template<>
Foam::scalar Foam::Random::globalSample01() Foam::scalar Foam::Random::globalSample01()
{ {
scalar value(-GREAT); scalar value(0);
if (Pstream::master()) if (Pstream::master())
{ {
value = scalar01(); value = scalar01();
} }
Pstream::scatter(value); Pstream::broadcast(value);
return value; return value;
} }
@ -159,14 +159,14 @@ Foam::scalar Foam::Random::globalSample01()
template<> template<>
Foam::label Foam::Random::globalSample01() Foam::label Foam::Random::globalSample01()
{ {
label value(labelMin); label value(0);
if (Pstream::master()) if (Pstream::master())
{ {
value = round(scalar01()); value = round(scalar01());
} }
Pstream::scatter(value); Pstream::broadcast(value);
return value; return value;
} }
@ -175,14 +175,14 @@ Foam::label Foam::Random::globalSample01()
template<> template<>
Foam::scalar Foam::Random::globalGaussNormal() Foam::scalar Foam::Random::globalGaussNormal()
{ {
scalar value(-GREAT); scalar value(0);
if (Pstream::master()) if (Pstream::master())
{ {
value = GaussNormal<scalar>(); value = GaussNormal<scalar>();
} }
Pstream::scatter(value); Pstream::broadcast(value);
return value; return value;
} }
@ -191,14 +191,14 @@ Foam::scalar Foam::Random::globalGaussNormal()
template<> template<>
Foam::label Foam::Random::globalGaussNormal() Foam::label Foam::Random::globalGaussNormal()
{ {
label value(labelMin); label value(0);
if (Pstream::master()) if (Pstream::master())
{ {
value = GaussNormal<label>(); value = GaussNormal<label>();
} }
Pstream::scatter(value); Pstream::broadcast(value);
return value; return value;
} }
@ -211,14 +211,14 @@ Foam::scalar Foam::Random::globalPosition
const scalar& end const scalar& end
) )
{ {
scalar value(-GREAT); scalar value(0);
if (Pstream::master()) if (Pstream::master())
{ {
value = position<scalar>(start, end); value = position<scalar>(start, end);
} }
Pstream::scatter(value); Pstream::broadcast(value);
return value; return value;
} }
@ -231,14 +231,14 @@ Foam::label Foam::Random::globalPosition
const label& end const label& end
) )
{ {
label value(labelMin); label value(0);
if (Pstream::master()) if (Pstream::master())
{ {
value = position<label>(start, end); value = position<label>(start, end);
} }
Pstream::scatter(value); Pstream::broadcast(value);
return value; return value;
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd. Copyright (C) 2018-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -92,14 +92,14 @@ void Foam::Random::shuffle(UList<Type>& values)
template<class Type> template<class Type>
Type Foam::Random::globalSample01() Type Foam::Random::globalSample01()
{ {
Type value = -GREAT*pTraits<Type>::one; Type value(Zero);
if (Pstream::master()) if (Pstream::master())
{ {
value = sample01<Type>(); value = sample01<Type>();
} }
Pstream::scatter(value); Pstream::broadcast(value);
return value; return value;
} }
@ -108,14 +108,14 @@ Type Foam::Random::globalSample01()
template<class Type> template<class Type>
Type Foam::Random::globalGaussNormal() Type Foam::Random::globalGaussNormal()
{ {
Type value = -GREAT*pTraits<Type>::one; Type value(Zero);
if (Pstream::master()) if (Pstream::master())
{ {
value = GaussNormal<Type>(); value = GaussNormal<Type>();
} }
Pstream::scatter(value); Pstream::broadcast(value);
return value; return value;
} }
@ -124,14 +124,14 @@ Type Foam::Random::globalGaussNormal()
template<class Type> template<class Type>
Type Foam::Random::globalPosition(const Type& start, const Type& end) Type Foam::Random::globalPosition(const Type& start, const Type& end)
{ {
Type value = -GREAT*pTraits<Type>::one; Type value(Zero);
if (Pstream::master()) if (Pstream::master())
{ {
value = position<Type>(start, end); value = position<Type>(start, end);
} }
Pstream::scatter(value); Pstream::broadcast(value);
return value; return value;
} }
@ -140,14 +140,12 @@ Type Foam::Random::globalPosition(const Type& start, const Type& end)
template<class Type> template<class Type>
void Foam::Random::globalRandomise01(Type& value) void Foam::Random::globalRandomise01(Type& value)
{ {
value = -GREAT*pTraits<Type>::one;
if (Pstream::master()) if (Pstream::master())
{ {
value = sample01<Type>(); value = sample01<Type>();
} }
Pstream::scatter(value); Pstream::broadcast(value);
} }

View File

@ -228,7 +228,7 @@ void Foam::extrudePatchMesh::extrudeMesh(polyPatchList& regionPatches)
} }
// Reduce // Reduce
Pstream::mapCombineAllGather(globalSum, plusEqOp<point>()); Pstream::mapCombineReduce(globalSum, plusEqOp<point>());
forAll(localToGlobalRegion, localRegionI) forAll(localToGlobalRegion, localRegionI)
{ {

View File

@ -216,7 +216,7 @@ Foam::wordList Foam::fvMeshDistribute::mergeWordList(const wordList& procNames)
} }
} }
} }
Pstream::scatter(mergedNames); Pstream::broadcast(mergedNames);
return mergedNames; return mergedNames;
} }

View File

@ -436,7 +436,7 @@ Foam::scalar Foam::hexRef8::getLevel0EdgeLength() const
// Get the minimum per level over all processors. Note minimum so if // Get the minimum per level over all processors. Note minimum so if
// cells are not cubic we use the smallest edge side. // cells are not cubic we use the smallest edge side.
Pstream::listCombineAllGather(typEdgeLenSqr, minEqOp<scalar>()); Pstream::listCombineReduce(typEdgeLenSqr, minEqOp<scalar>());
if (debug) if (debug)
{ {
@ -470,7 +470,7 @@ Foam::scalar Foam::hexRef8::getLevel0EdgeLength() const
} }
} }
Pstream::listCombineAllGather(maxEdgeLenSqr, maxEqOp<scalar>()); Pstream::listCombineReduce(maxEdgeLenSqr, maxEqOp<scalar>());
if (debug) if (debug)
{ {

View File

@ -263,7 +263,7 @@ public:
virtual bool open virtual bool open
( (
const fileName& file, const fileName& file,
bool parallel = Pstream::parRun() bool parallel = UPstream::parRun()
); );
//- End the file contents and close the file after writing. //- End the file contents and close the file after writing.

View File

@ -118,7 +118,7 @@ void Foam::faGlobalMeshData::updateMesh()
sharedPointLabels_ = sharedPointLabels.toc(); sharedPointLabels_ = sharedPointLabels.toc();
Pstream::combineAllGather(globalList, plusEqOp<labelField>()); Pstream::combineReduce(globalList, plusEqOp<labelField>());
nGlobalPoints_ = 0; nGlobalPoints_ = 0;
for (label i=0; i<globalList.size(); ++i) for (label i=0; i<globalList.size(); ++i)

View File

@ -164,7 +164,7 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::initialisePatch()
sumTriMagSf_ = Zero; sumTriMagSf_ = Zero;
sumTriMagSf_[Pstream::myProcNo() + 1] = sum(triMagSf); sumTriMagSf_[Pstream::myProcNo() + 1] = sum(triMagSf);
Pstream::listCombineAllGather(sumTriMagSf_, maxEqOp<scalar>()); Pstream::listCombineReduce(sumTriMagSf_, maxEqOp<scalar>());
for (label i = 1; i < triMagSf.size(); ++i) for (label i = 1; i < triMagSf.size(); ++i)
{ {

View File

@ -1042,7 +1042,7 @@ void Foam::fvMeshSubset::reset
// Get patch sizes (up to nextPatchID). // Get patch sizes (up to nextPatchID).
// Note that up to nextPatchID the globalPatchMap is an identity so // Note that up to nextPatchID the globalPatchMap is an identity so
// no need to index through that. // no need to index through that.
Pstream::listCombineAllGather(globalPatchSizes, plusEqOp<label>()); Pstream::listCombineReduce(globalPatchSizes, plusEqOp<label>());
// Now all processors have all the patchnames. // Now all processors have all the patchnames.
// Decide: if all processors have the same patch names and size is zero // Decide: if all processors have the same patch names and size is zero

View File

@ -223,7 +223,7 @@ bool Foam::functionObjects::Curle::execute()
pDash /= 4*mathematical::pi; pDash /= 4*mathematical::pi;
Pstream::listCombineAllGather(pDash, plusEqOp<scalar>()); Pstream::listCombineReduce(pDash, plusEqOp<scalar>());
if (surfaceWriterPtr_) if (surfaceWriterPtr_)
{ {

View File

@ -188,8 +188,8 @@ void Foam::DMDModels::STDMD::compress()
q.subColumn(i) = EVecs.subColumn(permutation[i]); q.subColumn(i) = EVecs.subColumn(permutation[i]);
} }
} }
Pstream::scatter(G_); Pstream::broadcast(G_);
Pstream::scatter(q); Pstream::broadcast(q);
// Update "Q" // Update "Q"
Q_ = Q_*q; Q_ = Q_*q;
@ -357,8 +357,8 @@ reducedKoopmanOperator()
A1 = RxInv_*RMatrix(MatrixTools::pinv(Rx*(G_^Rx))); A1 = RxInv_*RMatrix(MatrixTools::pinv(Rx*(G_^Rx)));
Rx.clear(); Rx.clear();
} }
Pstream::scatter(RxInv_); Pstream::broadcast(RxInv_);
Pstream::scatter(A1); Pstream::broadcast(A1);
Info<< tab << "Computing A2" << endl; Info<< tab << "Computing A2" << endl;
SMatrix A2(Qupper_ & Qlower_); SMatrix A2(Qupper_ & Qlower_);
@ -452,15 +452,15 @@ bool Foam::DMDModels::STDMD::eigendecomposition(SMatrix& Atilde)
evals_ = cp; evals_ = cp;
} }
} }
Pstream::scatter(fail); Pstream::broadcast(fail);
if (fail) if (fail)
{ {
return false; return false;
} }
Pstream::scatter(evals_); Pstream::broadcast(evals_);
Pstream::scatter(evecs_); Pstream::broadcast(evecs_);
return true; return true;
} }
@ -503,8 +503,8 @@ void Foam::DMDModels::STDMD::frequencies()
it = std::find_if(std::next(it), freqs_.cend(), margin); it = std::find_if(std::next(it), freqs_.cend(), margin);
} }
} }
Pstream::scatter(freqs_); Pstream::broadcast(freqs_);
Pstream::scatter(freqsi_); 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); std::sort(magsi_.begin(), magsi_.end(), descend);
} }
Pstream::scatter(mags_); Pstream::broadcast(mags_);
Pstream::scatter(magsi_); Pstream::broadcast(magsi_);
} }

View File

@ -87,8 +87,8 @@ bool Foam::functionObjects::columnAverage::columnAverageField
} }
// Global sum // Global sum
Pstream::listCombineAllGather(regionField, plusEqOp<Type>()); Pstream::listCombineReduce(regionField, plusEqOp<Type>());
Pstream::listCombineAllGather(regionCount, plusEqOp<label>()); Pstream::listCombineReduce(regionCount, plusEqOp<label>());
forAll(regionField, regioni) forAll(regionField, regioni)
{ {

View File

@ -430,7 +430,7 @@ void Foam::functionObjects::externalCoupled::initCoupling()
|| isFile(dir/"patchFaces"); || isFile(dir/"patchFaces");
} }
Pstream::scatter(geomExists); Pstream::broadcast(geomExists);
if (!geomExists) if (!geomExists)
{ {

View File

@ -333,7 +333,7 @@ void Foam::functionObjects::extractEulerianParticles::calculateAddressing
// Create map from new regions to slots in particles list // Create map from new regions to slots in particles list
// - filter through new-to-new addressing to identify new particles // - filter through new-to-new addressing to identify new particles
Pstream::listCombineAllGather(newToNewRegion, maxEqOp<label>()); Pstream::listCombineReduce(newToNewRegion, maxEqOp<label>());
label nParticle = -1; label nParticle = -1;
labelHashSet newRegions; labelHashSet newRegions;
@ -352,7 +352,7 @@ void Foam::functionObjects::extractEulerianParticles::calculateAddressing
// Accumulate old region data or create a new particle if there is no // Accumulate old region data or create a new particle if there is no
// mapping from the old-to-new region // mapping from the old-to-new region
Pstream::listCombineAllGather(oldToNewRegion, maxEqOp<label>()); Pstream::listCombineReduce(oldToNewRegion, maxEqOp<label>());
List<eulerianParticle> newParticles(newRegionToParticleMap.size()); List<eulerianParticle> newParticles(newRegionToParticleMap.size());
forAll(oldToNewRegion, oldRegioni) forAll(oldToNewRegion, oldRegioni)

View File

@ -66,7 +66,7 @@ static Map<Type> regionSum(const regionSplit& regions, const Field<Type>& fld)
regionToSum(regioni, Type(Zero)) += fld[celli]; regionToSum(regioni, Type(Zero)) += fld[celli];
} }
Pstream::mapCombineAllGather(regionToSum, plusEqOp<Type>()); Pstream::mapCombineReduce(regionToSum, plusEqOp<Type>());
return regionToSum; return regionToSum;
} }
@ -214,7 +214,7 @@ Foam::functionObjects::regionSizeDistribution::findPatchRegions
// Make sure all the processors have the same set of regions // Make sure all the processors have the same set of regions
Pstream::mapCombineAllGather(patchRegions, minEqOp<label>()); Pstream::mapCombineReduce(patchRegions, minEqOp<label>());
return patchRegions; return patchRegions;
} }

View File

@ -800,7 +800,7 @@ bool Foam::functionObjects::streamLineBase::writeToFile()
// File names generated on the master but setProperty needed everywher // File names generated on the master but setProperty needed everywher
Pstream::scatter(outputFileNames); Pstream::broadcast(outputFileNames);
forAllConstIters(outputFileNames, iter) forAllConstIters(outputFileNames, iter)
{ {

View File

@ -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; return tfield;
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018-2021 OpenCFD Ltd. Copyright (C) 2018-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -56,11 +56,8 @@ Foam::wordList Foam::functionObjects::vtkCloud::writeFields
// Thus need to resolve names between all processors. // Thus need to resolve names between all processors.
wordList fieldNames(obrTmp.names<IOField<Type>>()); wordList fieldNames(obrTmp.names<IOField<Type>>());
Pstream::combineGather(fieldNames, ListOps::uniqueEqOp<word>()); Pstream::combineReduce(fieldNames, ListOps::uniqueEqOp<word>());
Pstream::broadcast(fieldNames); Foam::sort(fieldNames); // Consistent order
// Consistent order on all processors
Foam::sort(fieldNames);
for (const word& fieldName : fieldNames) for (const word& fieldName : fieldNames)
{ {

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2016-2021 OpenCFD Ltd. Copyright (C) 2016-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -218,9 +218,9 @@ bool Foam::functionObjects::abort::execute()
} }
} }
// Send to slaves. Also acts as an MPI barrier // Send to sub-ranks. Also acts as an MPI barrier
label intAction(action); int intAction(action);
Pstream::scatter(intAction); Pstream::broadcast(intAction);
action = Time::stopAtControls(intAction); action = Time::stopAtControls(intAction);

View File

@ -267,7 +267,7 @@ bool Foam::areaWrite::write()
} }
// Parallel consistency (no-op in serial) // Parallel consistency (no-op in serial)
Pstream::mapCombineAllGather(selected, HashSetOps::plusEqOp<word>()); Pstream::mapCombineReduce(selected, HashSetOps::plusEqOp<word>());
missed.clear(); missed.clear();

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2019-2021 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -73,16 +73,12 @@ void Foam::areaWrite::performAction
{ {
fieldNames = areaMesh.thisDb().names<GeoField>(fieldSelection_); fieldNames = areaMesh.thisDb().names<GeoField>(fieldSelection_);
// With syncPar // Synchronize names
if (Pstream::parRun()) if (Pstream::parRun())
{ {
// Synchronize names Pstream::combineReduce(fieldNames, ListOps::uniqueEqOp<word>());
Pstream::combineGather(fieldNames, ListOps::uniqueEqOp<word>());
Pstream::broadcast(fieldNames);
} }
Foam::sort(fieldNames); // Consistent order
// Sort for consistent order on all processors
Foam::sort(fieldNames);
} }
for (const word& fieldName : fieldNames) for (const word& fieldName : fieldNames)

View File

@ -27,7 +27,6 @@ License
#include "parProfiling.H" #include "parProfiling.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "UPstream.H"
#include "Pstream.H" #include "Pstream.H"
#include "PstreamReduceOps.H" #include "PstreamReduceOps.H"
#include "profilingPstream.H" #include "profilingPstream.H"

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2020 OpenCFD Ltd. Copyright (C) 2018-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -73,7 +73,7 @@ Foam::label Foam::functionObjects::systemCall::dispatch(const stringList& calls)
// MPI barrier // MPI barrier
if (masterOnly_) if (masterOnly_)
{ {
Pstream::scatter(nCalls); Pstream::broadcast(nCalls);
} }
return nCalls; return nCalls;

View File

@ -104,7 +104,7 @@ void Foam::Cloud<ParticleType>::writeCloudUniformProperties() const
labelList np(Pstream::nProcs(), Zero); labelList np(Pstream::nProcs(), Zero);
np[Pstream::myProcNo()] = ParticleType::particleCount_; np[Pstream::myProcNo()] = ParticleType::particleCount_;
Pstream::listCombineAllGather(np, maxEqOp<label>()); Pstream::listCombineReduce(np, maxEqOp<label>());
uniformPropsDict.add uniformPropsDict.add
( (

View File

@ -361,8 +361,7 @@ void Foam::ParticleZoneInfo<CloudType>::write()
{ {
// Find number of particles per proc // Find number of particles per proc
labelList allMaxIDs(maxIDs_); labelList allMaxIDs(maxIDs_);
Pstream::listCombineGather(allMaxIDs, maxEqOp<label>()); Pstream::listCombineReduce(allMaxIDs, maxEqOp<label>());
Pstream::broadcast(allMaxIDs);
// Combine into single list // Combine into single list
label n = returnReduce(data_.size(), sumOp<label>()); label n = returnReduce(data_.size(), sumOp<label>());

View File

@ -120,7 +120,7 @@ void Foam::CellZoneInjection<CloudType>::setPositions
globalPositions.localStart(Pstream::myProcNo()) globalPositions.localStart(Pstream::myProcNo())
) = positions; ) = 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 // Gather local cell tet and tet-point Ids, but leave non-local ids set -1
SubList<label> SubList<label>

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2021 OpenCFD Ltd. Copyright (C) 2015-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -417,7 +417,7 @@ Foam::label Foam::InflationInjection<CloudType>::parcelsToInject
newParticles_ = combinedNewParticles; newParticles_ = combinedNewParticles;
} }
Pstream::scatter(newParticles_); Pstream::broadcast(newParticles_);
} }
return newParticles_.size(); return newParticles_.size();

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2015-2020 OpenCFD Ltd. Copyright (C) 2015-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -62,8 +62,7 @@ void Foam::InjectedParticleDistributionInjection<CloudType>::initialise()
{ {
List<List<label>> procTag(Pstream::nProcs()); List<List<label>> procTag(Pstream::nProcs());
procTag[Pstream::myProcNo()].transfer(tag); procTag[Pstream::myProcNo()].transfer(tag);
Pstream::gatherList(procTag); Pstream::allGatherList(procTag);
Pstream::scatterList(procTag);
tag = tag =
ListListOps::combine<List<label>> ListListOps::combine<List<label>>
( (
@ -72,8 +71,7 @@ void Foam::InjectedParticleDistributionInjection<CloudType>::initialise()
List<List<point>> procPosition(Pstream::nProcs()); List<List<point>> procPosition(Pstream::nProcs());
procPosition[Pstream::myProcNo()].transfer(position); procPosition[Pstream::myProcNo()].transfer(position);
Pstream::gatherList(procPosition); Pstream::allGatherList(procPosition);
Pstream::scatterList(procPosition);
position = position =
ListListOps::combine<List<point>> ListListOps::combine<List<point>>
( (
@ -82,8 +80,7 @@ void Foam::InjectedParticleDistributionInjection<CloudType>::initialise()
List<List<vector>> procU(Pstream::nProcs()); List<List<vector>> procU(Pstream::nProcs());
procU[Pstream::myProcNo()].transfer(U); procU[Pstream::myProcNo()].transfer(U);
Pstream::gatherList(procU); Pstream::allGatherList(procU);
Pstream::scatterList(procU);
U = U =
ListListOps::combine<List<vector>> ListListOps::combine<List<vector>>
( (
@ -92,8 +89,7 @@ void Foam::InjectedParticleDistributionInjection<CloudType>::initialise()
List<List<scalar>> procSOI(Pstream::nProcs()); List<List<scalar>> procSOI(Pstream::nProcs());
procSOI[Pstream::myProcNo()].transfer(soi); procSOI[Pstream::myProcNo()].transfer(soi);
Pstream::gatherList(procSOI); Pstream::allGatherList(procSOI);
Pstream::scatterList(procSOI);
soi = soi =
ListListOps::combine<List<scalar>> ListListOps::combine<List<scalar>>
( (
@ -102,8 +98,7 @@ void Foam::InjectedParticleDistributionInjection<CloudType>::initialise()
List<List<scalar>> procD(Pstream::nProcs()); List<List<scalar>> procD(Pstream::nProcs());
procD[Pstream::myProcNo()].transfer(d); procD[Pstream::myProcNo()].transfer(d);
Pstream::gatherList(procD); Pstream::allGatherList(procD);
Pstream::scatterList(procD);
d = d =
ListListOps::combine<List<scalar>> ListListOps::combine<List<scalar>>
( (

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2015-2020 OpenCFD Ltd. Copyright (C) 2015-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -62,8 +62,7 @@ void Foam::InjectedParticleInjection<CloudType>::initialise()
{ {
List<List<scalar>> procTime(Pstream::nProcs()); List<List<scalar>> procTime(Pstream::nProcs());
procTime[Pstream::myProcNo()].transfer(time); procTime[Pstream::myProcNo()].transfer(time);
Pstream::gatherList(procTime); Pstream::allGatherList(procTime);
Pstream::scatterList(procTime);
time = time =
ListListOps::combine<List<scalar>> ListListOps::combine<List<scalar>>
( (
@ -72,8 +71,7 @@ void Foam::InjectedParticleInjection<CloudType>::initialise()
List<List<point>> procPosition(Pstream::nProcs()); List<List<point>> procPosition(Pstream::nProcs());
procPosition[Pstream::myProcNo()].transfer(position); procPosition[Pstream::myProcNo()].transfer(position);
Pstream::gatherList(procPosition); Pstream::allGatherList(procPosition);
Pstream::scatterList(procPosition);
position = position =
ListListOps::combine<List<point>> ListListOps::combine<List<point>>
( (
@ -82,8 +80,7 @@ void Foam::InjectedParticleInjection<CloudType>::initialise()
List<List<scalar>> procD(Pstream::nProcs()); List<List<scalar>> procD(Pstream::nProcs());
procD[Pstream::myProcNo()].transfer(diameter); procD[Pstream::myProcNo()].transfer(diameter);
Pstream::gatherList(procD); Pstream::allGatherList(procD);
Pstream::scatterList(procD);
diameter = diameter =
ListListOps::combine<List<scalar>> ListListOps::combine<List<scalar>>
( (
@ -92,8 +89,7 @@ void Foam::InjectedParticleInjection<CloudType>::initialise()
List<List<vector>> procU(Pstream::nProcs()); List<List<vector>> procU(Pstream::nProcs());
procU[Pstream::myProcNo()].transfer(U); procU[Pstream::myProcNo()].transfer(U);
Pstream::gatherList(procU); Pstream::allGatherList(procU);
Pstream::scatterList(procU);
U = U =
ListListOps::combine<List<vector>> ListListOps::combine<List<vector>>
( (

View File

@ -114,7 +114,7 @@ void Foam::patchInjectionBase::updateMesh(const polyMesh& mesh)
sumTriMagSf_ = Zero; sumTriMagSf_ = Zero;
sumTriMagSf_[Pstream::myProcNo() + 1] = sum(triMagSf); sumTriMagSf_[Pstream::myProcNo() + 1] = sum(triMagSf);
Pstream::listCombineAllGather(sumTriMagSf_, maxEqOp<scalar>()); Pstream::listCombineReduce(sumTriMagSf_, maxEqOp<scalar>());
for (label i = 1; i < triMagSf.size(); i++) for (label i = 1; i < triMagSf.size(); i++)
{ {

View File

@ -181,7 +181,7 @@ inline Foam::scalar Foam::SprayCloud<CloudType>::penetration
} }
} }
Pstream::scatter(distance); Pstream::broadcast(distance);
return distance; return distance;
} }

View File

@ -880,7 +880,7 @@ Foam::List<Foam::scalar> Foam::lumpedPointMovement::areas
} }
} }
Pstream::listCombineAllGather(zoneAreas, plusEqOp<scalar>()); Pstream::listCombineReduce(zoneAreas, plusEqOp<scalar>());
return zoneAreas; return zoneAreas;
} }
@ -1008,8 +1008,8 @@ bool Foam::lumpedPointMovement::forcesAndMoments
Info<<"No pressure field" << endl; Info<<"No pressure field" << endl;
} }
Pstream::listCombineAllGather(forces, plusEqOp<vector>()); Pstream::listCombineReduce(forces, plusEqOp<vector>());
Pstream::listCombineAllGather(moments, plusEqOp<vector>()); Pstream::listCombineReduce(moments, plusEqOp<vector>());
return true; return true;
} }

View File

@ -1973,7 +1973,7 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::meshRefinement::balance
labelList nProcCells(distributor.countCells(distribution)); labelList nProcCells(distributor.countCells(distribution));
Pout<< "Wanted distribution:" << nProcCells << endl; Pout<< "Wanted distribution:" << nProcCells << endl;
Pstream::listCombineAllGather(nProcCells, plusEqOp<label>()); Pstream::listCombineReduce(nProcCells, plusEqOp<label>());
Pout<< "Wanted resulting decomposition:" << endl; Pout<< "Wanted resulting decomposition:" << endl;
forAll(nProcCells, proci) forAll(nProcCells, proci)

View File

@ -823,7 +823,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::createZoneBaffles
if (nTotalBaffles > 0) if (nTotalBaffles > 0)
{ {
Pstream::listCombineAllGather(nBaffles, plusEqOp<label>()); Pstream::listCombineReduce(nBaffles, plusEqOp<label>());
Info<< nl Info<< nl
<< setf(ios_base::left) << setf(ios_base::left)
@ -1953,7 +1953,7 @@ void Foam::meshRefinement::findCellZoneTopo
// - region numbers are identical on all processors // - region numbers are identical on all processors
// - keepRegion is identical ,, // - keepRegion is identical ,,
// - cellZones are identical ,, // - cellZones are identical ,,
Pstream::listCombineAllGather(regionToCellZone, maxEqOp<label>()); Pstream::listCombineReduce(regionToCellZone, maxEqOp<label>());
// Find the region containing the keepPoint // Find the region containing the keepPoint
@ -2003,7 +2003,7 @@ void Foam::meshRefinement::findCellZoneTopo
// - cellZones are identical ,, // - cellZones are identical ,,
// This done at top of loop to account for geometric matching // This done at top of loop to account for geometric matching
// not being synchronised. // not being synchronised.
Pstream::listCombineAllGather(regionToCellZone, maxEqOp<label>()); Pstream::listCombineReduce(regionToCellZone, maxEqOp<label>());
bool changed = false; bool changed = false;
@ -5862,7 +5862,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
// 2.Combine faceZoneNames allocated on different processors // 2.Combine faceZoneNames allocated on different processors
Pstream::mapCombineAllGather(zonesToFaceZone, eqOp<word>()); Pstream::mapCombineReduce(zonesToFaceZone, eqOp<word>());
// 3. Allocate faceZones from (now synchronised) faceZoneNames // 3. Allocate faceZones from (now synchronised) faceZoneNames
@ -6085,7 +6085,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
nPosOrientation.find(faceToConnectedZone[faceI])() += n; nPosOrientation.find(faceToConnectedZone[faceI])() += n;
} }
} }
Pstream::mapCombineAllGather(nPosOrientation, plusEqOp<label>()); Pstream::mapCombineReduce(nPosOrientation, plusEqOp<label>());
Info<< "Split " << nFreeStanding << " free-standing zone faces" Info<< "Split " << nFreeStanding << " free-standing zone faces"

View File

@ -3263,9 +3263,9 @@ void Foam::snappyRefineDriver::deleteSmallRegions
nCellsPerRegion[regioni]++; nCellsPerRegion[regioni]++;
nCellsPerZone[zonei]++; nCellsPerZone[zonei]++;
} }
Pstream::listCombineAllGather(nCellsPerRegion, plusEqOp<label>()); Pstream::listCombineReduce(nCellsPerRegion, plusEqOp<label>());
Pstream::listCombineAllGather(regionToZone, maxEqOp<label>()); Pstream::listCombineReduce(regionToZone, maxEqOp<label>());
Pstream::listCombineAllGather(nCellsPerZone, plusEqOp<label>()); Pstream::listCombineReduce(nCellsPerZone, plusEqOp<label>());
// Mark small regions. Note that all processors have the same information // Mark small regions. Note that all processors have the same information

View File

@ -282,9 +282,9 @@ Foam::externalFileCoupler::waitForMaster() const
} }
} }
label intAction(action); // Send to sub-ranks. Also acts as an MPI barrier
int intAction(action);
Pstream::scatter(intAction); // Also acts as MPI barrier Pstream::broadcast(intAction);
return Time::stopAtControls(intAction); return Time::stopAtControls(intAction);
} }
@ -326,9 +326,9 @@ Foam::externalFileCoupler::waitForSlave() const
Log << type() << ": found lock file " << lck << endl; Log << type() << ": found lock file " << lck << endl;
} }
label intAction(action); // Send to sub-ranks. Also acts as an MPI barrier
int intAction(action);
Pstream::scatter(intAction); // Also acts as MPI barrier Pstream::broadcast(intAction);
return Time::stopAtControls(intAction); return Time::stopAtControls(intAction);
} }

View File

@ -668,7 +668,7 @@ void Foam::mappedPatchBase::findSamples
// Find nearest - globally consistent // Find nearest - globally consistent
Pstream::listCombineAllGather Pstream::listCombineReduce
( (
nearest, nearest,
nearestWorldEqOp(), nearestWorldEqOp(),

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2021 OpenCFD Ltd. Copyright (C) 2021-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -241,12 +241,7 @@ void Foam::multiWorldConnections::createComms()
if (Pstream::parRun()) if (Pstream::parRun())
{ {
Pstream::combineGather Pstream::combineReduce(allConnections, worldConnectBitOrEq());
(
allConnections,
worldConnectBitOrEq()
);
Pstream::scatter(allConnections);
} }
// Check for mismatched connections // Check for mismatched connections

View File

@ -70,7 +70,7 @@ bool writeTopoSet
const topoSet& set, const topoSet& set,
const vtk::outputOptions opts, const vtk::outputOptions opts,
const fileName& file, const fileName& file,
bool parallel = Pstream::parRun() bool parallel = UPstream::parRun()
); );
@ -83,7 +83,7 @@ bool writeFaceSet
const faceSet& set, const faceSet& set,
const vtk::outputOptions opts, const vtk::outputOptions opts,
const fileName& file, const fileName& file,
bool parallel = Pstream::parRun() bool parallel = UPstream::parRun()
); );
@ -96,7 +96,7 @@ bool writeCellSetFaces
const cellSet& set, const cellSet& set,
const vtk::outputOptions opts, const vtk::outputOptions opts,
const fileName& file, const fileName& file,
bool parallel = Pstream::parRun() bool parallel = UPstream::parRun()
); );
@ -109,7 +109,7 @@ bool writePointSet
const pointSet& set, const pointSet& set,
const vtk::outputOptions opts, const vtk::outputOptions opts,
const fileName& file, const fileName& file,
bool parallel = Pstream::parRun() bool parallel = UPstream::parRun()
); );

View File

@ -139,7 +139,7 @@ Foam::regionSplit2D::regionSplit2D
// Ensure regionToCompactAddr consistent across all processors // Ensure regionToCompactAddr consistent across all processors
// - not concerned about the op (keys are unique) // - not concerned about the op (keys are unique)
// - map size will be the number of regions in the set of faces // - 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(); nRegions_ = regionToCompactAddr.size();

View File

@ -462,7 +462,7 @@ Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io, const readAction r)
triSurface s2(actualFile); triSurface s2(actualFile);
triSurface::transfer(s2); triSurface::transfer(s2);
} }
Pstream::scatter(triSurface::patches()); Pstream::broadcast(triSurface::patches());
if (debug) if (debug)
{ {
Pout<< "triSurfaceMesh(const IOobject& io) :" Pout<< "triSurfaceMesh(const IOobject& io) :"
@ -587,7 +587,7 @@ Foam::triSurfaceMesh::triSurfaceMesh
triSurface s2(actualFile, surfType, scaleFactor); triSurface s2(actualFile, surfType, scaleFactor);
triSurface::transfer(s2); triSurface::transfer(s2);
} }
Pstream::scatter(triSurface::patches()); Pstream::broadcast(triSurface::patches());
if (debug) if (debug)
{ {
Pout<< "triSurfaceMesh(const IOobject& io) :" Pout<< "triSurfaceMesh(const IOobject& io) :"

View File

@ -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) for (const auto& near : nearest)
{ {

View File

@ -176,7 +176,7 @@ void Foam::regionToFace::combine(topoSet& set, const bool add) const
} }
// Globally reduce // Globally reduce
Pstream::combineAllGather(ni, mappedPatchBase::nearestEqOp()); Pstream::combineReduce(ni, mappedPatchBase::nearestEqOp());
if (verbose_) if (verbose_)
{ {

View File

@ -217,7 +217,7 @@ void Foam::planeToFaceZone::combine(faceZoneSet& fzSet, const bool add) const
regionRegions[regioni].unset(regioni); regionRegions[regioni].unset(regioni);
} }
} }
Pstream::listCombineAllGather(regionRegions, bitOrEqOp<bitSet>()); Pstream::listCombineReduce(regionRegions, bitOrEqOp<bitSet>());
// Collapse the region connections into a map between each region // Collapse the region connections into a map between each region
// and the lowest numbered region that it connects to // 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]; ++ regionNFaces[regioni];
} }
Pstream::listCombineAllGather(regionNFaces, plusEqOp<label>()); Pstream::listCombineReduce(regionNFaces, plusEqOp<label>());
Info<< " Found " << nRegions << " contiguous regions with " Info<< " Found " << nRegions << " contiguous regions with "
<< regionNFaces << " faces" << endl; << regionNFaces << " faces" << endl;

View File

@ -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) for (const auto& near : nearest)
{ {

View File

@ -1010,7 +1010,7 @@ Foam::vectorField Foam::NURBS3DVolume::computeControlPointSensitivities
} }
// Sum contributions from all processors // Sum contributions from all processors
Pstream::listCombineAllGather(controlPointDerivs, plusEqOp<vector>()); Pstream::listCombineReduce(controlPointDerivs, plusEqOp<vector>());
return controlPointDerivs; return controlPointDerivs;
} }
@ -1095,7 +1095,7 @@ Foam::vectorField Foam::NURBS3DVolume::computeControlPointSensitivities
} }
} }
// Sum contributions from all processors // Sum contributions from all processors
Pstream::listCombineAllGather(controlPointDerivs, plusEqOp<vector>()); Pstream::listCombineReduce(controlPointDerivs, plusEqOp<vector>());
return controlPointDerivs; return controlPointDerivs;
} }

View File

@ -377,7 +377,7 @@ void Foam::cellCellStencils::cellVolumeWeight::findHoles
{ {
// Synchronise region status on processors // Synchronise region status on processors
// (could instead swap status through processor patches) // (could instead swap status through processor patches)
Pstream::listCombineAllGather(regionType, maxEqOp<label>()); Pstream::listCombineReduce(regionType, maxEqOp<label>());
// Communicate region status through interpolative cells // Communicate region status through interpolative cells
labelList cellRegionType(labelUIndList(regionType, cellRegion)); labelList cellRegionType(labelUIndList(regionType, cellRegion));
@ -754,7 +754,7 @@ bool Foam::cellCellStencils::cellVolumeWeight::update()
{ {
nCellsPerZone[zoneID[cellI]]++; nCellsPerZone[zoneID[cellI]]++;
} }
Pstream::listCombineAllGather(nCellsPerZone, plusEqOp<label>()); Pstream::listCombineReduce(nCellsPerZone, plusEqOp<label>());
Info<< typeName << " : detected " << nZones Info<< typeName << " : detected " << nZones

View File

@ -1118,7 +1118,7 @@ void Foam::cellCellStencils::inverseDistance::findHoles
{ {
// Synchronise region status on processors // Synchronise region status on processors
// (could instead swap status through processor patches) // (could instead swap status through processor patches)
Pstream::listCombineAllGather(regionType, maxEqOp<label>()); Pstream::listCombineReduce(regionType, maxEqOp<label>());
DebugInfo<< FUNCTION_NAME << " : Gathered region type" << endl; DebugInfo<< FUNCTION_NAME << " : Gathered region type" << endl;
@ -1722,7 +1722,7 @@ bool Foam::cellCellStencils::inverseDistance::update()
{ {
nCellsPerZone[zoneID[cellI]]++; nCellsPerZone[zoneID[cellI]]++;
} }
Pstream::listCombineAllGather(nCellsPerZone, plusEqOp<label>()); Pstream::listCombineReduce(nCellsPerZone, plusEqOp<label>());
const boundBox& allBb(mesh_.bounds()); const boundBox& allBb(mesh_.bounds());

View File

@ -517,7 +517,7 @@ Foam::cellCellStencils::trackingInverseDistance::trackingInverseDistance
{ {
nCellsPerZone[zoneID[celli]]++; nCellsPerZone[zoneID[celli]]++;
} }
Pstream::listCombineAllGather(nCellsPerZone, plusEqOp<label>()); Pstream::listCombineReduce(nCellsPerZone, plusEqOp<label>());
meshParts_.setSize(nZones); meshParts_.setSize(nZones);
forAll(meshParts_, zonei) forAll(meshParts_, zonei)

View File

@ -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) forAll(hasRef, regionI)
{ {

View File

@ -480,7 +480,7 @@ void Foam::decompositionMethod::calcCellCells
// Create global cell numbers // 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 // Get agglomerate owner on other side of coupled faces
@ -673,7 +673,7 @@ void Foam::decompositionMethod::calcCellCells
// Create global cell numbers // 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 // Get agglomerate owner on other side of coupled faces

View File

@ -419,11 +419,7 @@ void Foam::multiLevelDecomp::decompose
label nPoints = returnReduce(domainPoints.size(), sumOp<label>()); label nPoints = returnReduce(domainPoints.size(), sumOp<label>());
Pstream::listCombineAllGather Pstream::listCombineReduce(nOutsideConnections, plusEqOp<label>());
(
nOutsideConnections,
plusEqOp<label>()
);
label nPatches = 0; label nPatches = 0;
label nFaces = 0; label nFaces = 0;
for (const label nConnect : nOutsideConnections) for (const label nConnect : nOutsideConnections)
@ -530,7 +526,7 @@ void Foam::multiLevelDecomp::decompose
} }
reduce(nPoints, sumOp<label>()); reduce(nPoints, sumOp<label>());
Pstream::listCombineAllGather Pstream::listCombineReduce
( (
nOutsideConnections, nOutsideConnections,
plusEqOp<label>() plusEqOp<label>()

View File

@ -101,7 +101,7 @@ void Foam::faMeshReconstructor::calcAddressing
? 0 ? 0
: singlePatchFaceLabels_.first() : singlePatchFaceLabels_.first()
); );
Pstream::scatter(patchFirstMeshfacei); Pstream::broadcast(patchFirstMeshfacei);
for (label& facei : faFaceProcAddr_) for (label& facei : faFaceProcAddr_)
{ {
@ -169,7 +169,7 @@ void Foam::faMeshReconstructor::calcAddressing
} }
// Broadcast the same information everywhere // Broadcast the same information everywhere
Pstream::scatter(singlePatchFaceLabels_); Pstream::broadcast(singlePatchFaceLabels_);
// ------------------ // ------------------
@ -283,7 +283,7 @@ void Foam::faMeshReconstructor::calcAddressing
mpm[mp[i]] = i; mpm[mp[i]] = i;
} }
} }
Pstream::scatter(mpm); Pstream::broadcast(mpm);
// Rewrite pointToGlobal according to the correct point order // Rewrite pointToGlobal according to the correct point order
for (label& pointi : pointToGlobal) for (label& pointi : pointToGlobal)
@ -299,8 +299,8 @@ void Foam::faMeshReconstructor::calcAddressing
} }
// Broadcast the same information everywhere // Broadcast the same information everywhere
Pstream::scatter(singlePatchFaces_); Pstream::broadcast(singlePatchFaces_);
Pstream::scatter(singlePatchPoints_); Pstream::broadcast(singlePatchPoints_);
// Now have enough global information to determine global edge mappings // Now have enough global information to determine global edge mappings
@ -383,13 +383,8 @@ void Foam::faMeshReconstructor::calcAddressing
// OR patchEdgeLabels = // OR patchEdgeLabels =
// UIndirectList<label>(faEdgeProcAddr_, fap.edgeLabels()); // UIndirectList<label>(faEdgeProcAddr_, fap.edgeLabels());
// Combine from all processors
// Collect from all processors Pstream::combineReduce(patchEdgeLabels, ListOps::appendEqOp<label>());
Pstream::combineAllGather
(
patchEdgeLabels,
ListOps::appendEqOp<label>()
);
// Sorted order will be the original non-decomposed order // Sorted order will be the original non-decomposed order
Foam::sort(patchEdgeLabels); Foam::sort(patchEdgeLabels);

View File

@ -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.field() = 0.5*(magSf + passiveMagSf);
magSf.correctBoundaryConditions(); magSf.correctBoundaryConditions();

View File

@ -190,7 +190,7 @@ void Foam::RBD::rigidBodyMotion::solve
solver_->solve(tau, fx); solver_->solve(tau, fx);
} }
Pstream::scatter(motionState_); Pstream::broadcast(motionState_);
// Update the body-state to correspond to the current joint-state // Update the body-state to correspond to the current joint-state
forwardDynamicsCorrection(motionState_); forwardDynamicsCorrection(motionState_);

View File

@ -166,7 +166,7 @@ void Foam::patchProbes::findElements(const fvMesh& mesh)
// Find nearest - globally consistent // Find nearest - globally consistent
Pstream::listCombineAllGather(nearest, mappedPatchBase::nearestEqOp()); Pstream::listCombineReduce(nearest, mappedPatchBase::nearestEqOp());
oldPoints_.resize(this->size()); oldPoints_.resize(this->size());

View File

@ -111,7 +111,7 @@ Foam::patchProbes::sample(const VolumeField<Type>& vField) const
} }
} }
Pstream::listCombineAllGather(values, isNotEqOp<Type>()); Pstream::listCombineReduce(values, isNotEqOp<Type>());
return tvalues; 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; return tvalues;
} }

View File

@ -225,7 +225,7 @@ Foam::probes::sample(const VolumeField<Type>& vField) const
} }
} }
Pstream::listCombineAllGather(values, isNotEqOp<Type>()); Pstream::listCombineReduce(values, isNotEqOp<Type>());
return tvalues; 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; return tvalues;
} }

View File

@ -84,8 +84,8 @@ void Foam::cloudSet::calcSamples
minFoundProc[i] = foundProc[i]; minFoundProc[i] = foundProc[i];
} }
} }
Pstream::listCombineAllGather(minFoundProc, minEqOp<label>()); Pstream::listCombineReduce(minFoundProc, minEqOp<label>());
Pstream::listCombineAllGather(maxFoundProc, maxEqOp<label>()); Pstream::listCombineReduce(maxFoundProc, maxEqOp<label>());
DynamicField<point> missingPoints(sampleCoords_.size()); DynamicField<point> missingPoints(sampleCoords_.size());

View File

@ -155,7 +155,7 @@ void Foam::patchCloudSet::calcSamples
// Find nearest - globally consistent // Find nearest - globally consistent
Pstream::listCombineAllGather(nearest, mappedPatchBase::nearestEqOp()); Pstream::listCombineReduce(nearest, mappedPatchBase::nearestEqOp());
if (debug && Pstream::master()) if (debug && Pstream::master())

View File

@ -178,11 +178,7 @@ void Foam::patchSeedSet::calcSamples
// 2. Reduce on master. Select nearest processor. // 2. Reduce on master. Select nearest processor.
// Find nearest - globally consistent // Find nearest - globally consistent
Pstream::listCombineAllGather Pstream::listCombineReduce(nearest, mappedPatchBase::nearestEqOp());
(
nearest,
mappedPatchBase::nearestEqOp()
);
// 3. Pick up my local faces that have won // 3. Pick up my local faces that have won

View File

@ -196,7 +196,7 @@ Foam::IOobjectList Foam::sampledSets::preCheckFields(unsigned request)
// Parallel consistency (no-op in serial) // Parallel consistency (no-op in serial)
// Probably not needed... // Probably not needed...
/// Pstream::mapCombineAllGather(selected, HashSetOps::plusEqOp<word>()); /// Pstream::mapCombineReduce(selected, HashSetOps::plusEqOp<word>());
DynamicList<label> missed(fieldSelection_.size()); DynamicList<label> missed(fieldSelection_.size());

View File

@ -264,7 +264,7 @@ void Foam::shortestPathSet::sync
celli, celli,
Tuple2<point, bool>(origin, findMinDistance) Tuple2<point, bool>(origin, findMinDistance)
); );
Pstream::combineAllGather Pstream::combineReduce
( (
searchData, searchData,
[](ProcData& x, const ProcData& y) [](ProcData& x, const ProcData& y)

View File

@ -227,7 +227,7 @@ bool Foam::sampledMeshedSurface::update(const meshSearch& meshSearcher)
// See which processor has the nearest. Mark and subset // See which processor has the nearest. Mark and subset
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Pstream::listCombineAllGather(nearest, minFirstEqOp<scalar>{}); Pstream::listCombineReduce(nearest, minFirstEqOp<scalar>{});
labelList cellOrFaceLabels(fc.size(), -1); labelList cellOrFaceLabels(fc.size(), -1);

View File

@ -119,7 +119,7 @@ Foam::IOobjectList Foam::sampledSurfaces::preCheckFields()
} }
// Parallel consistency (no-op in serial) // Parallel consistency (no-op in serial)
Pstream::mapCombineAllGather(selected, HashSetOps::plusEqOp<word>()); Pstream::mapCombineReduce(selected, HashSetOps::plusEqOp<word>());
DynamicList<label> missed(fieldSelection_.size()); DynamicList<label> missed(fieldSelection_.size());

View File

@ -262,7 +262,7 @@ void Foam::isoSurfacePoint::syncUnseparatedPoints
} }
// Globally consistent // Globally consistent
Pstream::listCombineAllGather(sharedPts, minEqOp<point>()); Pstream::listCombineReduce(sharedPts, minEqOp<point>());
// Now we will all have the same information. Merge it back with // Now we will all have the same information. Merge it back with
// my local information. // my local information.

View File

@ -323,7 +323,7 @@ void Foam::sixDoFRigidBodyMotion::update
} }
} }
Pstream::scatter(motionState_); Pstream::broadcast(motionState_);
} }

Some files were not shown because too many files have changed in this diff Show More