polyTopoChange Class Reference

Direct mesh changes based on v1.3 polyTopoChange syntax. More...

Public Member Functions

 ClassName ("polyTopoChange")
 Runtime type information. More...
 
 polyTopoChange (const label nPatches, const bool strict=true)
 
 polyTopoChange (const polyMesh &mesh, const bool strict=true)
 Construct from mesh. Adds all points/face/cells from mesh. More...
 
const DynamicList< point > & points () const
 Points. Shrunk after constructing mesh (or calling of compact()) More...
 
const DynamicList< face > & faces () const
 
const DynamicList< label > & region () const
 
const DynamicList< label > & faceOwner () const
 
const DynamicList< label > & faceNeighbour () const
 
bool pointRemoved (const label pointi) const
 
bool faceRemoved (const label facei) const
 
bool cellRemoved (const label celli) const
 
void clear ()
 Clear all storage. More...
 
void addMesh (const polyMesh &mesh, const labelUList &patchMap, const labelUList &pointZoneMap, const labelUList &faceZoneMap, const labelUList &cellZoneMap)
 
void setCapacity (const label nPoints, const label nFaces, const label nCells)
 
void movePoints (const pointField &newPoints)
 Move all points. Incompatible with other topology changes. More...
 
label setAction (const topoAction &action)
 For compatibility with polyTopoChange: set topological action. More...
 
label addPoint (const point &pt, const label masterPointID, const label zoneID, const bool inCell)
 Add point. Return new point label. More...
 
void modifyPoint (const label pointi, const point &pt, const label zoneID, const bool inCell)
 Modify coordinate. More...
 
void removePoint (const label pointi, const label mergePointi)
 Remove/merge point. More...
 
label addFace (const face &f, const label own, const label nei, const label masterPointID, const label masterEdgeID, const label masterFaceID, const bool flipFaceFlux, const label patchID, const label zoneID, const bool zoneFlip)
 Add face to cells. Return new face label. More...
 
void modifyFace (const face &f, const label facei, const label own, const label nei, const bool flipFaceFlux, const label patchID, const label zoneID, const bool zoneFlip)
 Modify vertices or cell of face. More...
 
void removeFace (const label facei, const label mergeFacei)
 Remove/merge face. More...
 
label addCell (const label masterPointID, const label masterEdgeID, const label masterFaceID, const label masterCellID, const label zoneID)
 Add cell. Return new cell label. More...
 
void modifyCell (const label celli, const label zoneID)
 Modify zone of cell. More...
 
void removeCell (const label celli, const label mergeCelli)
 Remove/merge cell. More...
 
void setNumPatches (const label nPatches)
 
