BUG: syncTools: swap cell centres as positions

This commit is contained in:
mattijs 2013-03-14 11:25:16 +00:00
parent 41aa6d637c
commit 0c58d7eaf5
4 changed files with 55 additions and 10 deletions

View File

@ -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::scalarField> 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::scalarField> 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)
{

View File

@ -27,6 +27,44 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::syncTools::swapBoundaryCellPositions
(
const polyMesh& mesh,
const UList<point>& cellData,
List<point>& neighbourCellData
)
{
if (cellData.size() != mesh.nCells())
{
FatalErrorIn
(
"syncTools<class T>::swapBoundaryCellPositions"
"(const polyMesh&, const UList<T>&, List<T>&)"
) << "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());

View File

@ -442,18 +442,17 @@ public:
}
//- Swap coupled positions.
template<class T>
static void swapBoundaryFacePositions
(
const polyMesh& mesh,
UList<T>& l
UList<point>& l
)
{
syncBoundaryFaceList
(
mesh,
l,
eqOp<T>(),
eqOp<point>(),
mapDistribute::transformPosition()
);
}
@ -490,6 +489,14 @@ public:
List<T>& neighbourCellData
);
//- Swap to obtain neighbour cell positions for all boundary faces
static void swapBoundaryCellPositions
(
const polyMesh& mesh,
const UList<point>& cellData,
List<point>& neighbourCellData
);
// Sparse versions
//- Synchronize values on selected points.
@ -531,11 +538,11 @@ public:
}
//- Synchronize locations on selected edges.
template<class T, class CombineOp>
template<class CombineOp>
static void syncEdgePositions
(
const polyMesh& mesh,
EdgeMap<T>& l,
EdgeMap<point>& l,
const CombineOp& cop
)
{

View File

@ -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();