BUG: decomposePar -decomposeParDict fails for faMesh (closes #680)

- was using system/decomposeParDict and ignoring the command-line
  option.
This commit is contained in:
Mark Olesen
2017-12-22 12:28:39 +01:00
parent 1eaa024a08
commit 3787d45c12
4 changed files with 60 additions and 52 deletions

View File

@ -125,12 +125,6 @@ Foam::domainDecomposition::domainDecomposition
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::domainDecomposition::~domainDecomposition()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets) bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)

View File

@ -160,7 +160,7 @@ public:
// Constructors // Constructors
//- Construct from IOobjects (for mesh and optional non-standard //- Construct from IOobjects (for mesh and optional non-standard
// decomposeParDict location) //- decomposeParDict location)
domainDecomposition domainDecomposition
( (
const IOobject& io, const IOobject& io,
@ -169,7 +169,7 @@ public:
//- Destructor //- Destructor
~domainDecomposition(); ~domainDecomposition() = default;
// Member Functions // Member Functions
@ -204,7 +204,6 @@ public:
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository #ifdef NoRepository

View File

@ -34,11 +34,11 @@ License
#include "OSspecific.H" #include "OSspecific.H"
#include "Map.H" #include "Map.H"
#include "globalMeshData.H" #include "globalMeshData.H"
#include "decompositionModel.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void faMeshDecomposition::distributeFaces() void Foam::faMeshDecomposition::distributeFaces()
{ {
Info<< "\nCalculating distribution of faces" << endl; Info<< "\nCalculating distribution of faces" << endl;
@ -71,7 +71,7 @@ void faMeshDecomposition::distributeFaces()
// located at the end of the faceProcAddressing, cutting it at // located at the end of the faceProcAddressing, cutting it at
// i = owner.size() will correctly decompose faMesh faces. // i = owner.size() will correctly decompose faMesh faces.
// Vanja Skuric, 2016-04-21 // Vanja Skuric, 2016-04-21
if (decompositionDict_.found("globalFaceZones")) if (hasGlobalFaceZones_)
{ {
labelList faceProcAddressing labelList faceProcAddressing
( (
@ -153,25 +153,30 @@ void faMeshDecomposition::distributeFaces()
<< " s" << endl; << " s" << endl;
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// from components Foam::faMeshDecomposition::faMeshDecomposition
faMeshDecomposition::faMeshDecomposition(const fvMesh& mesh) (
const fvMesh& mesh,
const fileName& decompDictFile
)
: :
faMesh(mesh), faMesh(mesh),
decompositionDict_ decompDictFile_(decompDictFile),
nProcs_
( (
IOobject decompositionMethod::nDomains
( (
"decomposeParDict", decompositionModel::New
time().system(), (
mesh, mesh,
IOobject::MUST_READ, decompDictFile
IOobject::NO_WRITE )
) )
), ),
nProcs_(readInt(decompositionDict_.lookup("numberOfSubdomains"))),
distributed_(false), distributed_(false),
hasGlobalFaceZones_(false),
faceToProc_(nFaces()), faceToProc_(nFaces()),
procFaceLabels_(nProcs_), procFaceLabels_(nProcs_),
procMeshEdgesMap_(nProcs_), procMeshEdgesMap_(nProcs_),
@ -190,22 +195,20 @@ faMeshDecomposition::faMeshDecomposition(const fvMesh& mesh)
globallySharedPoints_(0), globallySharedPoints_(0),
cyclicParallel_(false) cyclicParallel_(false)
{ {
if (decompositionDict_.found("distributed")) const decompositionModel& model = decompositionModel::New
{ (
distributed_ = Switch(decompositionDict_.lookup("distributed")); mesh,
} decompDictFile
);
model.readIfPresent("distributed", distributed_);
hasGlobalFaceZones_ = model.found("globalFaceZones");
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
faMeshDecomposition::~faMeshDecomposition()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void faMeshDecomposition::decomposeMesh() void Foam::faMeshDecomposition::decomposeMesh()
{ {
// Decide which cell goes to which processor // Decide which cell goes to which processor
distributeFaces(); distributeFaces();
@ -273,7 +276,7 @@ void faMeshDecomposition::decomposeMesh()
) )
); );
HashTable<label, label, Hash<label> > fvFaceProcAddressingHash; Map<label> fvFaceProcAddressingHash;
{ {
labelIOList fvFaceProcAddressing labelIOList fvFaceProcAddressing
@ -323,11 +326,11 @@ void faMeshDecomposition::decomposeMesh()
const indirectPrimitivePatch& patch = this->patch(); const indirectPrimitivePatch& patch = this->patch();
const Map<label>& map = patch.meshPointMap(); const Map<label>& map = patch.meshPointMap();
HashTable<label, edge, Hash<edge> > edgesHash; EdgeMap<label> edgesHash;
label edgeI = -1; label edgeI = -1;
label nIntEdges = patch.nInternalEdges(); const label nIntEdges = patch.nInternalEdges();
for (label curEdge = 0; curEdge < nIntEdges; curEdge++) for (label curEdge = 0; curEdge < nIntEdges; curEdge++)
{ {
@ -338,7 +341,7 @@ void faMeshDecomposition::decomposeMesh()
{ {
// Include emptyFaPatch // Include emptyFaPatch
label size = boundary()[patchI].labelList::size(); const label size = boundary()[patchI].labelList::size();
for(int eI=0; eI<size; eI++) for(int eI=0; eI<size; eI++)
{ {
@ -428,8 +431,8 @@ void faMeshDecomposition::decomposeMesh()
// inside boundaries for the owner processor and try to find // inside boundaries for the owner processor and try to find
// this inter-processor patch. // this inter-processor patch.
label ownerProc = faceToProc_[owner[edgeI]]; const label ownerProc = faceToProc_[owner[edgeI]];
label neighbourProc = faceToProc_[neighbour[edgeI]]; const label neighbourProc = faceToProc_[neighbour[edgeI]];
SLList<label>::iterator curInterProcBdrsOwnIter = SLList<label>::iterator curInterProcBdrsOwnIter =
interProcBoundaries[ownerProc].begin(); interProcBoundaries[ownerProc].begin();
@ -559,7 +562,7 @@ void faMeshDecomposition::decomposeMesh()
const labelListList& eF = patch().edgeFaces(); const labelListList& eF = patch().edgeFaces();
label size = patches[patchI].labelList::size(); const label size = patches[patchI].labelList::size();
labelList patchEdgeFaces(size, -1); labelList patchEdgeFaces(size, -1);
@ -1153,7 +1156,7 @@ void faMeshDecomposition::decomposeMesh()
} }
bool faMeshDecomposition::writeDecomposition() bool Foam::faMeshDecomposition::writeDecomposition()
{ {
Info<< "\nConstructing processor FA meshes" << endl; Info<< "\nConstructing processor FA meshes" << endl;
@ -1412,3 +1415,6 @@ bool faMeshDecomposition::writeDecomposition()
return true; return true;
} }
// ************************************************************************* //

View File

@ -48,10 +48,8 @@ SourceFiles
#include "PtrList.H" #include "PtrList.H"
#include "point.H" #include "point.H"
#ifndef namespaceFoam namespace Foam
#define namespaceFoam {
using namespace Foam;
#endif
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class faMeshDecomposition Declaration Class faMeshDecomposition Declaration
@ -63,8 +61,8 @@ class faMeshDecomposition
{ {
// Private data // Private data
//- Mesh decomposition control dictionary //- Optional non-standard file for decomposeParDict
IOdictionary decompositionDict_; const fileName decompDictFile_;
//- Number of processors in decomposition //- Number of processors in decomposition
label nProcs_; label nProcs_;
@ -72,6 +70,9 @@ class faMeshDecomposition
//- Is the decomposition data to be distributed for each processor //- Is the decomposition data to be distributed for each processor
bool distributed_; bool distributed_;
//- Are globalFaceZones being used
bool hasGlobalFaceZones_;
//- Processor label for each cell //- Processor label for each cell
labelList faceToProc_; labelList faceToProc_;
@ -134,13 +135,17 @@ public:
// Constructors // Constructors
//- Construct from fvMesh //- Construct from fvMesh (for mesh and optional non-standard
faMeshDecomposition(const fvMesh& mesh); //- decomposeParDict location)
faMeshDecomposition
(
const fvMesh& mesh,
const fileName& decompDictFile = ""
);
// Destructor //- Destructor
~faMeshDecomposition() = default;
~faMeshDecomposition();
// Member Functions // Member Functions
@ -171,6 +176,10 @@ public:
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif