Static Public Member Functions | Static Private Member Functions
polyMeshAdder Class Reference

Adds two meshes without using any polyMesh morphing. More...

Inheritance diagram for polyMeshAdder:
Inheritance graph
[legend]

Static Public Member Functions

static autoPtr< polyMeshadd (const IOobject &io, const polyMesh &mesh0, const polyMesh &mesh1, const faceCoupleInfo &coupleInfo, autoPtr< mapAddedPolyMesh > &mapPtr)
 Add two polyMeshes. Returns new polyMesh and map construct. More...
 
static autoPtr< mapAddedPolyMeshadd (polyMesh &mesh0, const polyMesh &mesh1, const faceCoupleInfo &coupleInfo, const bool validBoundary=true)
 Inplace add mesh to polyMesh. Returns map construct. More...
 
static Map< labelfindSharedPoints (const polyMesh &, const scalar mergeTol)
 Find topologically and geometrically shared points. More...
 
static void mergePoints (const polyMesh &, const Map< label > &pointToMaster, polyTopoChange &meshMod)
 Helper: Merge points. More...
 

Static Private Member Functions

static label patchIndex (const polyPatch &, DynamicList< word > &allPatchNames, DynamicList< word > &allPatchTypes)
 Index of patch in allPatches. Add if nonexisting. More...
 
static label zoneIndex (const word &, DynamicList< word > &)
 Index of zone in all zones. More...
 
static void mergePatchNames (const polyBoundaryMesh &patches0, const polyBoundaryMesh &patches1, DynamicList< word > &allPatchNames, DynamicList< word > &allPatchTypes, labelList &from1ToAllPatches, labelList &fromAllTo1Patches)
 
static labelList getPatchStarts (const polyBoundaryMesh &)
 Get starts of patches. More...
 
static labelList getPatchSizes (const polyBoundaryMesh &)
 Get sizes of patches. More...
 
static List< polyPatch * > combinePatches (const polyMesh &mesh0, const polyMesh &mesh1, const polyBoundaryMesh &allBoundaryMesh, const label nAllPatches, const labelList &fromAllTo1Patches, const label nInternalFaces, const labelList &nFaces, labelList &from0ToAllPatches, labelList &from1ToAllPatches)
 
static labelList getFaceOrder (const cellList &cells, const label nInternalFaces, const labelList &owner, const labelList &neighbour)
 Determine order for internalFaces to be upper-triangular. More...
 
static void insertVertices (const edgeLookup &cutEdgeToPoints, const Map< label > &meshToMaster, const labelList &masterToCutPoints, const face &masterFace, DynamicList< label > &workFace, face &f)
 Extends face f with split points. cutEdgeToPoints gives for every. More...
 
static void mergePrimitives (const polyMesh &mesh0, const polyMesh &mesh1, const faceCoupleInfo &coupleInfo, const label nAllPatches, const labelList &fromAllTo1Patches, const labelList &from1ToAllPatches, pointField &allPoints, labelList &from0ToAllPoints, labelList &from1ToAllPoints, faceList &allFaces, labelList &allOwner, labelList &allNeighbour, label &nInternalFaces, labelList &nFacesPerPatch, label &nCells, labelList &from0ToAllFaces, labelList &from1ToAllFaces, labelList &from1ToAllCells)
 Merges primitives of two meshes. More...
 
static void mergePointZones (const label nAllPoints, const pointZoneMesh &pz0, const pointZoneMesh &pz1, const labelList &from0ToAllPoints, const labelList &from1ToAllPoints, DynamicList< word > &zoneNames, labelList &from1ToAll, List< DynamicList< label > > &pzPoints)
 Merge point zones. More...
 
static void mergeFaceZones (const labelList &allOwner, const polyMesh &mesh0, const polyMesh &mesh1, const labelList &from0ToAllFaces, const labelList &from1ToAllFaces, const labelList &from1ToAllCells, DynamicList< word > &zoneNames, labelList &from1ToAll, List< DynamicList< label > > &fzFaces, List< DynamicList< bool > > &fzFlips)
 Merge face zones. More...
 
