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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2153,7 +2153,7 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
UPstream::allToAll(nSendCells, nRecvCells); UPstream::allToAll(nSendCells, nRecvCells);
// Allocate buffers // Allocate buffers
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking); PstreamBuffers pBufs;
// What to send to neighbouring domains // 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 // Create subsetted refinement tree consisting of all parents that
// move in their whole to other processor. // move in their whole to other processor.
PstreamBuffers pBufs(UPstream::commsTypes::nonBlocking); PstreamBuffers pBufs;
for (const int proci : Pstream::allProcs()) 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) forAll(sendMap, proci)
{ {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1970,7 +1970,7 @@ bool Foam::cellCellStencils::inverseDistance::update()
const globalIndex globalCells(mesh_.nCells()); const globalIndex globalCells(mesh_.nCells());
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking); PstreamBuffers pBufs;
// Mark holes (in allCellTypes) // Mark holes (in allCellTypes)
for (label srcI = 0; srcI < meshParts.size()-1; srcI++) 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()); const globalIndex globalCells(mesh_.nCells());
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking); PstreamBuffers pBufs;
DebugInfo<< FUNCTION_NAME << " : Allocated donor-cell structures" << endl; DebugInfo<< FUNCTION_NAME << " : Allocated donor-cell structures" << endl;

View File

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

View File

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

View File

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

View File

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