Here's the code I just talked about. Reference Information ===================== http://www.openfoam.org/download git://github.com/OpenFOAM/OpenFOAM-2.2.x.git src/meshTools/algorithms/MeshWave/ FaceCellWave.C void Foam::FaceCellWave<Type, TrackingData>::handleProcPatches() Copyright and License ===================== /*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. \*---------------------------------------------------------------------------*/ Example Source Code =================== PstreamBuffers pBufs(Pstream::nonBlocking); // Send all forAll(procPatches, i) { UOPstream toNeighbour(procPatch.neighbProcNo(), pBufs); toNeighbour << SubList<label>(sendFaces, nSendFaces) << SubList<Type>(sendFacesInfo, nSendFaces); } pBufs.finishedSends(); // Receive all forAll(procPatches, i) { UIPstream fromNeighbour(procPatch.neighbProcNo(), pBufs); fromNeighbour >> receiveFaces >> receiveFacesInfo; } Full Function Source Code for Context ===================================== // Tranfer all the information to/from neighbouring processors template<class Type, class TrackingData> void Foam::FaceCellWave<Type, TrackingData>::handleProcPatches() { const globalMeshData& pData = mesh_.globalData(); // Which patches are processor patches const labelList& procPatches = pData.processorPatches(); // Send all PstreamBuffers pBufs(Pstream::nonBlocking); forAll(procPatches, i) { label patchI = procPatches[i]; const processorPolyPatch& procPatch = refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchI]); // Allocate buffers label nSendFaces; labelList sendFaces(procPatch.size()); List<Type> sendFacesInfo(procPatch.size()); // Determine which faces changed on current patch nSendFaces = getChangedPatchFaces ( procPatch, 0, procPatch.size(), sendFaces, sendFacesInfo ); // Adapt wallInfo for leaving domain leaveDomain ( procPatch, nSendFaces, sendFaces, sendFacesInfo ); if (debug) { Pout<< " Processor patch " << patchI << ' ' << procPatch.name() << " communicating with " << procPatch.neighbProcNo() << " Sending:" << nSendFaces << endl; } UOPstream toNeighbour(procPatch.neighbProcNo(), pBufs); //writeFaces(nSendFaces, sendFaces, sendFacesInfo, toNeighbour); toNeighbour << SubList<label>(sendFaces, nSendFaces) << SubList<Type>(sendFacesInfo, nSendFaces); } pBufs.finishedSends(); // Receive all forAll(procPatches, i) { label patchI = procPatches[i]; const processorPolyPatch& procPatch = refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchI]); // Allocate buffers labelList receiveFaces; List<Type> receiveFacesInfo; { UIPstream fromNeighbour(procPatch.neighbProcNo(), pBufs); fromNeighbour >> receiveFaces >> receiveFacesInfo; } if (debug) { Pout<< " Processor patch " << patchI << ' ' << procPatch.name() << " communicating with " << procPatch.neighbProcNo() << " Receiving:" << receiveFaces.size() << endl; } // Apply transform to received data for non-parallel planes if (!procPatch.parallel()) { transform ( procPatch.forwardT(), receiveFaces.size(), receiveFacesInfo ); } // Adapt wallInfo for entering domain enterDomain ( procPatch, receiveFaces.size(), receiveFaces, receiveFacesInfo ); // Merge received info mergeFaceInfo ( procPatch, receiveFaces.size(), receiveFaces, receiveFacesInfo ); } } -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.