mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: decompositionMethod: expose cellCells calculation
This commit is contained in:
@ -96,6 +96,7 @@ Foam::labelList Foam::decompositionMethod::decompose
|
|||||||
mesh,
|
mesh,
|
||||||
fineToCoarse,
|
fineToCoarse,
|
||||||
coarsePoints.size(),
|
coarsePoints.size(),
|
||||||
|
true, // use global cell labels
|
||||||
coarseCellCells
|
coarseCellCells
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -158,6 +159,7 @@ void Foam::decompositionMethod::calcCellCells
|
|||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const labelList& agglom,
|
const labelList& agglom,
|
||||||
const label nCoarse,
|
const label nCoarse,
|
||||||
|
const bool parallel,
|
||||||
CompactListList<label>& cellCells
|
CompactListList<label>& cellCells
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -169,7 +171,7 @@ void Foam::decompositionMethod::calcCellCells
|
|||||||
// Create global cell numbers
|
// Create global cell numbers
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
globalIndex globalAgglom(nCoarse);
|
globalIndex globalAgglom(nCoarse, Pstream::msgType(), parallel);
|
||||||
|
|
||||||
|
|
||||||
// Get agglomerate owner on other side of coupled faces
|
// Get agglomerate owner on other side of coupled faces
|
||||||
@ -181,7 +183,7 @@ void Foam::decompositionMethod::calcCellCells
|
|||||||
{
|
{
|
||||||
const polyPatch& pp = patches[patchI];
|
const polyPatch& pp = patches[patchI];
|
||||||
|
|
||||||
if (pp.coupled())
|
if (pp.coupled() && (parallel || !isA<processorPolyPatch>(pp)))
|
||||||
{
|
{
|
||||||
label faceI = pp.start();
|
label faceI = pp.start();
|
||||||
label bFaceI = pp.start() - mesh.nInternalFaces();
|
label bFaceI = pp.start() - mesh.nInternalFaces();
|
||||||
@ -203,77 +205,6 @@ void Foam::decompositionMethod::calcCellCells
|
|||||||
syncTools::swapBoundaryFaceList(mesh, globalNeighbour);
|
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)
|
// Count number of faces (internal + coupled)
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@ -293,7 +224,7 @@ void Foam::decompositionMethod::calcCellCells
|
|||||||
{
|
{
|
||||||
const polyPatch& pp = patches[patchI];
|
const polyPatch& pp = patches[patchI];
|
||||||
|
|
||||||
if (pp.coupled())
|
if (pp.coupled() && (parallel || !isA<processorPolyPatch>(pp)))
|
||||||
{
|
{
|
||||||
label faceI = pp.start();
|
label faceI = pp.start();
|
||||||
label bFaceI = pp.start()-mesh.nInternalFaces();
|
label bFaceI = pp.start()-mesh.nInternalFaces();
|
||||||
@ -302,18 +233,6 @@ void Foam::decompositionMethod::calcCellCells
|
|||||||
{
|
{
|
||||||
label own = agglom[faceOwner[faceI]];
|
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];
|
label globalNei = globalNeighbour[bFaceI];
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
@ -365,18 +284,6 @@ void Foam::decompositionMethod::calcCellCells
|
|||||||
{
|
{
|
||||||
label own = agglom[faceOwner[faceI]];
|
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];
|
label globalNei = globalNeighbour[bFaceI];
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
|
|||||||
@ -57,15 +57,6 @@ protected:
|
|||||||
label nProcessors_;
|
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:
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
@ -224,6 +215,24 @@ public:
|
|||||||
const pointField& cc
|
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
|
||||||
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -383,7 +383,7 @@ Foam::labelList Foam::multiLevelDecomp::decompose
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
CompactListList<label> cellCells;
|
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);
|
labelField finalDecomp(cc.size(), 0);
|
||||||
labelList cellMap(identity(cc.size()));
|
labelList cellMap(identity(cc.size()));
|
||||||
|
|||||||
@ -755,7 +755,14 @@ Foam::labelList Foam::ptscotchDecomp::decompose
|
|||||||
|
|
||||||
|
|
||||||
CompactListList<label> cellCells;
|
CompactListList<label> cellCells;
|
||||||
calcCellCells(mesh, identity(mesh.nCells()), mesh.nCells(), cellCells);
|
calcCellCells
|
||||||
|
(
|
||||||
|
mesh,
|
||||||
|
identity(mesh.nCells()),
|
||||||
|
mesh.nCells(),
|
||||||
|
true,
|
||||||
|
cellCells
|
||||||
|
);
|
||||||
|
|
||||||
// Decompose using default weights
|
// Decompose using default weights
|
||||||
List<int> finalDecomp;
|
List<int> finalDecomp;
|
||||||
@ -807,7 +814,14 @@ Foam::labelList Foam::ptscotchDecomp::decompose
|
|||||||
// adjncy : contains neighbours (= edges in graph)
|
// adjncy : contains neighbours (= edges in graph)
|
||||||
// xadj(celli) : start of information in adjncy for celli
|
// xadj(celli) : start of information in adjncy for celli
|
||||||
CompactListList<label> cellCells;
|
CompactListList<label> cellCells;
|
||||||
calcCellCells(mesh, agglom, agglomPoints.size(), cellCells);
|
calcCellCells
|
||||||
|
(
|
||||||
|
mesh,
|
||||||
|
agglom,
|
||||||
|
agglomPoints.size(),
|
||||||
|
true,
|
||||||
|
cellCells
|
||||||
|
);
|
||||||
|
|
||||||
// Decompose using weights
|
// Decompose using weights
|
||||||
List<int> finalDecomp;
|
List<int> finalDecomp;
|
||||||
|
|||||||
@ -589,7 +589,14 @@ Foam::labelList Foam::scotchDecomp::decompose
|
|||||||
|
|
||||||
// Calculate local or global (if Pstream::parRun()) connectivity
|
// Calculate local or global (if Pstream::parRun()) connectivity
|
||||||
CompactListList<label> cellCells;
|
CompactListList<label> cellCells;
|
||||||
calcCellCells(mesh, identity(mesh.nCells()), mesh.nCells(), cellCells);
|
calcCellCells
|
||||||
|
(
|
||||||
|
mesh,
|
||||||
|
identity(mesh.nCells()),
|
||||||
|
mesh.nCells(),
|
||||||
|
true,
|
||||||
|
cellCells
|
||||||
|
);
|
||||||
|
|
||||||
// Decompose using default weights
|
// Decompose using default weights
|
||||||
List<int> finalDecomp;
|
List<int> finalDecomp;
|
||||||
@ -634,7 +641,14 @@ Foam::labelList Foam::scotchDecomp::decompose
|
|||||||
|
|
||||||
// Calculate local or global (if Pstream::parRun()) connectivity
|
// Calculate local or global (if Pstream::parRun()) connectivity
|
||||||
CompactListList<label> cellCells;
|
CompactListList<label> cellCells;
|
||||||
calcCellCells(mesh, agglom, agglomPoints.size(), cellCells);
|
calcCellCells
|
||||||
|
(
|
||||||
|
mesh,
|
||||||
|
agglom,
|
||||||
|
agglomPoints.size(),
|
||||||
|
true,
|
||||||
|
cellCells
|
||||||
|
);
|
||||||
|
|
||||||
// Decompose using weights
|
// Decompose using weights
|
||||||
List<int> finalDecomp;
|
List<int> finalDecomp;
|
||||||
|
|||||||
Reference in New Issue
Block a user