static void mergeCellZones (const label nAllCells, const cellZoneMesh &cz0, const cellZoneMesh &cz1, const labelList &from1ToAllCells, DynamicList< word > &zoneNames, labelList &from1ToAll, List< DynamicList< label > > &czCells)
 Merge cell zones. More...
 
static void mergeZones (const label nAllPoints, const labelList &allOwner, const label nAllCells, const polyMesh &mesh0, const polyMesh &mesh1, const labelList &from0ToAllPoints, const labelList &from0ToAllFaces, const labelList &from1ToAllPoints, const labelList &from1ToAllFaces, const labelList &from1ToAllCells, DynamicList< word > &pointZoneNames, List< DynamicList< label > > &pzPoints, DynamicList< word > &faceZoneNames, List< DynamicList< label > > &fzFaces, List< DynamicList< bool > > &fzFlips, DynamicList< word > &cellZoneNames, List< DynamicList< label > > &czCells)
 Merge point/face/cell zone information. More...
 
static void addZones (const DynamicList< word > &pointZoneNames, const List< DynamicList< label > > &pzPoints, const DynamicList< word > &faceZoneNames, const List< DynamicList< label > > &fzFaces, const List< DynamicList< bool > > &fzFlips, const DynamicList< word > &cellZoneNames, const List< DynamicList< label > > &czCells, polyMesh &mesh)
 Create new zones and add to new mesh. More...
 

Detailed Description

Adds two meshes without using any polyMesh morphing.

Gets faces to couple as faceCoupleInfo which is list of faces on both meshes. Returns map from last mesh addition.

Source files

Definition at line 59 of file polyMeshAdder.H.

Member Function Documentation

◆ patchIndex()

Foam::label patchIndex ( const polyPatch p,
DynamicList< word > &  allPatchNames,
DynamicList< word > &  allPatchTypes 
)
staticprivate

Index of patch in allPatches. Add if nonexisting.

Definition at line 43 of file polyMeshAdder.C.

References DynamicList::append(), Foam::endl(), Foam::findIndex(), p, and Foam::Pout.

Here is the call graph for this function:

◆ zoneIndex()

Foam::label zoneIndex ( const word curName,
DynamicList< word > &  names 
)
staticprivate

Index of zone in all zones.

Definition at line 94 of file polyMeshAdder.C.

References DynamicList::append(), and Foam::findIndex().

Here is the call graph for this function:

◆ mergePatchNames()

void mergePatchNames ( const polyBoundaryMesh patches0,
const polyBoundaryMesh patches1,
DynamicList< word > &  allPatchNames,
DynamicList< word > &  allPatchTypes,
labelList from1ToAllPatches,
labelList fromAllTo1Patches 
)
staticprivate

Definition at line 116 of file polyMeshAdder.C.

References DynamicList::append(), forAll, polyBoundaryMesh::names(), List::setSize(), DynamicList::shrink(), PtrList::size(), and polyBoundaryMesh::types().

Here is the call graph for this function:

◆ getPatchStarts()

Foam::labelList getPatchStarts ( const polyBoundaryMesh patches)
staticprivate

Get starts of patches.

Definition at line 165 of file polyMeshAdder.C.

References forAll, and patches.

◆ getPatchSizes()

Foam::labelList getPatchSizes ( const polyBoundaryMesh patches)
staticprivate

Get sizes of patches.

Definition at line 179 of file polyMeshAdder.C.

References forAll, and patches.

◆ combinePatches()

Foam::List< Foam::polyPatch * > combinePatches ( const polyMesh mesh0,
const polyMesh mesh1,
const polyBoundaryMesh allBoundaryMesh,
const label  nAllPatches,
const labelList fromAllTo1Patches,
const label  nInternalFaces,
const labelList nFaces,
labelList from0ToAllPatches,
labelList from1ToAllPatches 
)
staticprivate

Definition at line 193 of file polyMeshAdder.C.

