Commit 3787d45c authored by Mark Olesen's avatar Mark Olesen
Browse files

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

- was using system/decomposeParDict and ignoring the command-line
  option.
parent 1eaa024a
......@@ -125,12 +125,6 @@ Foam::domainDecomposition::domainDecomposition
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::domainDecomposition::~domainDecomposition()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
......
......@@ -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
......
......@@ -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;
}
// ************************************************************************* //
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment