ENH: decomposePar: implemented keeping faceSet on single processor

This commit is contained in:
mattijs
2011-11-09 12:34:03 +00:00
parent ccefe8bb90
commit c1ac184893
2 changed files with 15 additions and 31 deletions

View File

@ -24,13 +24,13 @@ numberOfSubdomains 2;
// (makes sense only for cyclic patches) // (makes sense only for cyclic patches)
//preservePatches (cyclic_half0 cyclic_half1); //preservePatches (cyclic_half0 cyclic_half1);
//- Keep all of faceZone on a single processor. This puts all cells //- Keep all of faceSet on a single processor. This puts all cells
// connected with a point, edge or face on the same processor. // connected with a point, edge or face on the same processor.
// (just having face connected cells might not guarantee a balanced // (just having face connected cells might not guarantee a balanced
// decomposition) // decomposition)
// The processor can be -1 (the decompositionMethod chooses the processor // The processor can be -1 (the decompositionMethod chooses the processor
// for a good load balance) or explicitly provided (upsets balance). // for a good load balance) or explicitly provided (upsets balance).
//singleProcessorFaceZones ((f0 -1)); //singleProcessorFaceSets ((f0 -1));
//- Use the volScalarField named here as a weight for each cell in the //- Use the volScalarField named here as a weight for each cell in the

View File

@ -29,6 +29,7 @@ License
#include "cellSet.H" #include "cellSet.H"
#include "regionSplit.H" #include "regionSplit.H"
#include "Tuple2.H" #include "Tuple2.H"
#include "faceSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -110,11 +111,9 @@ void Foam::domainDecomposition::distributeCells()
Map<label> specifiedProcessorFaces; Map<label> specifiedProcessorFaces;
List<Tuple2<word, label> > zNameAndProcs; List<Tuple2<word, label> > zNameAndProcs;
if (decompositionDict_.found("singleProcessorFaceZones")) if (decompositionDict_.found("singleProcessorFaceSets"))
{ {
decompositionDict_.lookup("singleProcessorFaceZones") >> zNameAndProcs; decompositionDict_.lookup("singleProcessorFaceSets") >> zNameAndProcs;
const faceZoneMesh& fZones = faceZones();
label nCells = 0; label nCells = 0;
@ -122,23 +121,12 @@ void Foam::domainDecomposition::distributeCells()
forAll(zNameAndProcs, i) forAll(zNameAndProcs, i)
{ {
Info<< "Keeping all cells connected to faceZone " Info<< "Keeping all cells connected to faceSet "
<< zNameAndProcs[i].first() << zNameAndProcs[i].first()
<< " on processor " << zNameAndProcs[i].second() << endl; << " on processor " << zNameAndProcs[i].second() << endl;
label zoneI = fZones.findZoneID(zNameAndProcs[i].first()); // Read faceSet
faceSet fz(*this, zNameAndProcs[i].first());
if (zoneI == -1)
{
FatalErrorIn("domainDecomposition::distributeCells()")
<< "Unknown singleProcessorFaceZone "
<< zNameAndProcs[i].first()
<< endl << "Valid faceZones are " << fZones.names()
<< exit(FatalError);
}
const faceZone& fz = fZones[zoneI];
nCells += fz.size(); nCells += fz.size();
} }
@ -150,14 +138,13 @@ void Foam::domainDecomposition::distributeCells()
// Fill // Fill
forAll(zNameAndProcs, i) forAll(zNameAndProcs, i)
{ {
label zoneI = fZones.findZoneID(zNameAndProcs[i].first()); faceSet fz(*this, zNameAndProcs[i].first());
const faceZone& fz = fZones[zoneI];
label procI = zNameAndProcs[i].second(); label procI = zNameAndProcs[i].second();
forAll(fz, fzI) forAllConstIter(faceSet, fz, iter)
{ {
label faceI = fz[fzI]; label faceI = iter.key();
specifiedProcessorFaces.insert(faceI, procI); specifiedProcessorFaces.insert(faceI, procI);
} }
@ -333,7 +320,7 @@ void Foam::domainDecomposition::distributeCells()
// For specifiedProcessorFaces rework the cellToProc to enforce // For specifiedProcessorFaces rework the cellToProc to enforce
// all on one processor since we can't guarantee that the input // all on one processor since we can't guarantee that the input
// to regionSplit was a single region. // to regionSplit was a single region.
// E.g. faceZone 'a' with the cells split into two regions // E.g. faceSet 'a' with the cells split into two regions
// by a notch formed by two walls // by a notch formed by two walls
// //
// \ / // \ /
@ -345,12 +332,9 @@ void Foam::domainDecomposition::distributeCells()
// unbalanced. // unbalanced.
if (specifiedProcessorFaces.size()) if (specifiedProcessorFaces.size())
{ {
const faceZoneMesh& fZones = faceZones();
forAll(zNameAndProcs, i) forAll(zNameAndProcs, i)
{ {
label zoneI = fZones.findZoneID(zNameAndProcs[i].first()); faceSet fz(*this, zNameAndProcs[i].first());
const faceZone& fz = fZones[zoneI];
if (fz.size()) if (fz.size())
{ {
@ -362,9 +346,9 @@ void Foam::domainDecomposition::distributeCells()
procI = cellToProc_[faceOwner()[fz[0]]]; procI = cellToProc_[faceOwner()[fz[0]]];
} }
forAll(fz, fzI) forAllConstIter(faceSet, fz, iter)
{ {
label faceI = fz[fzI]; label faceI = iter.key();
cellToProc_[faceOwner()[faceI]] = procI; cellToProc_[faceOwner()[faceI]] = procI;
if (isInternalFace(faceI)) if (isInternalFace(faceI))