From d7d97f1f367e78d9ad94d881384356fdb603f8b2 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 5 Feb 2010 10:32:47 +0000 Subject: [PATCH] ENH: Removed the -filterPatches option. Option was not used anymore. Cleans up the code a bit. --- .../decomposePar/decomposePar.C | 11 +--- .../decomposePar/domainDecomposition.C | 33 +++++----- .../decomposePar/domainDecomposition.H | 7 +-- .../decomposePar/domainDecompositionMesh.C | 60 +------------------ 4 files changed, 23 insertions(+), 88 deletions(-) diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C index ca246cc78b..ea8ffe9469 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C +++ b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C @@ -46,9 +46,6 @@ Usage @param -fields \n Use existing geometry decomposition and convert fields only. - @param -filterPatches \n - Remove empty patches when decomposing the geometry. - @param -force \n Remove any existing @a processor subdirectories before decomposing the geometry. @@ -99,11 +96,6 @@ int main(int argc, char *argv[]) "use existing geometry decomposition and convert fields only" ); argList::addBoolOption - ( - "filterPatches", - "remove empty patches when decomposing the geometry" - ); - argList::addBoolOption ( "force", "remove existing processor*/ subdirs before decomposing the geometry" @@ -128,7 +120,6 @@ int main(int argc, char *argv[]) bool writeCellDist = args.optionFound("cellDist"); bool copyUniform = args.optionFound("copyUniform"); bool decomposeFieldsOnly = args.optionFound("fields"); - bool filterPatches = args.optionFound("filterPatches"); bool forceOverwrite = args.optionFound("force"); bool ifRequiredDecomposition = args.optionFound("ifRequired"); @@ -249,7 +240,7 @@ int main(int argc, char *argv[]) // Decompose the mesh if (!decomposeFieldsOnly) { - mesh.decomposeMesh(filterPatches); + mesh.decomposeMesh(); mesh.writeDecomposition(); diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C index a286a2facf..c7489886ab 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C @@ -86,7 +86,6 @@ Foam::domainDecomposition::domainDecomposition(const IOobject& io) procPointAddressing_(nProcs_), procFaceAddressing_(nProcs_), procCellAddressing_(nProcs_), - procBoundaryAddressing_(nProcs_), procPatchSize_(nProcs_), procPatchStartIndex_(nProcs_), procNeighbourProcessors_(nProcs_), @@ -279,8 +278,6 @@ bool Foam::domainDecomposition::writeDecomposition() ); // Create processor boundary patches - const labelList& curBoundaryAddressing = procBoundaryAddressing_[procI]; - const labelList& curPatchSizes = procPatchSize_[procI]; const labelList& curPatchStarts = procPatchStartIndex_[procI]; @@ -309,8 +306,7 @@ bool Foam::domainDecomposition::writeDecomposition() { // Get the face labels consistent with the field mapping // (reuse the patch field mappers) - const polyPatch& meshPatch = - meshPatches[curBoundaryAddressing[patchi]]; + const polyPatch& meshPatch = meshPatches[patchi]; fvFieldDecomposer::patchFieldDecomposer patchMapper ( @@ -324,14 +320,13 @@ bool Foam::domainDecomposition::writeDecomposition() ); // Map existing patches - procPatches[nPatches] = - meshPatches[curBoundaryAddressing[patchi]].clone - ( - procMesh.boundaryMesh(), - nPatches, - patchMapper.directAddressing(), - curPatchStarts[patchi] - ).ptr(); + procPatches[nPatches] = meshPatch.clone + ( + procMesh.boundaryMesh(), + nPatches, + patchMapper.directAddressing(), + curPatchStarts[patchi] + ).ptr(); nPatches++; } @@ -678,6 +673,16 @@ bool Foam::domainDecomposition::writeDecomposition() ); cellProcAddressing.write(); + // Write patch map for backwards compatibility. + // (= identity map for original patches, -1 for processor patches) + label nMeshPatches = curPatchSizes.size(); + labelList procBoundaryAddressing(identity(nMeshPatches)); + procBoundaryAddressing.setSize + ( + nMeshPatches+curProcessorPatchSizes.size(), + -1 + ); + labelIOList boundaryProcAddressing ( IOobject @@ -689,7 +694,7 @@ bool Foam::domainDecomposition::writeDecomposition() IOobject::NO_READ, IOobject::NO_WRITE ), - procBoundaryAddressing_[procI] + procBoundaryAddressing ); boundaryProcAddressing.write(); } diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.H b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.H index c8b8d9ac3d..80ad1da239 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.H +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.H @@ -83,9 +83,6 @@ class domainDecomposition //- Labels of cells for each processor labelListList procCellAddressing_; - //- Original patch index for every processor patch - labelListList procBoundaryAddressing_; - //- Sizes for processor mesh patches // Excludes inter-processor boundaries labelListList procPatchSize_; @@ -149,8 +146,8 @@ public: return distributed_; } - //- Decompose mesh. Optionally remove zero-sized patches. - void decomposeMesh(const bool filterEmptyPatches); + //- Decompose mesh. + void decomposeMesh(); //- Write decomposition bool writeDecomposition(); diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecompositionMesh.C b/applications/utilities/parallelProcessing/decomposePar/domainDecompositionMesh.C index 644655f0a7..f54eb62a4a 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecompositionMesh.C +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecompositionMesh.C @@ -40,7 +40,7 @@ Description // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches) +void Foam::domainDecomposition::decomposeMesh() { // Decide which cell goes to which processor distributeCells(); @@ -598,64 +598,6 @@ void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches) } } - Info<< "\nCalculating processor boundary addressing" << endl; - // For every patch of processor boundary, find the index of the original - // patch. Mis-alignment is caused by the fact that patches with zero size - // are omitted. For processor patches, set index to -1. - // At the same time, filter the procPatchSize_ and procPatchStartIndex_ - // lists to exclude zero-size patches - forAll(procPatchSize_, procI) - { - // Make a local copy of old lists - const labelList oldPatchSizes = procPatchSize_[procI]; - - const labelList oldPatchStarts = procPatchStartIndex_[procI]; - - labelList& curPatchSizes = procPatchSize_[procI]; - - labelList& curPatchStarts = procPatchStartIndex_[procI]; - - const labelList& curProcessorPatchSizes = - procProcessorPatchSize_[procI]; - - labelList& curBoundaryAddressing = procBoundaryAddressing_[procI]; - - curBoundaryAddressing.setSize - ( - oldPatchSizes.size() - + curProcessorPatchSizes.size() - ); - - label nPatches = 0; - - forAll(oldPatchSizes, patchi) - { - if (!filterEmptyPatches || oldPatchSizes[patchi] > 0) - { - curBoundaryAddressing[nPatches] = patchi; - - curPatchSizes[nPatches] = oldPatchSizes[patchi]; - - curPatchStarts[nPatches] = oldPatchStarts[patchi]; - - nPatches++; - } - } - - // reset to the size of live patches - curPatchSizes.setSize(nPatches); - curPatchStarts.setSize(nPatches); - - forAll(curProcessorPatchSizes, procPatchI) - { - curBoundaryAddressing[nPatches] = -1; - - nPatches++; - } - - curBoundaryAddressing.setSize(nPatches); - } - Info<< "\nDistributing points to processors" << endl; // For every processor, loop through the list of faces for the processor. // For every face, loop through the list of points and mark the point as