From 625534b40b9167cc4cb00cb6ea9daab04df2d23d Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 22 Nov 2012 09:06:13 +0000 Subject: [PATCH] ENH: synctools: get remote cell data --- .../meshes/polyMesh/syncTools/syncTools.H | 11 ++++- .../polyMesh/syncTools/syncToolsTemplates.C | 41 ++++++++++++++++++- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H b/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H index ebc4ba60c3..3eb6e71388 100644 --- a/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H +++ b/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -481,6 +481,15 @@ public: ); } + //- Swap to obtain neighbour cell values for all boundary faces + template + static void swapBoundaryCellList + ( + const polyMesh& mesh, + const UList& cellData, + List& neighbourCellData + ); + // Sparse versions //- Synchronize values on selected points. diff --git a/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C b/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C index 7db1a14178..4be6afcf2d 100644 --- a/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C +++ b/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -1553,6 +1553,45 @@ void Foam::syncTools::syncFaceList } +template +void Foam::syncTools::swapBoundaryCellList +( + const polyMesh& mesh, + const UList& cellData, + List& neighbourCellData +) +{ + if (cellData.size() != mesh.nCells()) + { + FatalErrorIn + ( + "syncTools::swapBoundaryCellList" + "(const polyMesh&, const UList&, List&)" + ) << "Number of cell values " << cellData.size() + << " is not equal to the number of cells in the mesh " + << mesh.nCells() << abort(FatalError); + } + + const polyBoundaryMesh& patches = mesh.boundaryMesh(); + + label nBnd = mesh.nFaces()-mesh.nInternalFaces(); + + neighbourCellData.setSize(nBnd); + + forAll(patches, patchI) + { + const polyPatch& pp = patches[patchI]; + const labelUList& faceCells = pp.faceCells(); + forAll(faceCells, i) + { + label bFaceI = pp.start()+i-mesh.nInternalFaces(); + neighbourCellData[bFaceI] = cellData[faceCells[i]]; + } + } + syncTools::swapBoundaryFaceList(mesh, neighbourCellData); +} + + template void Foam::syncTools::swapFaceList (