diff --git a/src/decompositionMethods/decompositionMethods/decompositionMethod/decompositionMethod.C b/src/decompositionMethods/decompositionMethods/decompositionMethod/decompositionMethod.C index 3a237570f..b0a9aec64 100644 --- a/src/decompositionMethods/decompositionMethods/decompositionMethod/decompositionMethod.C +++ b/src/decompositionMethods/decompositionMethods/decompositionMethod/decompositionMethod.C @@ -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(pbm[patchi])) + { + const unallocLabelList& faceCells = pbm[patchi].faceCells(); + + const label sizeby2 = faceCells.size()/2; + + for (label facei=0; facei 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::New diff --git a/src/decompositionMethods/decompositionMethods/decompositionMethod/decompositionMethod.H b/src/decompositionMethods/decompositionMethods/decompositionMethod/decompositionMethod.H index 4e85f7a0a..0bce3b4ba 100644 --- a/src/decompositionMethods/decompositionMethods/decompositionMethod/decompositionMethod.H +++ b/src/decompositionMethods/decompositionMethods/decompositionMethod/decompositionMethod.H @@ -96,6 +96,12 @@ protected: labelListList& cellCells ); + static void fixCyclics + ( + const polyMesh& mesh, + labelList& decomp + ); + private: diff --git a/src/decompositionMethods/decompositionMethods/patchConstrainedDecomp/patchConstrainedDecomp.C b/src/decompositionMethods/decompositionMethods/patchConstrainedDecomp/patchConstrainedDecomp.C index 5250f9fa3..534a82148 100644 --- a/src/decompositionMethods/decompositionMethods/patchConstrainedDecomp/patchConstrainedDecomp.C +++ b/src/decompositionMethods/decompositionMethods/patchConstrainedDecomp/patchConstrainedDecomp.C @@ -116,6 +116,8 @@ Foam::labelList Foam::patchConstrainedDecomp::decompose } } + fixCyclics(mesh_, finalDecomp); + return finalDecomp; } diff --git a/src/decompositionMethods/metisDecomp/metisDecomp.C b/src/decompositionMethods/metisDecomp/metisDecomp.C index 1d1fc7e98..ab6fd118d 100644 --- a/src/decompositionMethods/metisDecomp/metisDecomp.C +++ b/src/decompositionMethods/metisDecomp/metisDecomp.C @@ -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; } diff --git a/src/decompositionMethods/parMetisDecomp/parMetisDecomp.C b/src/decompositionMethods/parMetisDecomp/parMetisDecomp.C index a4ea23ce0..08f5a0cd3 100644 --- a/src/decompositionMethods/parMetisDecomp/parMetisDecomp.C +++ b/src/decompositionMethods/parMetisDecomp/parMetisDecomp.C @@ -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; } diff --git a/src/decompositionMethods/scotchDecomp/scotchDecomp/scotchDecomp.C b/src/decompositionMethods/scotchDecomp/scotchDecomp/scotchDecomp.C index 7a74d817f..321c1c820 100644 --- a/src/decompositionMethods/scotchDecomp/scotchDecomp/scotchDecomp.C +++ b/src/decompositionMethods/scotchDecomp/scotchDecomp/scotchDecomp.C @@ -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; }