diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshCheck/polyMeshTools.C b/src/OpenFOAM/meshes/polyMesh/polyMeshCheck/polyMeshTools.C index fc0739e79f..55f6a90767 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshCheck/polyMeshTools.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshCheck/polyMeshTools.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -60,7 +60,7 @@ Foam::tmp Foam::polyMeshTools::faceOrthogonality // Coupled faces pointField neighbourCc; - syncTools::swapBoundaryCellList(mesh, cc, neighbourCc); + syncTools::swapBoundaryCellPositions(mesh, cc, neighbourCc); forAll(pbm, patchI) { @@ -123,7 +123,7 @@ Foam::tmp Foam::polyMeshTools::faceSkewness // (i.e. treat as if mirror cell on other side) pointField neighbourCc; - syncTools::swapBoundaryCellList(mesh, cellCtrs, neighbourCc); + syncTools::swapBoundaryCellPositions(mesh, cellCtrs, neighbourCc); forAll(pbm, patchI) { diff --git a/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.C b/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.C index 2d007ad9fa..4326d43f38 100644 --- a/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.C +++ b/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.C @@ -27,6 +27,44 @@ License // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +void Foam::syncTools::swapBoundaryCellPositions +( + const polyMesh& mesh, + const UList& cellData, + List& neighbourCellData +) +{ + if (cellData.size() != mesh.nCells()) + { + FatalErrorIn + ( + "syncTools::swapBoundaryCellPositions" + "(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::swapBoundaryFacePositions(mesh, neighbourCellData); +} + + Foam::PackedBoolList Foam::syncTools::getMasterPoints(const polyMesh& mesh) { PackedBoolList isMasterPoint(mesh.nPoints()); diff --git a/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H b/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H index d089d04f9e..cb1484b3b0 100644 --- a/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H +++ b/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H @@ -442,18 +442,17 @@ public: } //- Swap coupled positions. - template static void swapBoundaryFacePositions ( const polyMesh& mesh, - UList& l + UList& l ) { syncBoundaryFaceList ( mesh, l, - eqOp(), + eqOp(), mapDistribute::transformPosition() ); } @@ -490,6 +489,14 @@ public: List& neighbourCellData ); + //- Swap to obtain neighbour cell positions for all boundary faces + static void swapBoundaryCellPositions + ( + const polyMesh& mesh, + const UList& cellData, + List& neighbourCellData + ); + // Sparse versions //- Synchronize values on selected points. @@ -531,11 +538,11 @@ public: } //- Synchronize locations on selected edges. - template + template static void syncEdgePositions ( const polyMesh& mesh, - EdgeMap& l, + EdgeMap& l, const CombineOp& cop ) { diff --git a/src/meshTools/sets/faceZoneSources/searchableSurfaceToFaceZone/searchableSurfaceToFaceZone.C b/src/meshTools/sets/faceZoneSources/searchableSurfaceToFaceZone/searchableSurfaceToFaceZone.C index b91ec33b82..039e14555f 100644 --- a/src/meshTools/sets/faceZoneSources/searchableSurfaceToFaceZone/searchableSurfaceToFaceZone.C +++ b/src/meshTools/sets/faceZoneSources/searchableSurfaceToFaceZone/searchableSurfaceToFaceZone.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -120,7 +120,7 @@ void Foam::searchableSurfaceToFaceZone::applyToSet // Boundary faces vectorField nbrCellCentres; - syncTools::swapBoundaryCellList(mesh_, cc, nbrCellCentres); + syncTools::swapBoundaryCellPositions(mesh_, cc, nbrCellCentres); const polyBoundaryMesh& pbm = mesh_.boundaryMesh();