diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C index 0cc795761c8dc5e593473472a017b3ddf47f2f17..743ec98a78ca6ff3e590168e8db89c38a81d7c60 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C @@ -125,12 +125,6 @@ Foam::domainDecomposition::domainDecomposition } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::domainDecomposition::~domainDecomposition() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets) diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.H b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.H index 21b34f22ac8c08384ff42aec4e896793f9e02cf9..03776381a49655095c9d6ae59b2c0fe58a4440a1 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.H +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.H @@ -160,7 +160,7 @@ public: // Constructors //- Construct from IOobjects (for mesh and optional non-standard - // decomposeParDict location) + //- decomposeParDict location) domainDecomposition ( const IOobject& io, @@ -169,7 +169,7 @@ public: //- Destructor - ~domainDecomposition(); + ~domainDecomposition() = default; // Member Functions @@ -204,7 +204,6 @@ public: } // End namespace Foam - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository diff --git a/applications/utilities/parallelProcessing/decomposePar/faMeshDecomposition.C b/applications/utilities/parallelProcessing/decomposePar/faMeshDecomposition.C index 7e391f7d14ca6cb4749aa5d18e9bb984cac4e1f4..68affb4e4eb1e2b123f7480eae3f593d04a6649f 100644 --- a/applications/utilities/parallelProcessing/decomposePar/faMeshDecomposition.C +++ b/applications/utilities/parallelProcessing/decomposePar/faMeshDecomposition.C @@ -34,11 +34,11 @@ License #include "OSspecific.H" #include "Map.H" #include "globalMeshData.H" - +#include "decompositionModel.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void faMeshDecomposition::distributeFaces() +void Foam::faMeshDecomposition::distributeFaces() { Info<< "\nCalculating distribution of faces" << endl; @@ -71,7 +71,7 @@ void faMeshDecomposition::distributeFaces() // located at the end of the faceProcAddressing, cutting it at // i = owner.size() will correctly decompose faMesh faces. // Vanja Skuric, 2016-04-21 - if (decompositionDict_.found("globalFaceZones")) + if (hasGlobalFaceZones_) { labelList faceProcAddressing ( @@ -153,25 +153,30 @@ void faMeshDecomposition::distributeFaces() << " s" << endl; } + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// from components -faMeshDecomposition::faMeshDecomposition(const fvMesh& mesh) +Foam::faMeshDecomposition::faMeshDecomposition +( + const fvMesh& mesh, + const fileName& decompDictFile +) : faMesh(mesh), - decompositionDict_ + decompDictFile_(decompDictFile), + nProcs_ ( - IOobject + decompositionMethod::nDomains ( - "decomposeParDict", - time().system(), - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE + decompositionModel::New + ( + mesh, + decompDictFile + ) ) ), - nProcs_(readInt(decompositionDict_.lookup("numberOfSubdomains"))), distributed_(false), + hasGlobalFaceZones_(false), faceToProc_(nFaces()), procFaceLabels_(nProcs_), procMeshEdgesMap_(nProcs_), @@ -190,22 +195,20 @@ faMeshDecomposition::faMeshDecomposition(const fvMesh& mesh) globallySharedPoints_(0), cyclicParallel_(false) { - if (decompositionDict_.found("distributed")) - { - distributed_ = Switch(decompositionDict_.lookup("distributed")); - } -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + const decompositionModel& model = decompositionModel::New + ( + mesh, + decompDictFile + ); -faMeshDecomposition::~faMeshDecomposition() -{} + model.readIfPresent("distributed", distributed_); + hasGlobalFaceZones_ = model.found("globalFaceZones"); +} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void faMeshDecomposition::decomposeMesh() +void Foam::faMeshDecomposition::decomposeMesh() { // Decide which cell goes to which processor distributeFaces(); @@ -273,7 +276,7 @@ void faMeshDecomposition::decomposeMesh() ) ); - HashTable<label, label, Hash<label> > fvFaceProcAddressingHash; + Map<label> fvFaceProcAddressingHash; { labelIOList fvFaceProcAddressing @@ -323,11 +326,11 @@ void faMeshDecomposition::decomposeMesh() const indirectPrimitivePatch& patch = this->patch(); const Map<label>& map = patch.meshPointMap(); - HashTable<label, edge, Hash<edge> > edgesHash; + EdgeMap<label> edgesHash; label edgeI = -1; - label nIntEdges = patch.nInternalEdges(); + const label nIntEdges = patch.nInternalEdges(); for (label curEdge = 0; curEdge < nIntEdges; curEdge++) { @@ -338,7 +341,7 @@ void faMeshDecomposition::decomposeMesh() { // Include emptyFaPatch - label size = boundary()[patchI].labelList::size(); + const label size = boundary()[patchI].labelList::size(); for(int eI=0; eI<size; eI++) { @@ -428,8 +431,8 @@ void faMeshDecomposition::decomposeMesh() // inside boundaries for the owner processor and try to find // this inter-processor patch. - label ownerProc = faceToProc_[owner[edgeI]]; - label neighbourProc = faceToProc_[neighbour[edgeI]]; + const label ownerProc = faceToProc_[owner[edgeI]]; + const label neighbourProc = faceToProc_[neighbour[edgeI]]; SLList<label>::iterator curInterProcBdrsOwnIter = interProcBoundaries[ownerProc].begin(); @@ -559,7 +562,7 @@ void faMeshDecomposition::decomposeMesh() const labelListList& eF = patch().edgeFaces(); - label size = patches[patchI].labelList::size(); + const label size = patches[patchI].labelList::size(); labelList patchEdgeFaces(size, -1); @@ -1153,7 +1156,7 @@ void faMeshDecomposition::decomposeMesh() } -bool faMeshDecomposition::writeDecomposition() +bool Foam::faMeshDecomposition::writeDecomposition() { Info<< "\nConstructing processor FA meshes" << endl; @@ -1412,3 +1415,6 @@ bool faMeshDecomposition::writeDecomposition() return true; } + + +// ************************************************************************* // diff --git a/applications/utilities/parallelProcessing/decomposePar/faMeshDecomposition.H b/applications/utilities/parallelProcessing/decomposePar/faMeshDecomposition.H index 48aff29ec4cb1701a00aa4f6a2abbf297f4e5eac..db6f36d21ac297830f067116d4fdc23ede89c19a 100644 --- a/applications/utilities/parallelProcessing/decomposePar/faMeshDecomposition.H +++ b/applications/utilities/parallelProcessing/decomposePar/faMeshDecomposition.H @@ -48,10 +48,8 @@ SourceFiles #include "PtrList.H" #include "point.H" -#ifndef namespaceFoam -#define namespaceFoam - using namespace Foam; -#endif +namespace Foam +{ /*---------------------------------------------------------------------------*\ Class faMeshDecomposition Declaration @@ -63,8 +61,8 @@ class faMeshDecomposition { // Private data - //- Mesh decomposition control dictionary - IOdictionary decompositionDict_; + //- Optional non-standard file for decomposeParDict + const fileName decompDictFile_; //- Number of processors in decomposition label nProcs_; @@ -72,6 +70,9 @@ class faMeshDecomposition //- Is the decomposition data to be distributed for each processor bool distributed_; + //- Are globalFaceZones being used + bool hasGlobalFaceZones_; + //- Processor label for each cell labelList faceToProc_; @@ -134,13 +135,17 @@ public: // Constructors - //- Construct from fvMesh - faMeshDecomposition(const fvMesh& mesh); - + //- Construct from fvMesh (for mesh and optional non-standard + //- decomposeParDict location) + faMeshDecomposition + ( + const fvMesh& mesh, + const fileName& decompDictFile = "" + ); - // Destructor - ~faMeshDecomposition(); + //- Destructor + ~faMeshDecomposition() = default; // Member Functions @@ -171,6 +176,10 @@ public: }; +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif