ENH: synctools: get remote cell data

This commit is contained in:
mattijs
2012-11-22 09:06:13 +00:00
parent 7159de3281
commit 625534b40b
2 changed files with 50 additions and 2 deletions

View File

@ -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 <class T>
static void swapBoundaryCellList
(
const polyMesh& mesh,
const UList<T>& cellData,
List<T>& neighbourCellData
);
// Sparse versions
//- Synchronize values on selected points.

View File

@ -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 <class T>
void Foam::syncTools::swapBoundaryCellList
(
const polyMesh& mesh,
const UList<T>& cellData,
List<T>& neighbourCellData
)
{
if (cellData.size() != mesh.nCells())
{
FatalErrorIn
(
"syncTools<class T>::swapBoundaryCellList"
"(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::swapBoundaryFaceList(mesh, neighbourCellData);
}
template <unsigned nBits>
void Foam::syncTools::swapFaceList
(