From 0aa0114310b963a901fcb02b1f38e88db3169d24 Mon Sep 17 00:00:00 2001 From: mattijs <mattijs> Date: Tue, 8 Sep 2009 17:39:01 +0100 Subject: [PATCH] preservePatches option still needed for geometric decomposition options --- .../decomposePar/decomposeParDict | 6 ++++ .../decomposePar/distributeCells.C | 29 +++++++++++++++++++ .../decompositionMethod/decompositionMethod.C | 13 +++++++-- 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposeParDict b/applications/utilities/parallelProcessing/decomposePar/decomposeParDict index aad15ee459b..e1620d72014 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposeParDict +++ b/applications/utilities/parallelProcessing/decomposePar/decomposeParDict @@ -22,6 +22,12 @@ numberOfSubdomains 4; //- Keep owner and neighbour on same processor for faces in zones: // preserveFaceZones (heater solid1 solid3); + +//- Keep owner and neighbour on same processor for faces in patches: +// (makes sense only for cyclic patches) +//preservePatches (cyclic_left_right); + + method scotch; // method hierarchical; // method simple; diff --git a/applications/utilities/parallelProcessing/decomposePar/distributeCells.C b/applications/utilities/parallelProcessing/decomposePar/distributeCells.C index af47af244ff..ffd54ac6851 100644 --- a/applications/utilities/parallelProcessing/decomposePar/distributeCells.C +++ b/applications/utilities/parallelProcessing/decomposePar/distributeCells.C @@ -45,6 +45,35 @@ void domainDecomposition::distributeCells() labelHashSet sameProcFaces; + if (decompositionDict_.found("preservePatches")) + { + wordList pNames(decompositionDict_.lookup("preservePatches")); + + Info<< "Keeping owner of faces in patches " << pNames + << " on same processor. This only makes sense for cyclics." << endl; + + const polyBoundaryMesh& patches = boundaryMesh(); + + forAll(pNames, i) + { + label patchI = patches.findPatchID(pNames[i]); + + if (patchI == -1) + { + FatalErrorIn("domainDecomposition::distributeCells()") + << "Unknown preservePatch " << pNames[i] + << endl << "Valid patches are " << patches.names() + << exit(FatalError); + } + + const polyPatch& pp = patches[patchI]; + + forAll(pp, i) + { + sameProcFaces.insert(pp.start() + i); + } + } + } if (decompositionDict_.found("preserveFaceZones")) { wordList zNames(decompositionDict_.lookup("preserveFaceZones")); diff --git a/src/decompositionMethods/decompositionMethods/decompositionMethod/decompositionMethod.C b/src/decompositionMethods/decompositionMethods/decompositionMethod/decompositionMethod.C index c38e0494ae2..d5c98d52b55 100644 --- a/src/decompositionMethods/decompositionMethods/decompositionMethod/decompositionMethod.C +++ b/src/decompositionMethods/decompositionMethods/decompositionMethod/decompositionMethod.C @@ -141,9 +141,18 @@ Foam::labelList Foam::decompositionMethod::decompose const pointField& coarsePoints ) { - scalarField coarseWeights(0); + // Decompose based on agglomerated points + labelList coarseDistribution(decompose(coarsePoints)); + + // Rework back into decomposition for original mesh_ + labelList fineDistribution(fineToCoarse.size()); + + forAll(fineDistribution, i) + { + fineDistribution[i] = coarseDistribution[fineToCoarse[i]]; + } - return decompose(fineToCoarse, coarsePoints, coarseWeights); + return fineDistribution; } -- GitLab