Global face index handling in passive processor patches

This commit is contained in:
Hrvoje Jasak 2018-05-09 12:55:16 +01:00
parent 8878766520
commit 2877964cb6
4 changed files with 58 additions and 9 deletions

View file

@ -32,7 +32,6 @@ License
#include "fvMesh.H" #include "fvMesh.H"
#include "OSspecific.H" #include "OSspecific.H"
#include "Map.H" #include "Map.H"
#include "globalMeshData.H"
#include "DynamicList.H" #include "DynamicList.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -52,6 +51,7 @@ Foam::domainDecomposition::domainDecomposition
decompositionDict_(dict), decompositionDict_(dict),
nProcs_(readInt(decompositionDict_.lookup("numberOfSubdomains"))), nProcs_(readInt(decompositionDict_.lookup("numberOfSubdomains"))),
distributed_(false), distributed_(false),
gfIndex_(mesh_),
cellToProc_(mesh_.nCells()), cellToProc_(mesh_.nCells()),
patchNbrCellToProc_(mesh_.boundaryMesh().size()), patchNbrCellToProc_(mesh_.boundaryMesh().size()),
procPointAddressing_(nProcs_), procPointAddressing_(nProcs_),
@ -269,8 +269,25 @@ Foam::autoPtr<Foam::fvMesh> Foam::domainDecomposition::processorMesh
if (createPassiveProcPatches) if (createPassiveProcPatches)
{ {
// Creation of passiveProcessor patches requires a global face index
// Get global index
const labelList& globalIndex = gfIndex_.globalLabel();
forAll (curProcessorPatchSizes, procPatchI) forAll (curProcessorPatchSizes, procPatchI)
{ {
// Assemble the global face index for all passive processor patch
// faces
labelList patchGlobalIndex(curProcessorPatchSizes[procPatchI]);
const label curPatchStart = curProcessorPatchStarts[procPatchI];
forAll (patchGlobalIndex, fI)
{
patchGlobalIndex[fI] =
globalIndex[mag(curFaceLabels[curPatchStart + fI]) - 1];
}
procPatches[nPatches] = procPatches[nPatches] =
new passiveProcessorPolyPatch new passiveProcessorPolyPatch
( (
@ -282,7 +299,8 @@ Foam::autoPtr<Foam::fvMesh> Foam::domainDecomposition::processorMesh
nPatches, nPatches,
procMesh.boundaryMesh(), procMesh.boundaryMesh(),
procI, procI,
curNeighbourProcessors[procPatchI] curNeighbourProcessors[procPatchI],
patchGlobalIndex
); );
nPatches++; nPatches++;

View file

@ -42,6 +42,7 @@ SourceFiles
#include "SLList.H" #include "SLList.H"
#include "PtrList.H" #include "PtrList.H"
#include "point.H" #include "point.H"
#include "globalProcFaceIndex.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -68,6 +69,9 @@ class domainDecomposition
//- Is the decomposition data to be distributed for each processor //- Is the decomposition data to be distributed for each processor
bool distributed_; bool distributed_;
//- Global face index
globalProcFaceIndex gfIndex_;
//- Processor label for each cell //- Processor label for each cell
labelList cellToProc_; labelList cellToProc_;

View file

@ -60,13 +60,25 @@ Foam::passiveProcessorPolyPatch::passiveProcessorPolyPatch
const label index, const label index,
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const int myProcNo, const int myProcNo,
const int neighbProcNo const int neighbProcNo,
const labelList& globalFaceIndex
) )
: :
polyPatch(name, size, start, index, bm), polyPatch(name, size, start, index, bm),
myProcNo_(myProcNo), myProcNo_(myProcNo),
neighbProcNo_(neighbProcNo) neighbProcNo_(neighbProcNo),
{} globalFaceIndex_(globalFaceIndex)
{
if (globalFaceIndex.size() != size)
{
FatalErrorIn
(
"passiveProcessorPolyPatch::passiveProcessorPolyPatch(...)"
) << "Bad global index list. Patch size: " << this->size()
<< " global index size: " << globalFaceIndex.size()
<< abort(FatalError);
}
}
Foam::passiveProcessorPolyPatch::passiveProcessorPolyPatch Foam::passiveProcessorPolyPatch::passiveProcessorPolyPatch
@ -79,7 +91,8 @@ Foam::passiveProcessorPolyPatch::passiveProcessorPolyPatch
: :
polyPatch(name, dict, index, bm), polyPatch(name, dict, index, bm),
myProcNo_(readLabel(dict.lookup("myProcNo"))), myProcNo_(readLabel(dict.lookup("myProcNo"))),
neighbProcNo_(readLabel(dict.lookup("neighbProcNo"))) neighbProcNo_(readLabel(dict.lookup("neighbProcNo"))),
globalFaceIndex_(dict.lookup("globalFaceIndex"))
{} {}
@ -91,7 +104,8 @@ Foam::passiveProcessorPolyPatch::passiveProcessorPolyPatch
: :
polyPatch(pp, bm), polyPatch(pp, bm),
myProcNo_(pp.myProcNo_), myProcNo_(pp.myProcNo_),
neighbProcNo_(pp.neighbProcNo_) neighbProcNo_(pp.neighbProcNo_),
globalFaceIndex_(pp.size(), -1)
{} {}
@ -106,7 +120,8 @@ Foam::passiveProcessorPolyPatch::passiveProcessorPolyPatch
: :
polyPatch(pp, bm, index, newSize, newStart), polyPatch(pp, bm, index, newSize, newStart),
myProcNo_(pp.myProcNo_), myProcNo_(pp.myProcNo_),
neighbProcNo_(pp.neighbProcNo_) neighbProcNo_(pp.neighbProcNo_),
globalFaceIndex_(newSize, -1) // Cannot set global index. HJ, 4/May/2018
{} {}
@ -125,6 +140,8 @@ void Foam::passiveProcessorPolyPatch::write(Ostream& os) const
<< token::END_STATEMENT << nl; << token::END_STATEMENT << nl;
os.writeKeyword("neighbProcNo") << neighbProcNo_ os.writeKeyword("neighbProcNo") << neighbProcNo_
<< token::END_STATEMENT << nl; << token::END_STATEMENT << nl;
globalFaceIndex_.writeEntry("globalFaceIndex", os);
} }

View file

@ -65,6 +65,9 @@ class passiveProcessorPolyPatch
//- Neighbour processor number //- Neighbour processor number
int neighbProcNo_; int neighbProcNo_;
//- Global processor face index
labelList globalFaceIndex_;
public: public:
@ -83,7 +86,8 @@ public:
const label index, const label index,
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const int myProcNo, const int myProcNo,
const int neighbProcNo const int neighbProcNo,
const labelList& globalFaceIndex
); );
//- Construct from dictionary //- Construct from dictionary
@ -161,6 +165,12 @@ public:
return neighbProcNo_; return neighbProcNo_;
} }
//- Return global processor face index
const labelList& globalFaceIndex() const
{
return globalFaceIndex_;
}
//- Write the polyPatch data as a dictionary //- Write the polyPatch data as a dictionary
virtual void write(Ostream&) const; virtual void write(Ostream&) const;
}; };