Commit 45fdd0e5 authored by mattijs's avatar mattijs
Browse files

ENH: use non-blocking comms

parent 27634a04
......@@ -466,40 +466,6 @@ void Foam::FaceCellWave<Type>::transform
}
// Send face info to neighbour.
template <class Type>
void Foam::FaceCellWave<Type>::sendPatchInfo
(
const label neighbour,
const label nFaces,
const labelList& faceLabels,
const List<Type>& faceInfo
) const
{
OPstream toNeighbour(Pstream::blocking, neighbour);
writeFaces(nFaces, faceLabels, faceInfo, toNeighbour);
}
// Receive face info from neighbour
template <class Type>
Foam::label Foam::FaceCellWave<Type>::receivePatchInfo
(
const label neighbour,
labelList& faceLabels,
List<Type>& faceInfo
) const
{
IPstream fromNeighbour(Pstream::blocking, neighbour);
label nFaces = 0;
readFaces(nFaces, faceLabels, faceInfo, fromNeighbour);
return nFaces;
}
// Offset mesh face. Used for transferring from one cyclic half to the other.
template <class Type>
void Foam::FaceCellWave<Type>::offset
......@@ -523,6 +489,8 @@ void Foam::FaceCellWave<Type>::handleProcPatches()
{
// Send all
PstreamBuffers pBufs(Pstream::nonBlocking);
forAll(mesh_.boundaryMesh(), patchI)
{
const polyPatch& patch = mesh_.boundaryMesh()[patchI];
......@@ -564,16 +532,13 @@ void Foam::FaceCellWave<Type>::handleProcPatches()
<< endl;
}
sendPatchInfo
(
procPatch.neighbProcNo(),
nSendFaces,
sendFaces,
sendFacesInfo
);
UOPstream toNeighbour(procPatch.neighbProcNo(), pBufs);
writeFaces(nSendFaces, sendFaces, sendFacesInfo, toNeighbour);
}
}
pBufs.finishedSends();
// Receive all
forAll(mesh_.boundaryMesh(), patchI)
......@@ -586,16 +551,20 @@ void Foam::FaceCellWave<Type>::handleProcPatches()
refCast<const processorPolyPatch>(patch);
// Allocate buffers
label nReceiveFaces;
label nReceiveFaces = 0;
labelList receiveFaces(patch.size());
List<Type> receiveFacesInfo(patch.size());
nReceiveFaces = receivePatchInfo
(
procPatch.neighbProcNo(),
receiveFaces,
receiveFacesInfo
);
{
UIPstream fromNeighbour(procPatch.neighbProcNo(), pBufs);
readFaces
(
nReceiveFaces,
receiveFaces,
receiveFacesInfo,
fromNeighbour
);
}
if (debug)
{
......
......@@ -225,23 +225,6 @@ class FaceCellWave
List<Type>& faceInfo
) const;
//- Send info to neighbour
void sendPatchInfo
(
const label neighbour,
const label nFaces,
const labelList&,
const List<Type>&
) const;
//- Receive info from neighbour. Returns number of faces received.
label receivePatchInfo
(
const label neighbour,
labelList&,
List<Type>&
) const;
//- Offset face labels by constant value
static void offset
(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment