ENH: decompositionMethod: expose cellCells calculation

This commit is contained in:
mattijs
2011-12-08 16:30:36 +00:00
parent d5268bf30c
commit 735dd36124
5 changed files with 56 additions and 112 deletions

View File

@ -96,6 +96,7 @@ Foam::labelList Foam::decompositionMethod::decompose
mesh,
fineToCoarse,
coarsePoints.size(),
true, // use global cell labels
coarseCellCells
);
@ -158,6 +159,7 @@ void Foam::decompositionMethod::calcCellCells
const polyMesh& mesh,
const labelList& agglom,
const label nCoarse,
const bool parallel,
CompactListList<label>& cellCells
)
{
@ -169,7 +171,7 @@ void Foam::decompositionMethod::calcCellCells
// Create global cell numbers
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
globalIndex globalAgglom(nCoarse);
globalIndex globalAgglom(nCoarse, Pstream::msgType(), parallel);
// Get agglomerate owner on other side of coupled faces
@ -181,7 +183,7 @@ void Foam::decompositionMethod::calcCellCells
{
const polyPatch& pp = patches[patchI];
if (pp.coupled())
if (pp.coupled() && (parallel || !isA<processorPolyPatch>(pp)))
{
label faceI = pp.start();
label bFaceI = pp.start() - mesh.nInternalFaces();
@ -203,77 +205,6 @@ void Foam::decompositionMethod::calcCellCells
syncTools::swapBoundaryFaceList(mesh, globalNeighbour);
//// Determine the cellCells (in agglomeration numbering) on coupled faces
//// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
//labelListList globalCellCells(mesh.nFaces()-mesh.nInternalFaces());
//
//// Current set of face neighbours for the current cell
//labelHashSet cCells;
//
//forAll(patches, patchI)
//{
// const polyPatch& pp = patches[patchI];
//
// if (pp.coupled())
// {
// label faceI = pp.start();
// label bFaceI = pp.start() - mesh.nInternalFaces();
//
// forAll(pp, i)
// {
// label cellI = faceOwner[faceI];
// label globalCellI = globalAgglom.toGlobal(agglom[cellI]);
//
// // First check if agglomerated across coupled patches at all
// // so we don't use memory if not needed
// if (globalNeighbour[bFaceI] == globalCellI)
// {
// cCells.clear();
//
// const cell& cFaces = mesh.cells()[cellI];
//
// forAll(cFaces, i)
// {
// if (mesh.isInternalFace(cFaces[i]))
// {
// label otherCellI = faceOwner[cFaces[i]];
// if (otherCellI == cellI)
// {
// otherCellI = faceNeighbour[cFaces[i]];
// }
//
// cCells.insert
// (
// globalAgglom.toGlobal
// (
// agglom[otherCellI]
// )
// );
// }
// }
// globalCellCells[bFaceI] = cCells.toc();
// }
//
// bFaceI++;
// faceI++;
// }
// }
//}
//
//// Get the cell on the other side of coupled patches
//syncTools::syncBoundaryFaceList
//(
// mesh,
// globalCellCells,
// eqOp<labelList>(),
// dummyTransform()
//);
// Count number of faces (internal + coupled)
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -293,7 +224,7 @@ void Foam::decompositionMethod::calcCellCells
{
const polyPatch& pp = patches[patchI];
if (pp.coupled())
if (pp.coupled() && (parallel || !isA<processorPolyPatch>(pp)))
{
label faceI = pp.start();
label bFaceI = pp.start()-mesh.nInternalFaces();
@ -302,18 +233,6 @@ void Foam::decompositionMethod::calcCellCells
{
label own = agglom[faceOwner[faceI]];
//const labelList& cCells = globalCellCells[bFaceI];
//
//forAll(cCells, i)
//{
// label globalNei = cCells[i];
//
// // Allow only processor-local agglomeration
// if (globalAgglom.isLocal(globalNei))
// {
// nFacesPerCell[own]++;
// }
//}
label globalNei = globalNeighbour[bFaceI];
if
(
@ -365,18 +284,6 @@ void Foam::decompositionMethod::calcCellCells
{
label own = agglom[faceOwner[faceI]];
//const labelList& cCells = globalCellCells[bFaceI];
//
//forAll(cCells, i)
//{
// label globalNei = cCells[i];
//
// // Allow only processor-local agglomeration
// if (globalAgglom.isLocal(globalNei))
// {
// m[offsets[own] + nFacesPerCell[own]++] = globalNei;
// }
//}
label globalNei = globalNeighbour[bFaceI];
if
(

View File

@ -57,15 +57,6 @@ protected:
label nProcessors_;
//- Helper: determine (global) cellCells from mesh agglomeration.
static void calcCellCells
(
const polyMesh& mesh,
const labelList& agglom,
const label nCoarse,
CompactListList<label>& cellCells
);
private:
// Private Member Functions
@ -224,6 +215,24 @@ public:
const pointField& cc
);
// Other
//- Helper: determine (local or global) cellCells from mesh
// agglomeration.
// local : connections are in local indices. Coupled across
// cyclics but not processor patches.
// global : connections are in global indices. Coupled across
// cyclics and processor patches.
static void calcCellCells
(
const polyMesh& mesh,
const labelList& agglom,
const label nCoarse,
const bool global,
CompactListList<label>& cellCells
);
};

View File

@ -383,7 +383,7 @@ Foam::labelList Foam::multiLevelDecomp::decompose
)
{
CompactListList<label> cellCells;
calcCellCells(mesh, identity(cc.size()), cc.size(), cellCells);
calcCellCells(mesh, identity(cc.size()), cc.size(), true, cellCells);
labelField finalDecomp(cc.size(), 0);
labelList cellMap(identity(cc.size()));

View File

@ -755,7 +755,14 @@ Foam::labelList Foam::ptscotchDecomp::decompose
CompactListList<label> cellCells;
calcCellCells(mesh, identity(mesh.nCells()), mesh.nCells(), cellCells);
calcCellCells
(
mesh,
identity(mesh.nCells()),
mesh.nCells(),
true,
cellCells
);
// Decompose using default weights
List<int> finalDecomp;
@ -807,7 +814,14 @@ Foam::labelList Foam::ptscotchDecomp::decompose
// adjncy : contains neighbours (= edges in graph)
// xadj(celli) : start of information in adjncy for celli
CompactListList<label> cellCells;
calcCellCells(mesh, agglom, agglomPoints.size(), cellCells);
calcCellCells
(
mesh,
agglom,
agglomPoints.size(),
true,
cellCells
);
// Decompose using weights
List<int> finalDecomp;

View File

@ -589,7 +589,14 @@ Foam::labelList Foam::scotchDecomp::decompose
// Calculate local or global (if Pstream::parRun()) connectivity
CompactListList<label> cellCells;
calcCellCells(mesh, identity(mesh.nCells()), mesh.nCells(), cellCells);
calcCellCells
(
mesh,
identity(mesh.nCells()),
mesh.nCells(),
true,
cellCells
);
// Decompose using default weights
List<int> finalDecomp;
@ -634,7 +641,14 @@ Foam::labelList Foam::scotchDecomp::decompose
// Calculate local or global (if Pstream::parRun()) connectivity
CompactListList<label> cellCells;
calcCellCells(mesh, agglom, agglomPoints.size(), cellCells);
calcCellCells
(
mesh,
agglom,
agglomPoints.size(),
true,
cellCells
);
// Decompose using weights
List<int> finalDecomp;