BUGFIX: Keep cyclic patches on one processor

This commit is contained in:
Henrik Rusche 2015-08-28 19:09:58 +02:00 committed by Hrvoje Jasak
parent ca2e6524a9
commit 6cb718df57
6 changed files with 89 additions and 0 deletions

View file

@ -369,6 +369,61 @@ void Foam::decompositionMethod::calcCellCells
}
void Foam::decompositionMethod::fixCyclics
(
const polyMesh& mesh,
labelList& decomp
)
{
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
label nFixedCyclics = 0;
// Coupled faces. Only cyclics done.
do
{
nFixedCyclics = 0;
forAll(pbm, patchi)
{
if (isA<cyclicPolyPatch>(pbm[patchi]))
{
const unallocLabelList& faceCells = pbm[patchi].faceCells();
const label sizeby2 = faceCells.size()/2;
for (label facei=0; facei<sizeby2; facei++)
{
const label own = faceCells[facei];
const label nei = faceCells[facei + sizeby2];
if(decomp[own] < decomp[nei])
{
decomp[own] = decomp[nei];
nFixedCyclics++;
}
else if(decomp[own] > decomp[nei])
{
decomp[nei] = decomp[own];
nFixedCyclics++;
}
}
}
}
if(nFixedCyclics > 0)
{
WarningIn
(
"decompositionMethod::fixCyclics"
"(const polyMesh& mesh, labelList& decomp)"
) << "Fixed " << nFixedCyclics << " disconnected cyclic faces";
}
}
while (nFixedCyclics > 0);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::decompositionMethod> Foam::decompositionMethod::New

View file

@ -96,6 +96,12 @@ protected:
labelListList& cellCells
);
static void fixCyclics
(
const polyMesh& mesh,
labelList& decomp
);
private:

View file

@ -116,6 +116,8 @@ Foam::labelList Foam::patchConstrainedDecomp::decompose
}
}
fixCyclics(mesh_, finalDecomp);
return finalDecomp;
}

View file

@ -316,10 +316,14 @@ Foam::labelList Foam::metisDecomp::decompose
// Copy back to labelList
labelList decomp(finalDecomp.size());
forAll(decomp, i)
{
decomp[i] = finalDecomp[i];
}
fixCyclics(mesh_, decomp);
return decomp;
}
@ -374,6 +378,8 @@ Foam::labelList Foam::metisDecomp::decompose
fineDistribution[i] = finalDecomp[fineToCoarse[i]];
}
fixCyclics(mesh_, fineDistribution);
return fineDistribution;
}
@ -417,6 +423,8 @@ Foam::labelList Foam::metisDecomp::decompose
decomp[i] = finalDecomp[i];
}
fixCyclics(mesh_, decomp);
return decomp;
}

View file

@ -595,10 +595,14 @@ Foam::labelList Foam::parMetisDecomp::decompose
// Copy back to labelList
labelList decomp(finalDecomp.size());
forAll(decomp, i)
{
decomp[i] = finalDecomp[i];
}
fixCyclics(mesh_, decomp);
return decomp;
}
@ -738,6 +742,8 @@ Foam::labelList Foam::parMetisDecomp::decompose
cellDistribution[cellI] = regionDecomp[cellToRegion[cellI]];
}
fixCyclics(mesh_, cellDistribution);
return cellDistribution;
}
@ -868,10 +874,14 @@ Foam::labelList Foam::parMetisDecomp::decompose
// Copy back to labelList
labelList decomp(finalDecomp.size());
forAll(decomp, i)
{
decomp[i] = finalDecomp[i];
}
fixCyclics(mesh_, decomp);
return decomp;
}

View file

@ -453,10 +453,14 @@ Foam::labelList Foam::scotchDecomp::decompose
// Copy back to labelList
labelList decomp(finalDecomp.size());
forAll(decomp, i)
{
decomp[i] = finalDecomp[i];
}
fixCyclics(mesh_, decomp);
return decomp;
}
@ -510,6 +514,8 @@ Foam::labelList Foam::scotchDecomp::decompose
fineDistribution[i] = finalDecomp[fineToCoarse[i]];
}
fixCyclics(mesh_, fineDistribution);
return fineDistribution;
}
@ -553,6 +559,8 @@ Foam::labelList Foam::scotchDecomp::decompose
decomp[i] = finalDecomp[i];
}
fixCyclics(mesh_, decomp);
return decomp;
}