mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: additional control and access methods for PstreamBuffers
- PstreamBuffers nProcs() and allProcs() methods to recover the rank
information consistent with the communicator used for construction
- allowClearRecv() methods for more control over buffer reuse
For example,
pBufs.allowClearRecv(false);
forAll(particles, particlei)
{
pBufs.clear();
fill...
read via IPstream(..., pBufs);
}
This preserves the receive buffers memory allocation between calls.
- finishedNeighbourSends() method as compact wrapper for
finishedSends() when send/recv ranks are identically
(eg, neighbours)
- hasSendData()/hasRecvData() methods for PstreamBuffers.
Can be useful for some situations to skip reading entirely.
For example,
pBufs.finishedNeighbourSends(neighProcs);
if (!returnReduce(pBufs.hasRecvData(), orOp<bool>()))
{
// Nothing to do
continue;
}
...
On an individual basis:
for (const int proci : pBufs.allProcs())
{
if (pBufs.hasRecvData(proci))
{
...
}
}
Also conceivable to do the following instead (nonBlocking only):
if (!returnReduce(pBufs.hasSendData(), orOp<bool>()))
{
// Nothing to do
pBufs.clear();
continue;
}
pBufs.finishedNeighbourSends(neighProcs);
...
This commit is contained in:
committed by
Andrew Heather
parent
bfca84d11a
commit
14631984df
@ -304,8 +304,6 @@ void Foam::meshToMesh::distributeCells
|
||||
List<labelList>& procLocalFaceIDs
|
||||
) const
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
|
||||
|
||||
points.setSize(Pstream::nProcs());
|
||||
nInternalFaces.setSize(Pstream::nProcs(), 0);
|
||||
faces.setSize(Pstream::nProcs());
|
||||
@ -317,6 +315,8 @@ void Foam::meshToMesh::distributeCells
|
||||
procLocalFaceIDs.setSize(Pstream::nProcs());;
|
||||
|
||||
|
||||
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
|
||||
|
||||
for (const int domain : Pstream::allProcs())
|
||||
{
|
||||
const labelList& sendElems = map.subMap()[domain];
|
||||
|
||||
Reference in New Issue
Block a user