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 "OSspecific.H"
#include "Map.H"
#include "globalMeshData.H"
#include "DynamicList.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -52,6 +51,7 @@ Foam::domainDecomposition::domainDecomposition
decompositionDict_(dict),
nProcs_(readInt(decompositionDict_.lookup("numberOfSubdomains"))),
distributed_(false),
gfIndex_(mesh_),
cellToProc_(mesh_.nCells()),
patchNbrCellToProc_(mesh_.boundaryMesh().size()),
procPointAddressing_(nProcs_),
@ -269,8 +269,25 @@ Foam::autoPtr<Foam::fvMesh> Foam::domainDecomposition::processorMesh
if (createPassiveProcPatches)
{
// Creation of passiveProcessor patches requires a global face index
// Get global index
const labelList& globalIndex = gfIndex_.globalLabel();
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] =
new passiveProcessorPolyPatch
(
@ -282,7 +299,8 @@ Foam::autoPtr<Foam::fvMesh> Foam::domainDecomposition::processorMesh
nPatches,
procMesh.boundaryMesh(),
procI,
curNeighbourProcessors[procPatchI]
curNeighbourProcessors[procPatchI],
patchGlobalIndex
);
nPatches++;

View file

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

View file

@ -60,13 +60,25 @@ Foam::passiveProcessorPolyPatch::passiveProcessorPolyPatch
const label index,
const polyBoundaryMesh& bm,
const int myProcNo,
const int neighbProcNo
const int neighbProcNo,
const labelList& globalFaceIndex
)
:
polyPatch(name, size, start, index, bm),
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
@ -79,7 +91,8 @@ Foam::passiveProcessorPolyPatch::passiveProcessorPolyPatch
:
polyPatch(name, dict, index, bm),
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),
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),
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;
os.writeKeyword("neighbProcNo") << neighbProcNo_
<< token::END_STATEMENT << nl;
globalFaceIndex_.writeEntry("globalFaceIndex", os);
}

View file

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