References DynamicList::append(), polyMesh::boundaryMesh(), forAll, List::setSize(), DynamicList::shrink(), and PtrList::size().

Here is the call graph for this function:

◆ getFaceOrder()

Foam::labelList getFaceOrder ( const cellList cells,
const label  nInternalFaces,
const labelList owner,
const labelList neighbour 
)
staticprivate

Determine order for internalFaces to be upper-triangular.

Does not change order of external faces.

Definition at line 311 of file polyMeshAdder.C.

References Foam::abort(), cells, Foam::FatalError, FatalErrorInFunction, forAll, SortableList::indices(), List::size(), and SortableList::sort().

Here is the call graph for this function:

◆ insertVertices()

void insertVertices ( const edgeLookup cutEdgeToPoints,
const Map< label > &  meshToMaster,
const labelList masterToCutPoints,
const face masterFace,
DynamicList< label > &  workFace,
face f 
)
staticprivate

Extends face f with split points. cutEdgeToPoints gives for every.

edge the points introduced inbetween the endpoints.

Definition at line 398 of file polyMeshAdder.C.

References DynamicList::append(), DynamicList::clear(), Foam::constant::electromagnetic::e, HashTable::find(), forAll, forAllReverse, face::nextLabel(), List::size(), and List::transfer().

Here is the call graph for this function:

◆ mergePrimitives()

void mergePrimitives ( const polyMesh mesh0,
const polyMesh mesh1,
const faceCoupleInfo coupleInfo,
const label  nAllPatches,
const labelList fromAllTo1Patches,
const labelList from1ToAllPatches,
pointField allPoints,
labelList from0ToAllPoints,
labelList from1ToAllPoints,
faceList allFaces,
labelList allOwner,
labelList allNeighbour,
label nInternalFaces,
labelList nFacesPerPatch,
label nCells,
labelList from0ToAllFaces,
labelList from1ToAllFaces,
labelList from1ToAllCells 
)
staticprivate

◆ mergePointZones()

void mergePointZones ( const label  nAllPoints,
const pointZoneMesh pz0,
const pointZoneMesh pz1,
const labelList from0ToAllPoints,
const labelList from1ToAllPoints,
DynamicList< word > &  zoneNames,
labelList from1ToAll,
List< DynamicList< label > > &  pzPoints 
)
staticprivate

◆ mergeFaceZones()

void mergeFaceZones ( const labelList allOwner,
const polyMesh mesh0,
const polyMesh mesh1,
const labelList from0ToAllFaces,
const labelList from1ToAllFaces,
const labelList from1ToAllCells,
DynamicList< word > &  zoneNames,
labelList from1ToAll,
List< DynamicList< label > > &  fzFaces,
List< DynamicList< bool > > &  fzFlips 
)
staticprivate

◆ mergeCellZones()

void mergeCellZones ( const label  nAllCells,
const cellZoneMesh cz0,
const cellZoneMesh cz1,
const labelList from1ToAllCells,
DynamicList< word > &  zoneNames,
labelList from1ToAll,
List< DynamicList< label > > &  czCells 
)
staticprivate

Merge cell zones.

Definition at line 1193 of file polyMeshAdder.C.

References List::append(), DynamicList::append(), Foam::findIndex(), forAll, Foam::name(), ZoneMesh::names(), DynamicList::setCapacity(), List::setSize(), DynamicList::shrink(), and Foam::stableSort().

Here is the call graph for this function:

◆ mergeZones()

void mergeZones ( const label  nAllPoints,
const labelList allOwner,
const label  nAllCells,
const polyMesh mesh0,
const polyMesh mesh1,
const labelList from0ToAllPoints,
const labelList from0ToAllFaces,
const labelList from1ToAllPoints,
const labelList from1ToAllFaces,
const labelList from1ToAllCells,
DynamicList< word > &  pointZoneNames,
List< DynamicList< label > > &  pzPoints,
DynamicList< word > &  faceZoneNames,
List< DynamicList< label > > &  fzFaces,
List< DynamicList< bool > > &  fzFlips,
DynamicList< word > &  cellZoneNames,
List< DynamicList< label > > &  czCells 
)
staticprivate