autoPtr< mapPolyMeshchangeMesh (polyMesh &mesh, const labelUList &patchMap, const bool inflate, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
 Inplace changes mesh without change of patches. More...
 
autoPtr< mapPolyMeshchangeMesh (polyMesh &mesh, const bool inflate, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
 Without patch mapping. More...
 
template<class Type >
autoPtr< mapPolyMeshmakeMesh (autoPtr< Type > &newMesh, const IOobject &io, const polyMesh &mesh, const labelUList &patchMap, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
 Create new mesh with old mesh patches. Additional dictionaries. More...
 
template<class Type >
autoPtr< mapPolyMeshmakeMesh (autoPtr< Type > &newMesh, const IOobject &io, const polyMesh &mesh, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
 Create new mesh with old mesh patches. Additional dictionaries. More...
 
template<class Type >
Foam::autoPtr< Foam::mapPolyMeshmakeMesh (autoPtr< Type > &newMeshPtr, const IOobject &io, const polyMesh &mesh, const labelUList &patchMap, const bool syncParallel, const bool orderCells, const bool orderPoints)
 
template<class Type >
Foam::autoPtr< Foam::mapPolyMeshmakeMesh (autoPtr< Type > &newMeshPtr, const IOobject &io, const polyMesh &mesh, const bool syncParallel, const bool orderCells, const bool orderPoints)
 

Detailed Description

Direct mesh changes based on v1.3 polyTopoChange syntax.

Instead of recording changes and executing them all in one go (as did v1.3 polyTopoChange) this class actually holds the current points/faces/cells and does the change immediately. It can be asked to compress out all unused points/faces/cells and renumber everything to be consistent.

Note:

  • polyTopoChange can be copied.
  • adding a face using non-existing cells causes all intermediate cells to be added. So always first add cells/points and then faces. (or set strict checking)
  • strict checking:
    • any added/modified face can only use already existing vertices
    • any added face can only use already existing cells
    • no item can be removed more than once.
  • removed cell: cell set to 0 faces.
  • removed face: face set to 0 vertices.
  • removed point: coordinate set to vector::max (VGREAT,VGREAT,VGREAT). Note that this might give problems if this value is used already. To see if point is equal to above value we don't use == (which might give problems with roundoff error) but instead compare the individual component with >.
  • coupled patches: the reorderCoupledFaces routine (borrowed from the couplePatches utility) reorders coupled patch faces and uses the cyclicPolyPatch,processorPolyPatch functionality.
Source files

Definition at line 99 of file polyTopoChange.H.

Constructor & Destructor Documentation

◆ polyTopoChange() [1/2]

polyTopoChange ( const label  nPatches,
const bool  strict = true 
)

Construct without mesh. Either specify nPatches or use setNumPatches before trying to make a mesh (makeMesh, changeMesh)

Definition at line 2137 of file polyTopoChange.C.

◆ polyTopoChange() [2/2]

polyTopoChange ( const polyMesh mesh,
const bool  strict = true 
)

Construct from mesh. Adds all points/face/cells from mesh.

Definition at line 2169 of file polyTopoChange.C.

References polyMesh::boundaryMesh(), polyMesh::cellZones(), polyMesh::faceZones(), Foam::identity(), mesh, and polyMesh::pointZones().

Here is the call graph for this function:

Member Function Documentation

◆ ClassName()

ClassName ( "polyTopoChange"  )

Runtime type information.

◆ points()

const DynamicList<point>& points ( ) const
inline

Points. Shrunk after constructing mesh (or calling of compact())

Definition at line 450 of file polyTopoChange.H.

Referenced by duplicatePoints::setRefinement(), addPatchCellLayer::setRefinement(), cyclicAMIPolyPatch::setTopology(), and meshRefinement::splitFacesUndo().

Here is the caller graph for this function:

◆ faces()

const DynamicList<face>& faces ( ) const
inline

Definition at line 455 of file polyTopoChange.H.

Referenced by meshRefinement::splitFacesUndo().

Here is the caller graph for this function:

◆ region()

const DynamicList<label>& region ( ) const
inline

Definition at line 460 of file polyTopoChange.H.

◆ faceOwner()

const DynamicList<label>& faceOwner ( ) const
inline

Definition at line 465 of file polyTopoChange.H.

◆ faceNeighbour()

const DynamicList<label>& faceNeighbour ( ) const
inline

Definition at line 470 of file polyTopoChange.H.

◆ pointRemoved()

bool pointRemoved ( const label  pointi) const
inline

Is point removed? Considered removed if point is GREAT.

Definition at line 32 of file polyTopoChangeI.H.

References VectorSpace< Vector< scalar >, scalar, 3 >::max, Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().

Here is the call graph for this function:

◆ faceRemoved()

bool faceRemoved ( const label  facei) const
inline

Is face removed? Considered removed if face is empty

Definition at line 43 of file polyTopoChangeI.H.

◆ cellRemoved()

bool cellRemoved ( const label  celli) const
inline

Is cell removed? Considered removed if the cellMap is -2

Definition at line 49 of file polyTopoChangeI.H.

◆ clear()

void clear ( )

Clear all storage.

Definition at line 2213 of file polyTopoChange.C.

◆ addMesh()

void addMesh ( const polyMesh mesh,
const labelUList patchMap,
const labelUList pointZoneMap,
const labelUList faceZoneMap,
const labelUList cellZoneMap 
)

◆ setCapacity()

void setCapacity ( const label  nPoints,
const label  nFaces,
const label  nCells 
)

Explicitly pre-size the dynamic storage for expected mesh size for if construct-without-mesh

Definition at line 2449 of file polyTopoChange.C.

References nPoints.

Referenced by fvMeshAdder::add(), and meshRefinement::splitFacesUndo().

Here is the caller graph for this function:

◆ movePoints()

void movePoints ( const pointField newPoints)

Move all points. Incompatible with other topology changes.

Definition at line 2680 of file polyTopoChange.C.

References Foam::abort(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, and forAll.

Referenced by dynamicMotionSolverFvMeshAMI::update().

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

◆ setAction()

Foam::label setAction ( const topoAction action)

For compatibility with polyTopoChange: set topological action.

Definition at line 2481 of file polyTopoChange.C.

References Foam::abort(), polyRemoveCell::cellID(), polyModifyCell::cellID(), polyRemoveFace::faceID(), polyModifyFace::faceID(), Foam::FatalError, FatalErrorInFunction, polyModifyFace::flipFaceFlux(), polyAddFace::flipFaceFlux(), polyModifyPoint::inCell(), polyAddPoint::inCell(), polyAddCell::masterCellID(), polyAddCell::masterEdgeID(), polyAddFace::masterEdgeID(), polyAddCell::masterFaceID(), polyAddFace::masterFaceID(), polyAddPoint::masterPointID(), polyAddCell::masterPointID(), polyAddFace::masterPointID(), polyRemoveCell::mergeCellID(), polyRemoveFace::mergeFaceID(), polyRemovePoint::mergePointID(), polyModifyFace::neighbour(), polyAddFace::neighbour(), polyModifyFace::newFace(), polyAddFace::newFace(), polyAddPoint::newPoint(), polyModifyPoint::newPoint(), polyModifyFace::owner(), polyAddFace::owner(), polyModifyFace::patchID(), polyAddFace::patchID(), polyRemovePoint::pointID(), polyModifyPoint::pointID(), polyModifyCell::removeFromZone(), polyModifyFace::zoneFlip(), polyAddFace::zoneFlip(), polyModifyCell::zoneID(), polyModifyPoint::zoneID(), polyAddPoint::zoneID(), polyAddCell::zoneID(), polyModifyFace::zoneID(), and polyAddFace::zoneID().

Referenced by meshRefinement::mergeBaffles(), polyMeshAdder::mergePoints(), removeCells::setRefinement(), faceCollapser::setRefinement(), removePoints::setRefinement(), boundaryCutter::setRefinement(), combineFaces::setRefinement(), removeFaces::setRefinement(), meshCutAndRemove::setRefinement(), meshCutter::setRefinement(), addPatchCellLayer::setRefinement(), hexRef8::setRefinement(), removePoints::setUnrefinement(), and combineFaces::setUnrefinement().

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

◆ addPoint()

Foam::label addPoint ( const point pt,
const label  masterPointID,
const label  zoneID,
const bool  inCell 
)

Add point. Return new point label.

Notes:

  • masterPointID can be < 0 (appended points)
  • inCell = false: add retired point (to end of point list)

Definition at line 2610 of file polyTopoChange.C.

References zoneID.

Referenced by polyMeshAdder::add(), duplicatePoints::setRefinement(), createShellMesh::setRefinement(), and tetDecomposer::setRefinement().

Here is the caller graph for this function:

◆ modifyPoint()

void modifyPoint ( const label  pointi,
const point pt,
const label  zoneID,
const bool  inCell 
)

Modify coordinate.

Notes:

  • zoneID = +ve (add to zoneID), -ve (remove from zones)
  • inCell = false: add retired point (to end of point list)

Definition at line 2638 of file polyTopoChange.C.

References Foam::abort(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, and zoneID.

Referenced by edgeCollapser::setRefinement().

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

◆ removePoint()

void removePoint ( const label  pointi,
const label  mergePointi 
)

Remove/merge point.

Definition at line 2699 of file polyTopoChange.C.

References Foam::abort(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, VectorSpace< Vector< Cmpt >, Cmpt, 3 >::max, and Foam::nl.

Referenced by polyMeshAdder::mergePoints(), and edgeCollapser::setRefinement().

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

◆ addFace()

Foam::label addFace ( const face f,
const label  own,
const label  nei,
const label  masterPointID,
const label  masterEdgeID,
const label  masterFaceID,
const bool  flipFaceFlux,
const label  patchID,
const label  zoneID,
const bool  zoneFlip 
)

Add face to cells. Return new face label.

own,nei<0, zoneID>=0 : add inactive face (to end of face list)

Definition at line 2747 of file polyTopoChange.C.

References Foam::expressions::patchExpr::debug, f(), patchID, and zoneID.

Referenced by polyMeshAdder::add(), cyclicAMIPolyPatch::addAMIFaces(), meshRefinement::doSplitFaces(), and createShellMesh::setRefinement().

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

◆ modifyFace()

void modifyFace ( const face f,
const label  facei,
const label  own,
const label  nei,
const bool  flipFaceFlux,
const label  patchID,
const label  zoneID,
const bool  zoneFlip 
)

Modify vertices or cell of face.

Definition at line 2811 of file polyTopoChange.C.

References Foam::expressions::patchExpr::debug, f(), patchID, and zoneID.

Referenced by meshRefinement::doSplitFaces(), duplicatePoints::setRefinement(), edgeCollapser::setRefinement(), and meshRefinement::splitFacesUndo().

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

◆ removeFace()

void removeFace ( const label  facei,
const label  mergeFacei 
)

Remove/merge face.

Definition at line 2848 of file polyTopoChange.C.

References Foam::abort(), Foam::endl(), Foam::FatalError, and FatalErrorInFunction.

Referenced by cyclicAMIPolyPatch::removeAMIFaces(), edgeCollapser::setRefinement(), and meshRefinement::splitFacesUndo().

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

◆ addCell()

Foam::label addCell ( const label  masterPointID,
const label  masterEdgeID,
const label  masterFaceID,
const label  masterCellID,
const label  zoneID 
)

Add cell. Return new cell label.

Definition at line 2895 of file polyTopoChange.C.

References zoneID.

Referenced by polyMeshAdder::add(), createShellMesh::setRefinement(), and tetDecomposer::setRefinement().

Here is the caller graph for this function:

◆ modifyCell()

void modifyCell ( const label  celli,
const label  zoneID 
)

Modify zone of cell.

Definition at line 2932 of file polyTopoChange.C.

References zoneID.

◆ removeCell()

void removeCell ( const label  celli,
const label  mergeCelli 
)

Remove/merge cell.

Definition at line 2942 of file polyTopoChange.C.

References Foam::abort(), Foam::endl(), Foam::FatalError, and FatalErrorInFunction.

Referenced by edgeCollapser::setRefinement().

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

◆ setNumPatches()

void setNumPatches ( const label  nPatches)
inline

Explicitly set the number of patches if construct-without-mesh used.

Definition at line 55 of file polyTopoChangeI.H.

References nPatches.

◆ changeMesh() [1/2]

Foam::autoPtr< Foam::mapPolyMesh > changeMesh ( polyMesh mesh,
const labelUList patchMap,
const bool  inflate,
const bool  syncParallel = true,
const bool  orderCells = false,
const bool  orderPoints = false 
)

Inplace changes mesh without change of patches.

Adapts patch start/end and by default does parallel matching. Clears all data. Returns map. inflate = true : keep old mesh points. Put new points into the returned map (preMotionPoints) so we can use inflation. Any points out of nothing (appended points) are vector::zero. inflate = false: set mesh points directly. Empty preMotionPoints in the map. orderCells : whether to order the cells (see bandCompression.H) orderPoints : whether to order the points into internal first followed by boundary points. This is not fully consistent with upper-triangular ordering of points and edges so is only done when explicitly asked for.

Definition at line 2980 of file polyTopoChange.C.

References polyMesh::boundaryMesh(), primitiveMesh::cellVolumes(), polyMesh::cellZones(), Foam::expressions::patchExpr::debug, Foam::endl(), polyMesh::faceZones(), forAll, mesh, primitiveMesh::nCells(), autoPtr< T >::New(), newPointi, primitiveMesh::nFaces(), Foam::nl, primitiveMesh::nPoints(), polyMesh::points(), polyMesh::pointZones(), Foam::Pout, polyMesh::resetPrimitives(), polyMesh::topoChanging(), Foam::HashSetOps::used(), and Foam::Zero.

Referenced by fvMeshAdder::add(), meshRefinement::createBaffles(), meshRefinement::directionalRefine(), meshRefinement::doRemoveCells(), meshRefinement::doRemovePoints(), meshRefinement::doRestorePoints(), meshRefinement::dupNonManifoldPoints(), meshRefinement::mergeBaffles(), meshRefinement::mergePatchFaces(), meshRefinement::mergePatchFacesUndo(), meshRefinement::mergePoints(), dynamicRefineFvMesh::refine(), meshRefinement::refine(), refinementIterator::setRefinement(), meshRefinement::splitFacesUndo(), dynamicRefineFvMesh::unrefine(), dynamicMotionSolverFvMeshAMI::update(), and meshRefinement::zonify().

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

◆ changeMesh() [2/2]

Foam::autoPtr< Foam::mapPolyMesh > changeMesh ( polyMesh mesh,
const bool  inflate,
const bool  syncParallel = true,
const bool  orderCells = false,
const bool  orderPoints = false 
)

Without patch mapping.

Definition at line 3246 of file polyTopoChange.C.

References polyMesh::boundaryMesh(), Foam::identity(), and mesh.

Here is the call graph for this function:

◆ makeMesh() [1/4]

autoPtr<mapPolyMesh> makeMesh ( autoPtr< Type > &  newMesh,
const IOobject io,
const polyMesh mesh,
const labelUList patchMap,
const bool  syncParallel = true,
const bool  orderCells = false,
const bool  orderPoints = false 
)

Create new mesh with old mesh patches. Additional dictionaries.

(fv* etc) read according to IO flags

Referenced by snappyLayerDriver::addLayers(), and polyMeshFilter::copyMesh().

Here is the caller graph for this function:

◆ makeMesh() [2/4]

autoPtr<mapPolyMesh> makeMesh ( autoPtr< Type > &  newMesh,
const IOobject io,
const polyMesh mesh,
const bool  syncParallel = true,
const bool  orderCells = false,
const bool  orderPoints = false 
)

Create new mesh with old mesh patches. Additional dictionaries.

(fv* etc) read according to IO flags

◆ makeMesh() [3/4]

Foam::autoPtr<Foam::mapPolyMesh> makeMesh ( autoPtr< Type > &  newMeshPtr,
const IOobject io,
const polyMesh mesh,
const labelUList patchMap,
const bool  syncParallel,
const bool  orderCells,
const bool  orderPoints 
)

◆ makeMesh() [4/4]

Foam::autoPtr<Foam::mapPolyMesh> makeMesh ( autoPtr< Type > &  newMeshPtr,
const IOobject io,
const polyMesh mesh,
const bool  syncParallel,
const bool  orderCells,
const bool  orderPoints 
)

Definition at line 417 of file polyTopoChangeTemplates.C.

References polyMesh::boundaryMesh(), Foam::identity(), and mesh.

Here is the call graph for this function:

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