Sends/receives parts of mesh+fvfields to neighbouring processors. Used in load balancing. More...
Public Member Functions | |
ClassName ("fvMeshDistribute") | |
fvMeshDistribute (fvMesh &mesh, const scalar mergeTol) | |
Construct from mesh and absolute merge tolerance. More... | |
autoPtr< mapDistributePolyMesh > | distribute (const labelList &dist) |
Send cells to neighbours according to distribution. More... | |
Static Public Member Functions | |
static labelList | countCells (const labelList &) |
Helper function: count cells per processor in wanted distribution. More... | |
static void | printCoupleInfo (const primitiveMesh &, const labelList &, const labelList &, const labelList &, const labelList &) |
Print some info on coupling data. More... | |
template<class GeoField > | |
static void | printFieldInfo (const fvMesh &) |
Print some field info. More... | |
static void | printMeshInfo (const fvMesh &) |
Print some info on mesh. More... | |
static tmp< surfaceScalarField > | generateTestField (const fvMesh &) |
Generate a test field on faces. More... | |
static void | testField (const surfaceScalarField &) |
Check whether field consistent with face orientation. More... | |
Private Member Functions | |
label | findNonEmptyPatch () const |
Find patch to put exposed faces into. More... | |
template<class T , class Mesh > | |
void | saveBoundaryFields (PtrList< FieldField< fvsPatchField, T > > &bflds) const |
Save boundary fields. More... | |
template<class T , class Mesh > | |
void | mapBoundaryFields (const mapPolyMesh &map, const PtrList< FieldField< fvsPatchField, T > > &oldBflds) |
Map boundary fields. More... | |
template<class T > | |
void | saveInternalFields (PtrList< Field< T > > &iflds) const |
Save internal fields of surfaceFields. More... | |
template<class T > | |
void | mapExposedFaces (const mapPolyMesh &map, const PtrList< Field< T > > &oldFlds) |
Set value of patch faces resulting from internal faces. More... | |
template<class GeoField , class PatchFieldType > | |
void | initPatchFields (const typename GeoField::value_type &initVal) |
Init patch fields of certain type. More... | |
template<class GeoField > | |
void | correctBoundaryConditions () |
Call correctBoundaryConditions on fields. More... | |
autoPtr< mapPolyMesh > | deleteProcPatches (const label patchI) |
Delete all processor patches. Move any processor faces into. More... | |
autoPtr< mapPolyMesh > | repatch (const labelList &newPatchID, labelListList &constructFaceMap) |
Repatch the mesh. This is only necessary for the proc. More... | |
autoPtr< mapPolyMesh > | mergeSharedPoints (labelListList &constructPointMap) |
Merge any shared points that are geometrically shared. Needs. More... | |
void | getNeighbourData (const labelList &distribution, labelList &sourceFace, labelList &sourceProc, labelList &sourcePatch, labelList &sourceNewProc) const |
Construct the local environment of all boundary faces. More... | |
autoPtr< mapPolyMesh > | doRemoveCells (const labelList &cellsToRemove, const label oldInternalPatchI) |
Remove cells. Add all exposed faces to patch oldInternalPatchI. More... | |
void | addProcPatches (const labelList &, const labelList &, List< Map< label > > &procPatchID) |
Add processor patches. Changes mesh and returns per neighbour. More... | |
fvMeshDistribute (const fvMeshDistribute &) | |
Disallow default bitwise copy construct. More... | |
void | operator= (const fvMeshDistribute &) |
Disallow default bitwise assignment. More... | |
Static Private Member Functions | |
static void | inplaceRenumberWithFlip (const labelUList &oldToNew, const bool oldToNewHasFlip, const bool lstHasFlip, labelUList &lst) |
static labelList | select (const bool selectEqual, const labelList &values, const label value) |
Find indices with value. More... | |
static void | checkEqualWordList (const string &, const wordList &) |
Check all procs have same names and in exactly same order. More... | |
static wordList | mergeWordList (const wordList &) |
Merge wordlists over all processors. More... | |
static void | subsetBoundaryData (const fvMesh &mesh, const labelList &faceMap, const labelList &cellMap, const labelList &oldDistribution, const labelList &oldFaceOwner, const labelList &oldFaceNeighbour, const label oldInternalFaces, const labelList &sourceFace, const labelList &sourceProc, const labelList &sourcePatch, const labelList &sourceNewProc, labelList &subFace, labelList &subProc, labelList &subPatch, labelList &subNewProc) |
static void | findCouples (const primitiveMesh &, const labelList &sourceFace, const labelList &sourceProc, const labelList &sourcePatch, const label domain, const primitiveMesh &domainMesh, const labelList &domainFace, const labelList &domainProc, const labelList &domainPatch, labelList &masterCoupledFaces, labelList &slaveCoupledFaces) |
Find cells on mesh whose faceID/procID match the neighbour. More... | |
static labelList | mapBoundaryData (const primitiveMesh &mesh, const mapAddedPolyMesh &map, const labelList &boundaryData0, const label nInternalFaces1, const labelList &boundaryData1) |
Map data on boundary faces to new mesh (resulting from adding. More... | |
static labelList | getBoundaryPatch (const labelList &neighbourNewProc, const labelList &referPatchID, const List< Map< label > > &procPatchID) |
Get boundary faces to be repatched. Is -1 or new patchID. More... | |
static void | sendMesh (const label domain, const fvMesh &mesh, const wordList &pointZoneNames, const wordList &facesZoneNames, const wordList &cellZoneNames, const labelList &sourceFace, const labelList &sourceProc, const labelList &sourcePatch, const labelList &sourceNewProc, Ostream &toDomain) |
Send mesh and coupling data. More... | |
template<class GeoField > | |
static void | sendFields (const label domain, const wordList &fieldNames, const fvMeshSubset &, Ostream &toNbr) |
Send subset of fields. More... | |
static autoPtr< fvMesh > | receiveMesh (const label domain, const wordList &pointZoneNames, const wordList &facesZoneNames, const wordList &cellZoneNames, const Time &runTime, labelList &domainSourceFace, labelList &domainSourceProc, labelList &domainSourcePatch, labelList &domainSourceNewProc, Istream &fromNbr) |
Receive mesh. Opposite of sendMesh. More... | |
template<class GeoField > | |
static void | receiveFields (const label domain, const wordList &fieldNames, fvMesh &, PtrList< GeoField > &, const dictionary &fieldDicts) |
Receive fields. Opposite of sendFields. More... | |
Private Attributes | |
fvMesh & | mesh_ |
Underlying fvMesh. More... | |
const scalar | mergeTol_ |
Absolute merging tolerance (constructing meshes gets done using. More... | |
Sends/receives parts of mesh+fvfields to neighbouring processors. Used in load balancing.
Input is per local cell the processor it should move to. Moves meshes and volFields/surfaceFields and returns map which can be used to distribute other.
Notes:
Definition at line 70 of file fvMeshDistribute.H.
|
private |
Disallow default bitwise copy construct.
fvMeshDistribute | ( | fvMesh & | mesh, |
const scalar | mergeTol | ||
) |
Construct from mesh and absolute merge tolerance.
Definition at line 1579 of file fvMeshDistribute.C.
|
staticprivate |
Definition at line 89 of file fvMeshDistribute.C.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, forAll, Foam::inplaceRenumber(), Foam::sign(), and UList::size().
|
staticprivate |
Find indices with value.
Definition at line 163 of file fvMeshDistribute.C.
Check all procs have same names and in exactly same order.
Definition at line 195 of file fvMeshDistribute.C.
References Foam::endl(), Foam::exit(), Foam::FatalError, and FatalErrorInFunction.
|
staticprivate |
Merge wordlists over all processors.
Definition at line 220 of file fvMeshDistribute.C.
References forAll, Pstream::gatherList(), HashSet< Key, Hash >::insert(), UPstream::myProcNo(), UPstream::nProcs(), Pstream::scatterList(), and HashTable< nil, word, string::hash >::toc().
|
private |
Find patch to put exposed faces into.
Definition at line 327 of file fvMeshDistribute.C.
References Foam::abort(), polyPatch::coupled(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, forAll, forAllReverse, patches, and Foam::Pout.
|
private |
Save boundary fields.
Definition at line 61 of file fvMeshDistributeTemplates.C.
References fld(), forAllConstIter(), and HashTable::size().
|
private |
Map boundary fields.
Definition at line 90 of file fvMeshDistributeTemplates.C.
References Foam::abort(), Foam::faceMap(), mapPolyMesh::faceMap(), Foam::FatalError, FatalErrorInFunction, fld(), forAll, forAllIter, mapPolyMesh::oldPatchStarts(), fvsPatchField::patch(), HashTable::size(), and fvPatch::start().
Save internal fields of surfaceFields.
Definition at line 149 of file fvMeshDistributeTemplates.C.
References fld(), forAllConstIter(), and HashTable::size().
|
private |
Set value of patch faces resulting from internal faces.
Definition at line 178 of file fvMeshDistributeTemplates.C.
References Foam::abort(), Foam::faceMap(), mapPolyMesh::faceMap(), Foam::FatalError, FatalErrorInFunction, fld(), mapPolyMesh::flipFaceFlux(), forAll, forAllIter, HashTable::found(), fvsPatchField::patch(), HashTable::size(), and fvPatch::start().
|
private |
Init patch fields of certain type.
Definition at line 239 of file fvMeshDistributeTemplates.C.
References fld(), forAll, and forAllIter.
|
private |
Call correctBoundaryConditions on fields.
Definition at line 268 of file fvMeshDistributeTemplates.C.
References fld(), and forAllIter.
|
private |
Delete all processor patches. Move any processor faces into.
patchI.
Definition at line 495 of file fvMeshDistribute.C.
References polyPatch::boundaryMesh(), Foam::endl(), forAll, Foam::identity(), patchIdentifier::name(), Foam::Pout, fvMeshTools::reorderPatches(), and polyPatch::start().
|
private |
Repatch the mesh. This is only necessary for the proc.
boundary faces. newPatchID is over all boundary faces: -1 or new patchID. constructFaceMap is being adapted for the possible new face position (since proc faces get automatically matched)
Definition at line 567 of file fvMeshDistribute.C.
References Foam::abort(), polyTopoChange::changeMesh(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, Foam::findIndex(), faceZone::flipMap(), forAll, polyTopoChange::setAction(), and faceZone::whichFace().
|
private |
Merge any shared points that are geometrically shared. Needs.
parallel valid mesh - uses globalMeshData. constructPointMap is adapted for the new point labels.
Definition at line 687 of file fvMeshDistribute.C.
References Foam::abort(), polyTopoChange::changeMesh(), Foam::FatalError, FatalErrorInFunction, polyMeshAdder::findSharedPoints(), forAll, polyMeshAdder::mergePoints(), and Foam::returnReduce().
|
private |
Construct the local environment of all boundary faces.
Definition at line 750 of file fvMeshDistribute.C.
References UList::assign(), polyPatch::coupled(), polyPatch::faceCells(), forAll, UPstream::myProcNo(), processorPolyPatch::neighbProcNo(), processorPolyPatch::owner(), cyclicPolyPatch::owner(), patches, List::setSize(), polyPatch::start(), and syncTools::swapBoundaryFaceList().
|
staticprivate |
Definition at line 895 of file fvMeshDistribute.C.
References Foam::faceMap(), polyMesh::faceOwner(), forAll, mesh, UPstream::myProcNo(), primitiveMesh::nFaces(), primitiveMesh::nInternalFaces(), and List::setSize().
|
staticprivate |
Find cells on mesh whose faceID/procID match the neighbour.
cell/proc of domainMesh. Store the matching face.
Definition at line 965 of file fvMeshDistribute.C.
References Foam::endl(), HashTable::find(), forAll, HashTable::insert(), mesh, primitiveMesh::nInternalFaces(), Foam::nl, Foam::Pout, List::setSize(), and List::size().
|
staticprivate |
Map data on boundary faces to new mesh (resulting from adding.
two meshes)
Definition at line 1040 of file fvMeshDistribute.C.
References mapAddedPolyMesh::addedFaceMap(), forAll, mesh, primitiveMesh::nFaces(), primitiveMesh::nInternalFaces(), mapAddedPolyMesh::nOldInternalFaces(), and mapAddedPolyMesh::oldFaceMap().
|
private |
Remove cells. Add all exposed faces to patch oldInternalPatchI.
Definition at line 1079 of file fvMeshDistribute.C.
References polyTopoChange::changeMesh(), removeCells::getExposedFaces(), removeCells::setRefinement(), and List::size().
|
private |
Add processor patches. Changes mesh and returns per neighbour.
proc the processor patchID.
Definition at line 1157 of file fvMeshDistribute.C.
References fvMeshTools::addPatch(), forAll, found, UPstream::myProcNo(), patchIdentifier::name(), Foam::name(), UPstream::nProcs(), Foam::sortedOrder(), and coupledPolyPatch::transform().
|
staticprivate |
Get boundary faces to be repatched. Is -1 or new patchID.
Definition at line 1275 of file fvMeshDistribute.C.
References forAll, and UPstream::myProcNo().
|
staticprivate |
Send mesh and coupling data.
Definition at line 1306 of file fvMeshDistribute.C.
References polyMesh::boundaryMesh(), polyMesh::cellZones(), Foam::endl(), polyMesh::faceNeighbour(), polyMesh::faceOwner(), polyMesh::faces(), polyMesh::faceZones(), ZoneMesh::findZoneID(), forAll, mesh, primitiveMesh::nCells(), primitiveMesh::nFaces(), Foam::nl, primitiveMesh::nPoints(), polyMesh::points(), polyMesh::pointZones(), Foam::Pout, CompactListList::setSize(), List::size(), and PtrList::size().
|
staticprivate |
Send subset of fields.
Definition at line 303 of file fvMeshDistributeTemplates.C.
References fvMeshSubset::baseMesh(), token::BEGIN_BLOCK, token::END_BLOCK, Foam::endl(), Foam::fieldNames(), fld(), forAll, fvMeshSubset::interpolate(), objectRegistry::lookupObject(), token::NL, and Foam::Pout.
|
staticprivate |
Receive mesh. Opposite of sendMesh.
Definition at line 1467 of file fvMeshDistribute.C.
References fvMesh::addFvPatches(), polyMesh::addZones(), polyMesh::boundaryMesh(), polyMesh::cellZones(), polyMesh::defaultRegion, dict, polyMesh::faceZones(), forAll, polyPatch::New(), IOobject::NO_READ, patches, polyMesh::pointZones(), List::size(), PtrList::size(), Time::timeName(), and Foam::xferMove().
|
staticprivate |
Receive fields. Opposite of sendFields.
Definition at line 338 of file fvMeshDistributeTemplates.C.
References IOobject::AUTO_WRITE, Foam::endl(), Foam::fieldNames(), fields, forAll, mesh, IOobject::NO_READ, Foam::Pout, List::size(), dictionary::subDict(), fvMesh::time(), and Time::timeName().
|
private |
Disallow default bitwise assignment.
ClassName | ( | "fvMeshDistribute" | ) |
|
static |
Helper function: count cells per processor in wanted distribution.
Definition at line 1589 of file fvMeshDistribute.C.
References Foam::abort(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, forAll, and UPstream::nProcs().
Referenced by meshRefinement::balance().
Foam::autoPtr< Foam::mapDistributePolyMesh > distribute | ( | const labelList & | dist | ) |
Send cells to neighbours according to distribution.
(for every cell the new proc)
Definition at line 1613 of file fvMeshDistribute.C.
References Foam::abort(), fvMeshAdder::add(), polyMesh::boundaryMesh(), fvMeshSubset::cellMap(), Foam::endl(), fvMeshSubset::faceFlipMap(), Foam::faceMap(), fvMeshSubset::faceMap(), polyMesh::faceOwner(), Foam::FatalError, FatalErrorInFunction, PstreamBuffers::finishedSends(), forAll, forAllConstIter(), Pstream::gatherList(), Foam::identity(), Foam::inplaceRenumber(), Foam::inplaceReorder(), HashSet< Key, Hash >::insert(), mergeSharedPoints(), UPstream::myProcNo(), primitiveMesh::nCells(), primitiveMesh::nFaces(), primitiveMesh::nInternalFaces(), Foam::nl, UPstream::nonBlocking, primitiveMesh::nPoints(), UPstream::nProcs(), UPstream::parRun(), patches, fvMeshSubset::patchMap(), fvMeshSubset::pointMap(), Foam::Pout, Foam::renumber(), HashTable::resize(), Pstream::scatterList(), fvMeshSubset::setLargeCellSubset(), PtrList::size(), dictionary::subDict(), fvMeshSubset::subMesh(), List::transfer(), and List::xfer().
Referenced by meshRefinement::balance(), and redistributeAndWrite().
|
static |
Print some info on coupling data.
Definition at line 300 of file fvMeshDistribute.C.
References Foam::endl(), primitiveMesh::faceCentres(), forAll, mesh, primitiveMesh::nInternalFaces(), Foam::nl, and Foam::Pout.
|
static |
Print some field info.
Definition at line 31 of file fvMeshDistributeTemplates.C.
References Foam::endl(), fld(), forAll, forAllConstIter(), mesh, and Foam::Pout.
|
static |
Print some info on mesh.
Definition at line 240 of file fvMeshDistribute.C.
References fvMesh::boundary(), polyMesh::cellZones(), Foam::endl(), polyMesh::faceZones(), forAll, mesh, patchIdentifier::name(), zone::name(), primitiveMesh::nCells(), primitiveMesh::nFaces(), primitiveMesh::nInternalFaces(), Foam::nl, primitiveMesh::nPoints(), patches, polyMesh::points(), polyMesh::pointZones(), Foam::Pout, List::size(), and polyPatch::start().
|
static |
Generate a test field on faces.
Definition at line 389 of file fvMeshDistribute.C.
References Foam::dimless, fld(), forAll, Foam::mag(), fvMesh::magSf(), mesh, n, IOobject::NO_READ, IOobject::NO_WRITE, fvMesh::Sf(), fvMesh::time(), and Time::timeName().
|
static |
Check whether field consistent with face orientation.
Definition at line 436 of file fvMeshDistribute.C.
References Foam::cos(), Foam::e, Foam::endl(), primitiveMesh::faceCentres(), fld(), forAll, Foam::mag(), fvMesh::magSf(), mesh, n, fvPatch::name(), fvsPatchField::patch(), fvMesh::Sf(), fvPatch::start(), and WarningInFunction.
|
private |
Underlying fvMesh.
Definition at line 75 of file fvMeshDistribute.H.
|
private |
Absolute merging tolerance (constructing meshes gets done using.
geometric matching)
Definition at line 79 of file fvMeshDistribute.H.
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.