Merge point/face/cell zone information.

Definition at line 1323 of file polyMeshAdder.C.

References polyMesh::cellZones(), and polyMesh::pointZones().

Here is the call graph for this function:

◆ addZones()

void addZones ( const DynamicList< word > &  pointZoneNames,
const List< DynamicList< label > > &  pzPoints,
const DynamicList< word > &  faceZoneNames,
const List< DynamicList< label > > &  fzFaces,
const List< DynamicList< bool > > &  fzFlips,
const DynamicList< word > &  cellZoneNames,
const List< DynamicList< label > > &  czCells,
polyMesh mesh 
)
staticprivate

Create new zones and add to new mesh.

Definition at line 1394 of file polyMeshAdder.C.

References forAll, mesh, and pZones().

Here is the call graph for this function:

◆ add() [1/2]

Foam::autoPtr< Foam::polyMesh > add ( const IOobject io,
const polyMesh mesh0,
const polyMesh mesh1,
const faceCoupleInfo coupleInfo,
autoPtr< mapAddedPolyMesh > &  mapPtr 
)
static

◆ add() [2/2]

Foam::autoPtr< Foam::mapAddedPolyMesh > add ( polyMesh mesh0,
const polyMesh mesh1,
const faceCoupleInfo coupleInfo,
const bool  validBoundary = true 
)
static

◆ findSharedPoints()

Foam::Map< Foam::label > findSharedPoints ( const polyMesh mesh,
const scalar  mergeTol 
)
static

Find topologically and geometrically shared points.

  • should only be called for parallel correct mesh (since uses mesh.globalData)
  • returns Map from point to master point (all in mesh point labels) for any sets of points that need to be merged.

Old: geometric merging. Causes problems for two close shared points.

labelList sharedToMerged; label nUnique = Foam::mergePoints ( pointField ( mesh.points(), sharedPointLabels ), mergeDist, false, sharedToMerged );

Find out which sets of points get merged and create a map from mesh point to unique point.

Map<label> pointToMaster(10*sharedToMerged.size());

if (nUnique < sharedPointLabels.size()) { labelListList mergeSets ( invertOneToMany ( sharedToMerged.size(), sharedToMerged ) );

label nMergeSets = 0;

forAll(mergeSets, setI) { const labelList& mergeSet = mergeSets[setI];

if (mergeSet.size() > 1) { Take as master the shared point with the lowest mesh point label. (rather arbitrarily - could use max or any other one of the points)

nMergeSets++;

label masterI = labelMax;

forAll(mergeSet, i) { label sharedI = mergeSet[i];

masterI = min(masterI, sharedPointLabels[sharedI]); }

forAll(mergeSet, i) { label sharedI = mergeSet[i];

pointToMaster.insert(sharedPointLabels[sharedI], masterI); } } }

if (debug) { Pout<< "polyMeshAdder : merging:" << pointToMaster.size() << " into " << nMergeSets << " sets." << endl; } }

Definition at line 2000 of file polyMeshAdder.C.

References Foam::abort(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, Foam::findIndex(), forAll, forAllConstIter(), Foam::invertOneToMany(), Foam::labelMax, Foam::mergePoints(), mesh, Foam::min(), List::setSize(), and List::size().

Referenced by fvMeshDistribute::mergeSharedPoints(), and mergeSharedPoints().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mergePoints()

void mergePoints ( const polyMesh mesh,
const Map< label > &  pointToMaster,
polyTopoChange meshMod 
)
static

Helper: Merge points.

  • Gets map from point to destination point
  • Removes all points that don't map to themselves
  • Modifies all faces that use the points to be removed.

Definition at line 2212 of file polyMeshAdder.C.

References f(), faceZone::flipMap(), forAll, mesh, polyTopoChange::removePoint(), polyTopoChange::setAction(), and faceZone::whichFace().

Referenced by meshRefinement::mergePoints(), fvMeshDistribute::mergeSharedPoints(), and mergeSharedPoints().

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: