BUG: decompositionMethod: use local regions
This commit is contained in:
parent
d16c545b3e
commit
1e541a6c73
@ -167,7 +167,7 @@ void Foam::decompositionMethod::calcCellCells
|
|||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const labelList& agglom,
|
const labelList& agglom,
|
||||||
const label nCoarse,
|
const label nLocalCoarse,
|
||||||
const bool parallel,
|
const bool parallel,
|
||||||
CompactListList<label>& cellCells
|
CompactListList<label>& cellCells
|
||||||
)
|
)
|
||||||
@ -182,7 +182,7 @@ void Foam::decompositionMethod::calcCellCells
|
|||||||
|
|
||||||
globalIndex globalAgglom
|
globalIndex globalAgglom
|
||||||
(
|
(
|
||||||
nCoarse,
|
nLocalCoarse,
|
||||||
Pstream::msgType(),
|
Pstream::msgType(),
|
||||||
Pstream::worldComm,
|
Pstream::worldComm,
|
||||||
parallel
|
parallel
|
||||||
@ -224,7 +224,7 @@ void Foam::decompositionMethod::calcCellCells
|
|||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
// Number of faces per coarse cell
|
// Number of faces per coarse cell
|
||||||
labelList nFacesPerCell(nCoarse, 0);
|
labelList nFacesPerCell(nLocalCoarse, 0);
|
||||||
|
|
||||||
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
|
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
|
||||||
{
|
{
|
||||||
@ -374,7 +374,7 @@ void Foam::decompositionMethod::calcCellCells
|
|||||||
// const boolList& blockedFace,
|
// const boolList& blockedFace,
|
||||||
// const List<labelPair>& explicitConnections,
|
// const List<labelPair>& explicitConnections,
|
||||||
// const labelList& agglom,
|
// const labelList& agglom,
|
||||||
// const label nCoarse,
|
// const label nLocalCoarse,
|
||||||
// const bool parallel,
|
// const bool parallel,
|
||||||
// CompactListList<label>& cellCells
|
// CompactListList<label>& cellCells
|
||||||
//)
|
//)
|
||||||
@ -389,7 +389,7 @@ void Foam::decompositionMethod::calcCellCells
|
|||||||
//
|
//
|
||||||
// globalIndex globalAgglom
|
// globalIndex globalAgglom
|
||||||
// (
|
// (
|
||||||
// nCoarse,
|
// nLocalCoarse,
|
||||||
// Pstream::msgType(),
|
// Pstream::msgType(),
|
||||||
// Pstream::worldComm,
|
// Pstream::worldComm,
|
||||||
// parallel
|
// parallel
|
||||||
@ -431,7 +431,7 @@ void Foam::decompositionMethod::calcCellCells
|
|||||||
// // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
//
|
//
|
||||||
// // Number of faces per coarse cell
|
// // Number of faces per coarse cell
|
||||||
// labelList nFacesPerCell(nCoarse, 0);
|
// labelList nFacesPerCell(nLocalCoarse, 0);
|
||||||
//
|
//
|
||||||
// // 1. Internal faces
|
// // 1. Internal faces
|
||||||
// for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
|
// for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
|
||||||
@ -764,6 +764,24 @@ Foam::labelList Foam::decompositionMethod::decompose
|
|||||||
// Any weights specified?
|
// Any weights specified?
|
||||||
label nWeights = returnReduce(cellWeights.size(), sumOp<label>());
|
label nWeights = returnReduce(cellWeights.size(), sumOp<label>());
|
||||||
|
|
||||||
|
if (nWeights > 0 && cellWeights.size() != mesh.nCells())
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"decompositionMethod::decompose\n"
|
||||||
|
"(\n"
|
||||||
|
" const polyMesh&,\n"
|
||||||
|
" const scalarField&,\n"
|
||||||
|
" const boolList&,\n"
|
||||||
|
" const PtrList<labelList>&,\n"
|
||||||
|
" const labelList&,\n"
|
||||||
|
" const List<labelPair>&\n"
|
||||||
|
) << "Number of weights " << cellWeights.size()
|
||||||
|
<< " differs from number of cells " << mesh.nCells()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Any processor sets?
|
// Any processor sets?
|
||||||
label nProcSets = 0;
|
label nProcSets = 0;
|
||||||
forAll(specifiedProcessorFaces, setI)
|
forAll(specifiedProcessorFaces, setI)
|
||||||
@ -828,10 +846,18 @@ Foam::labelList Foam::decompositionMethod::decompose
|
|||||||
<< nProcSets << endl << endl;
|
<< nProcSets << endl << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine global regions, separated by blockedFaces
|
// Determine local regions, separated by blockedFaces
|
||||||
regionSplit globalRegion(mesh, blockedFace, explicitConnections);
|
regionSplit localRegion(mesh, blockedFace, explicitConnections, false);
|
||||||
|
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "Constrained decomposition:" << endl
|
||||||
|
<< " split into " << localRegion.nLocalRegions()
|
||||||
|
<< " regions."
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
// Determine region cell centres
|
// Determine region cell centres
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@ -840,11 +866,11 @@ Foam::labelList Foam::decompositionMethod::decompose
|
|||||||
// somewhere in the middle of the domain which might not be anywhere
|
// somewhere in the middle of the domain which might not be anywhere
|
||||||
// near any of the cells.
|
// near any of the cells.
|
||||||
|
|
||||||
pointField regionCentres(globalRegion.nRegions(), point::max);
|
pointField regionCentres(localRegion.nLocalRegions(), point::max);
|
||||||
|
|
||||||
forAll(globalRegion, cellI)
|
forAll(localRegion, cellI)
|
||||||
{
|
{
|
||||||
label regionI = globalRegion[cellI];
|
label regionI = localRegion[cellI];
|
||||||
|
|
||||||
if (regionCentres[regionI] == point::max)
|
if (regionCentres[regionI] == point::max)
|
||||||
{
|
{
|
||||||
@ -855,22 +881,22 @@ Foam::labelList Foam::decompositionMethod::decompose
|
|||||||
// Do decomposition on agglomeration
|
// Do decomposition on agglomeration
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
scalarField regionWeights(globalRegion.nRegions(), 0);
|
scalarField regionWeights(localRegion.nLocalRegions(), 0);
|
||||||
|
|
||||||
if (nWeights > 0)
|
if (nWeights > 0)
|
||||||
{
|
{
|
||||||
forAll(globalRegion, cellI)
|
forAll(localRegion, cellI)
|
||||||
{
|
{
|
||||||
label regionI = globalRegion[cellI];
|
label regionI = localRegion[cellI];
|
||||||
|
|
||||||
regionWeights[regionI] += cellWeights[cellI];
|
regionWeights[regionI] += cellWeights[cellI];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
forAll(globalRegion, cellI)
|
forAll(localRegion, cellI)
|
||||||
{
|
{
|
||||||
label regionI = globalRegion[cellI];
|
label regionI = localRegion[cellI];
|
||||||
|
|
||||||
regionWeights[regionI] += 1.0;
|
regionWeights[regionI] += 1.0;
|
||||||
}
|
}
|
||||||
@ -879,7 +905,7 @@ Foam::labelList Foam::decompositionMethod::decompose
|
|||||||
finalDecomp = decompose
|
finalDecomp = decompose
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
globalRegion,
|
localRegion,
|
||||||
regionCentres,
|
regionCentres,
|
||||||
regionWeights
|
regionWeights
|
||||||
);
|
);
|
||||||
|
@ -219,7 +219,7 @@ public:
|
|||||||
// Other
|
// Other
|
||||||
|
|
||||||
//- Helper: determine (local or global) cellCells from mesh
|
//- Helper: determine (local or global) cellCells from mesh
|
||||||
// agglomeration.
|
// agglomeration. Agglomeration is local to the processor.
|
||||||
// local : connections are in local indices. Coupled across
|
// local : connections are in local indices. Coupled across
|
||||||
// cyclics but not processor patches.
|
// cyclics but not processor patches.
|
||||||
// global : connections are in global indices. Coupled across
|
// global : connections are in global indices. Coupled across
|
||||||
@ -228,34 +228,11 @@ public:
|
|||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const labelList& agglom,
|
const labelList& agglom,
|
||||||
const label nCoarse,
|
const label nLocalCoarse,
|
||||||
const bool global,
|
const bool global,
|
||||||
CompactListList<label>& cellCells
|
CompactListList<label>& cellCells
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Helper: determine (local or global) cellCells from mesh
|
|
||||||
// agglomeration and additional specification:
|
|
||||||
// - any additional connections between non-coupled internal
|
|
||||||
// or boundary faces.
|
|
||||||
// - any internal or coupled faces (or additional connections)
|
|
||||||
// are blocked
|
|
||||||
//
|
|
||||||
// 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 boolList& blockedFace,
|
|
||||||
// const List<labelPair>& explicitConnections,
|
|
||||||
// const labelList& agglom,
|
|
||||||
// const label nCoarse,
|
|
||||||
// const bool global,
|
|
||||||
// CompactListList<label>& cellCells
|
|
||||||
//);
|
|
||||||
|
|
||||||
|
|
||||||
//- Helper: extract constraints:
|
//- Helper: extract constraints:
|
||||||
// blockedface: existing faces where owner and neighbour on same
|
// blockedface: existing faces where owner and neighbour on same
|
||||||
// proc
|
// proc
|
||||||
|
Loading…
Reference in New Issue
Block a user