Commit fc2d438c authored by mattijs's avatar mattijs
Browse files

parallel operation

parent ba6f878f
......@@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/
#include "nbrToCell.H"
......@@ -58,22 +56,46 @@ Foam::topoSetSource::addToUsageTable Foam::nbrToCell::usage_
void Foam::nbrToCell::combine(topoSet& set, const bool add) const
{
const cellList& cells = mesh().cells();
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
boolList isCoupled(mesh_.nFaces()-mesh_.nInternalFaces(), false);
forAll(patches, patchI)
{
const polyPatch& pp = patches[patchI];
if (pp.coupled())
{
label faceI = pp.start();
forAll(pp, i)
{
isCoupled[faceI-mesh_.nInternalFaces()] = true;
faceI++;
}
}
}
forAll(cells, cellI)
{
const cell& cll = cells[cellI];
const cell& cFaces = cells[cellI];
label nInternalFaces = 0;
label nNbrCells = 0;
forAll(cll, i)
forAll(cFaces, i)
{
if (mesh().isInternalFace(cll[i]))
label faceI = cFaces[i];
if (mesh_.isInternalFace(faceI))
{
nNbrCells++;
}
else if (isCoupled[faceI-mesh_.nInternalFaces()])
{
nInternalFaces++;
nNbrCells++;
}
}
if (nInternalFaces <= minNbrs_)
if (nNbrCells <= minNbrs_)
{
addOrDelete(set, cellI, add);
}
......
......@@ -27,7 +27,7 @@ Class
Description
A topoSetSource to select cells based on number of neighbouring cells
(i.e. number of internal faces)
(i.e. number of internal or coupled faces)
SourceFiles
nbrToCell.C
......
......@@ -22,14 +22,13 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/
#include "cellToFace.H"
#include "polyMesh.H"
#include "cellSet.H"
#include "Time.H"
#include "syncTools.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......@@ -102,48 +101,58 @@ void Foam::cellToFace::combine(topoSet& set, const bool add) const
{
// Add all faces whose both neighbours are in set.
// Count number of cells using face.
Map<label> numCells(loadedSet.size());
label nInt = mesh_.nInternalFaces();
const labelList& own = mesh_.faceOwner();
const labelList& nei = mesh_.faceNeighbour();
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
for
(
cellSet::const_iterator iter = loadedSet.begin();
iter != loadedSet.end();
++iter
)
// Check all internal faces
for (label faceI = 0; faceI < nInt; faceI++)
{
label cellI = iter.key();
if (loadedSet.found(own[faceI]) && loadedSet.found(nei[faceI]))
{
addOrDelete(set, faceI, add);
}
}
const labelList& cFaces = mesh_.cells()[cellI];
forAll(cFaces, cFaceI)
{
label faceI = cFaces[cFaceI];
// Get coupled cell status
boolList neiInSet(mesh_.nFaces()-nInt, false);
Map<label>::iterator fndFace = numCells.find(faceI);
forAll(patches, patchI)
{
const polyPatch& pp = patches[patchI];
if (fndFace == numCells.end())
{
numCells.insert(faceI, 1);
}
else
if (pp.coupled())
{
label faceI = pp.start();
forAll(pp, i)
{
fndFace()++;
neiInSet[faceI-nInt] = loadedSet.found(own[faceI]);
faceI++;
}
}
}
syncTools::swapBoundaryFaceList(mesh_, neiInSet, false);
// Include faces that are referenced twice
for
(
Map<label>::const_iterator iter = numCells.begin();
iter != numCells.end();
++iter
)
// Check all boundary faces
forAll(patches, patchI)
{
if (iter() == 2)
const polyPatch& pp = patches[patchI];
if (pp.coupled())
{
addOrDelete(set, iter.key(), add);
label faceI = pp.start();
forAll(pp, i)
{
if (loadedSet.found(own[faceI]) && neiInSet[faceI-nInt])
{
addOrDelete(set, faceI, add);
}
faceI++;
}
}
}
}
......
......@@ -30,6 +30,7 @@ Description
Either all faces of cell or some other criterion.
See implementation.
Note: when picking up coupled faces uses cells on neighbouring processors.
SourceFiles
cellToFace.C
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment