STYLE: use PstreamBuffers default construct

- PstreamBuffers are nonBlocking by default, so no need to re-specify
This commit is contained in:
Mark Olesen 2024-04-26 10:17:43 +02:00
parent 7f355ba343
commit 7b38b148fa
34 changed files with 48 additions and 68 deletions

View File

@ -66,7 +66,7 @@ int main(int argc, char *argv[])
Pstream::myProcNo()
);
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
if (!Pstream::master())
{
@ -150,7 +150,7 @@ int main(int argc, char *argv[])
// Do a non-blocking send inbetween
{
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
for (const int proci : Pstream::allProcs())
{

View File

@ -618,7 +618,7 @@ void Foam::conformalVoronoiMesh::reorderProcessorPatches
labelList rotation(faces.size(), Zero);
labelList faceMap(faces.size(), label(-1));
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
// Send ordering
forAll(sortMesh.boundaryMesh(), patchi)

View File

@ -184,7 +184,7 @@ Foam::parLagrangianDistributor::distributeLagrangianPositions
labelListList sendMap;
// Transfer buffers
PstreamBuffers pBufs(UPstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
{
// List of lists of particles to be transferred for all of the

View File

@ -545,7 +545,7 @@ bool Foam::decomposedBlockData::readBlocks
}
else
{
PstreamBuffers pBufs(comm, UPstream::commsTypes::nonBlocking);
PstreamBuffers pBufs(comm);
if (UPstream::master(comm))
{
@ -667,7 +667,7 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlocks
}
else
{
PstreamBuffers pBufs(comm, UPstream::commsTypes::nonBlocking);
PstreamBuffers pBufs(comm);
if (UPstream::master(comm))
{

View File

@ -115,7 +115,7 @@ void Foam::masterOFstream::commit()
}
// Different files
PstreamBuffers pBufs(comm_, UPstream::commsTypes::nonBlocking);
PstreamBuffers pBufs(comm_);
if (!UPstream::master(comm_))
{

View File

@ -38,7 +38,7 @@ Description
Example usage:
\code
PstreamBuffers pBufs(UPstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
for (const int proci : UPstream::allProcs())
{
@ -68,7 +68,7 @@ Description
one-to-all and all-to-one communication patterns.
For example,
\code
PstreamBuffers pBufs(UPstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
if (UPstream::master())
{
@ -96,7 +96,7 @@ Description
For example,
\code
PstreamBuffers pBufs(UPstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
pBufs.initRegisterSend();

View File

@ -452,7 +452,7 @@ Foam::fileOperations::masterUncollatedFileOperation::read
{
autoPtr<ISstream> isPtr;
PstreamBuffers pBufs(comm, UPstream::commsTypes::nonBlocking);
PstreamBuffers pBufs(comm);
if (UPstream::master(comm))
{
@ -1834,7 +1834,7 @@ bool Foam::fileOperations::masterUncollatedFileOperation::readHeader
}
// Is a more efficient scatter possible?
PstreamBuffers pBufs(comm_, UPstream::commsTypes::nonBlocking);
PstreamBuffers pBufs(comm_);
if (Pstream::master(comm_))
{
@ -2396,7 +2396,7 @@ Foam::fileOperations::masterUncollatedFileOperation::NewIFstream
filePaths[Pstream::myProcNo(comm_)] = filePath;
Pstream::gatherList(filePaths, Pstream::msgType(), comm_);
PstreamBuffers pBufs(comm_, Pstream::commsTypes::nonBlocking);
PstreamBuffers pBufs(comm_);
if (Pstream::master(comm_))
{

View File

@ -311,12 +311,7 @@ void Foam::GAMGSolver::gatherMatrices
const auto& boundaryMap = agglomeration_.boundaryMap(destLevel);
// Use PstreamBuffers
PstreamBuffers pBufs
(
UPstream::commsTypes::nonBlocking,
UPstream::msgType(),
comm
);
PstreamBuffers pBufs(comm);
// Send to master
if (!UPstream::master(comm))

View File

@ -1344,12 +1344,7 @@ void Foam::lduPrimitiveMesh::gather
(void)mesh.lduAddr().patchSchedule();
// Use PstreamBuffers
PstreamBuffers pBufs
(
Pstream::commsTypes::nonBlocking,
UPstream::msgType(),
comm
);
PstreamBuffers pBufs(comm);
// Send to master
if (!Pstream::master(comm))

View File

@ -681,7 +681,7 @@ void Foam::mapDistributeBase::distribute
if (!is_contiguous<T>::value)
{
PstreamBuffers pBufs(UPstream::commsTypes::nonBlocking, tag, comm);
PstreamBuffers pBufs(comm, tag);
// Stream data into buffer
for (const int proci : UPstream::allProcs(comm))
@ -1121,7 +1121,7 @@ void Foam::mapDistributeBase::distribute
if (!is_contiguous<T>::value)
{
PstreamBuffers pBufs(UPstream::commsTypes::nonBlocking, tag, comm);
PstreamBuffers pBufs(comm, tag);
// Stream data into buffer
for (const int proci : UPstream::allProcs(comm))

View File

@ -132,7 +132,7 @@ void Foam::syncTools::syncPointMap
// Presize according to number of processor patches
// (global topology information may not yet be available...)
DynamicList<label> neighbProcs(patches.nProcessorPatches());
PstreamBuffers pBufs(UPstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
// Reduce communication by only sending non-zero data,
// but with multiply-connected processor/processor
@ -396,7 +396,7 @@ void Foam::syncTools::syncEdgeMap
// Presize according to number of processor patches
// (global topology information may not yet be available...)
DynamicList<label> neighbProcs(patches.nProcessorPatches());
PstreamBuffers pBufs(UPstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
// Reduce communication by only sending non-zero data,
// but with multiply-connected processor/processor
@ -1142,7 +1142,7 @@ void Foam::syncTools::syncBoundaryFaceList
else
{
DynamicList<label> neighbProcs;
PstreamBuffers pBufs(UPstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
// Send
for (const polyPatch& pp : patches)

View File

@ -1092,7 +1092,7 @@ void Foam::globalIndex::get
);
// Send local indices to individual processors as local index
PstreamBuffers sendBufs(UPstream::commsTypes::nonBlocking, tag, comm);
PstreamBuffers sendBufs(comm, tag);
for (const auto proci : validBins)
{
@ -1109,7 +1109,7 @@ void Foam::globalIndex::get
sendBufs.finishedSends();
PstreamBuffers returnBufs(UPstream::commsTypes::nonBlocking, tag, comm);
PstreamBuffers returnBufs(comm, tag);
for (const int proci : sendBufs.allProcs())
{

View File

@ -2153,7 +2153,7 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
UPstream::allToAll(nSendCells, nRecvCells);
// Allocate buffers
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
// What to send to neighbouring domains

View File

@ -1272,7 +1272,7 @@ void Foam::refinementHistory::distribute(const mapDistributePolyMesh& map)
// Create subsetted refinement tree consisting of all parents that
// move in their whole to other processor.
PstreamBuffers pBufs(UPstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
for (const int proci : Pstream::allProcs())
{

View File

@ -537,7 +537,7 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::calcOverlappingProcEddies
}
PstreamBuffers pBufs(UPstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
forAll(sendMap, proci)
{

View File

@ -174,7 +174,7 @@ void Foam::fvMeshSubset::doCoupledPatches
if (syncPar && UPstream::parRun())
{
PstreamBuffers pBufs(UPstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
// Send face usage across processor patches
if (!nCellsUsingFace.empty())

View File

@ -227,7 +227,7 @@ reducedKoopmanOperator()
// the final outcome of TSQR decomposition up to sign
// Don't clear storage on persistent buffer
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
pBufs.allowClearRecv(false);
const label myProcNo = Pstream::myProcNo();

View File

@ -111,7 +111,7 @@ void Foam::functionObjects::externalCoupled::readColumns
// Get sizes for all processors
const globalIndex globalFaces(globalIndex::gatherOnly{}, nRows);
PstreamBuffers pBufs(UPstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
if (UPstream::master())
{
@ -182,7 +182,7 @@ void Foam::functionObjects::externalCoupled::readLines
// Get sizes for all processors
const globalIndex globalFaces(globalIndex::gatherOnly{}, nRows);
PstreamBuffers pBufs(UPstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
if (UPstream::master())
{

View File

@ -215,7 +215,7 @@ bool Foam::functionObjects::energySpectrum::write()
if (Pstream::parRun())
{
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
{
UOPstream toMaster(Pstream::masterNo(), pBufs);

View File

@ -87,11 +87,7 @@ void Foam::functionObjects::syncObjects::sync()
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Note provision of explicit all-world communicator
PstreamBuffers pBufs
(
UPstream::commGlobal(),
UPstream::commsTypes::nonBlocking
);
PstreamBuffers pBufs(UPstream::commGlobal());
for (const int proci : pBufs.allProcs())

View File

@ -182,7 +182,7 @@ void Foam::Cloud<ParticleType>::move
// Allocate transfer buffers,
// automatic clearStorage when UIPstream closes is disabled.
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
pBufs.allowClearRecv(false);
// Cache of opened UOPstream wrappers

View File

@ -39,7 +39,7 @@ Description
Simultaneous communication and computation is possible using:
\verbatim
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
label startOfRequests = Pstream::nRequests();
il_.sendReferredData(cellOccupancy_, pBufs);
// Do other things
@ -231,8 +231,7 @@ public:
// Member Functions
//- Prepare and send referred particles and wall data,
// nonBlocking communication
//- Prepare and send referred particles and wall data (nonBlocking)
void sendReferredData
(
const List<DynamicList<ParticleType*>>& cellOccupancy,

View File

@ -58,7 +58,7 @@ void Foam::PairCollision<CloudType>::preInteraction()
template<class CloudType>
void Foam::PairCollision<CloudType>::parcelInteraction()
{
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
label startOfRequests = Pstream::nRequests();

View File

@ -208,7 +208,7 @@ void Foam::RecycleInteraction<CloudType>::postEvolve()
// See comments in Cloud::move() about transfer particles handling
// Allocate transfer buffers
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
// Cache of opened UOPstream wrappers
PtrList<UOPstream> UOPstreamPtrs(Pstream::nProcs());

View File

@ -131,7 +131,7 @@ void Foam::moleculeCloud::buildCellOccupancy()
void Foam::moleculeCloud::calculatePairForce()
{
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
// Start sending referred data
label startOfRequests = Pstream::nRequests();
@ -356,7 +356,7 @@ void Foam::moleculeCloud::removeHighEnergyOverlaps()
buildCellOccupancy();
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
// Start sending referred data
label startOfRequests = Pstream::nRequests();

View File

@ -78,12 +78,7 @@ void Foam::advancingFrontAMI::distributePatches
points.setSize(Pstream::nProcs(comm_));
faceIDs.setSize(Pstream::nProcs(comm_));
PstreamBuffers pBufs
(
Pstream::commsTypes::nonBlocking,
UPstream::msgType(),
comm_
);
PstreamBuffers pBufs(comm_);
for (const int domain : Pstream::allProcs(comm_))
{

View File

@ -2026,7 +2026,7 @@ void Foam::polyTopoChange::reorderCoupledFaces
// Rotation on new faces.
labelList rotation(faces_.size(), Zero);
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
// Send ordering
forAll(patchMap, patchi)

View File

@ -102,7 +102,7 @@ void Foam::processorLODs::box::setRefineFlags
labelList& nElems
) const
{
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
// Identify src boxes that can be refined and send to all remote procs
for (const int proci : Pstream::allProcs())
@ -315,7 +315,7 @@ bool Foam::processorLODs::box::doRefineBoxes
List<DynamicList<treeBoundBox>>& fixedBoxes
)
{
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
// Send refine info back for list of evolving src boxes
forAll(refineFlags, proci)

View File

@ -1970,7 +1970,7 @@ bool Foam::cellCellStencils::inverseDistance::update()
const globalIndex globalCells(mesh_.nCells());
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
// Mark holes (in allCellTypes)
for (label srcI = 0; srcI < meshParts.size()-1; srcI++)

View File

@ -765,7 +765,7 @@ bool Foam::cellCellStencils::trackingInverseDistance::update()
const globalIndex globalCells(mesh_.nCells());
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
DebugInfo<< FUNCTION_NAME << " : Allocated donor-cell structures" << endl;

View File

@ -4784,7 +4784,7 @@ void Foam::distributedTriSurfaceMesh::distribute
// Send all
// ~~~~~~~~
PstreamBuffers pBufs(UPstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
forAll(faceSendMap, proci)
{

View File

@ -110,7 +110,7 @@ void Foam::faMeshReconstructor::calcAddressing
}
}
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
if (Pstream::master())
{

View File

@ -274,7 +274,7 @@ void Foam::meshToMesh::distributeCells
procLocalFaceIDs.setSize(Pstream::nProcs());;
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
for (const int domain : Pstream::allProcs())
{

View File

@ -497,7 +497,7 @@ Foam::DynamicList<Foam::label> Foam::isoAdvection::syncProcPatches
if (Pstream::parRun())
{
DynamicList<label> neighProcs;
PstreamBuffers pBufs(UPstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
// Send
for (const label patchi : procPatchLabels_)