FreeFOAM The Cross-Platform CFD Toolkit
polyTopoChange Class Reference

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

#include <dynamicMesh/polyTopoChange.H>


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 greatPoint (GREAT,GREAT,GREAT). 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 102 of file polyTopoChange.H.

List of all members.

Public Member Functions

 ClassName ("polyTopoChange")
 Runtime type information.
 polyTopoChange (const label nPatches, const bool strict=true)
 Construct without mesh. Either specify nPatches or use.
 polyTopoChange (const polyMesh &mesh, const bool strict=true)
 Construct from mesh. Adds all points/face/cells from mesh.
const DynamicList< point > & points () const
 Points. Shrunk after constructing mesh (or calling of compact())
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
 Is point removed?
bool faceRemoved (const label faceI) const
 Is face removed?
bool cellRemoved (const label cellI) const
 Is cell removed?
void clear ()
 Clear all storage.
void addMesh (const polyMesh &, const labelList &patchMap, const labelList &pointZoneMap, const labelList &faceZoneMap, const labelList &cellZoneMap)
 Add all points/faces/cells of mesh. Additional offset for patch.
void setCapacity (const label nPoints, const label nFaces, const label nCells)
 Explicitly pre-size the dynamic storage for expected mesh.
void movePoints (const pointField &newPoints)
 Move all points. Incompatible with other topology changes.
label setAction (const topoAction &action)
 For compatibility with polyTopoChange: set topological action.
label addPoint (const point &, const label masterPointID, const label zoneID, const bool inCell)
 Add point. Return new point label.
void modifyPoint (const label, const point &, const label newZoneID, const bool inCell)
 Modify coordinate.
void removePoint (const label, const label)
 Remove/merge point.
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.
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.
void removeFace (const label, const label)
 Remove/merge face.
label addCell (const label masterPointID, const label masterEdgeID, const label masterFaceID, const label masterCellID, const label zoneID)
 Add cell. Return new cell label.
void modifyCell (const label, const label zoneID)
 Modify zone of cell.
void removeCell (const label, const label)
 Remove/merge cell.
void setNumPatches (const label nPatches)
 Explicitly set the number of patches if construct-without-mesh.
autoPtr< mapPolyMeshchangeMesh (polyMesh &mesh, const bool inflate, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
 Inplace changes mesh without change of patches.
autoPtr< mapPolyMeshmakeMesh (autoPtr< fvMesh > &newMesh, const IOobject &io, const fvMesh &mesh, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
 Create new mesh with old mesh patches.

Constructor & Destructor Documentation

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 2100 of file polyTopoChange.C.

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

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

Definition at line 2132 of file polyTopoChange.C.

References polyMesh::boundaryMesh(), polyMesh::cellZones(), polyMesh::faceZones(), Foam::identity(), polyMesh::pointZones(), and PtrList< T >::size().


Member Function Documentation

ClassName ( "polyTopoChange"  )

Runtime type information.

const DynamicList<point>& points ( ) const
inline

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

Definition at line 425 of file polyTopoChange.H.

Referenced by duplicatePoints::setRefinement().

const DynamicList<face>& faces ( ) const
inline

Definition at line 430 of file polyTopoChange.H.

const DynamicList<label>& region ( ) const
inline

Definition at line 435 of file polyTopoChange.H.

const DynamicList<label>& faceOwner ( ) const
inline

Definition at line 440 of file polyTopoChange.H.

const DynamicList<label>& faceNeighbour ( ) const
inline

Definition at line 445 of file polyTopoChange.H.

bool pointRemoved ( const label  pointI) const
inline

Is point removed?

Definition at line 29 of file polyTopoChangeI.H.

References Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().

bool faceRemoved ( const label  faceI) const
inline

Is face removed?

Definition at line 40 of file polyTopoChangeI.H.

bool cellRemoved ( const label  cellI) const
inline

Is cell removed?

Definition at line 46 of file polyTopoChangeI.H.

void clear ( )

Clear all storage.

Definition at line 2176 of file polyTopoChange.C.

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 2422 of file polyTopoChange.C.

void movePoints ( const pointField newPoints)

Move all points. Incompatible with other topology changes.

Definition at line 2647 of file polyTopoChange.C.

References Foam::abort(), Foam::endl(), Foam::FatalError, FatalErrorIn, forAll, and List< T >::size().

Foam::label setAction ( const topoAction action)

For compatibility with polyTopoChange: set topological action.

Definition at line 2454 of file polyTopoChange.C.

References Foam::abort(), polyRemoveCell::cellID(), polyModifyCell::cellID(), polyRemoveFace::faceID(), polyModifyFace::faceID(), Foam::FatalError, FatalErrorIn, 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(), polyModifyPoint::newPoint(), polyAddPoint::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(), perfectInterface::setRefinement(), faceCollapser::setRefinement(), boundaryCutter::setRefinement(), removePoints::setRefinement(), combineFaces::setRefinement(), removeFaces::setRefinement(), meshCutAndRemove::setRefinement(), meshCutter::setRefinement(), addPatchCellLayer::setRefinement(), hexRef8::setRefinement(), removePoints::setUnrefinement(), combineFaces::setUnrefinement(), and meshRefinement::zonify().

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 2585 of file polyTopoChange.C.

Referenced by duplicatePoints::setRefinement().

void modifyPoint ( const label  pointI,
const point pt,
const label  newZoneID,
const bool  inCell 
)

Modify coordinate.

Notes:

  • inCell = false: add retired point (to end of point list)

Definition at line 2609 of file polyTopoChange.C.

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

void removePoint ( const label  pointI,
const label  mergePointI 
)

Remove/merge point.

Definition at line 2666 of file polyTopoChange.C.

References Foam::abort(), Foam::endl(), Foam::FatalError, FatalErrorIn, and Foam::nl.

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

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 2714 of file polyTopoChange.C.

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 2774 of file polyTopoChange.C.

References f().

Referenced by duplicatePoints::setRefinement(), and edgeCollapser::setRefinement().

void removeFace ( const label  faceI,
const label  mergeFaceI 
)

Remove/merge face.

Definition at line 2802 of file polyTopoChange.C.

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

Referenced by edgeCollapser::setRefinement().

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 2846 of file polyTopoChange.C.

void modifyCell ( const label  cellI,
const label  zoneID 
)

Modify zone of cell.

Definition at line 2883 of file polyTopoChange.C.

void removeCell ( const label  cellI,
const label  mergeCellI 
)

Remove/merge cell.

Definition at line 2892 of file polyTopoChange.C.

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

Referenced by edgeCollapser::setRefinement().

void setNumPatches ( const label  nPatches)
inline

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

used.

Definition at line 52 of file polyTopoChangeI.H.

References nPatches.

Foam::autoPtr< Foam::mapPolyMesh > changeMesh ( polyMesh mesh,
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 2927 of file polyTopoChange.C.

References polyMesh::boundaryMesh(), polyMesh::cellZones(), polyMesh::changing(), Foam::endl(), polyMesh::faceZones(), forAll, primitiveMesh::nCells(), primitiveMesh::nFaces(), Foam::nl, primitiveMesh::nPoints(), polyMesh::points(), polyMesh::pointZones(), Foam::Pout, polyMesh::resetPrimitives(), List< T >::size(), PtrList< T >::size(), Foam::xferMove(), and Vector< scalar >::zero.

Referenced by meshRefinement::createBaffles(), meshRefinement::dupNonManifoldPoints(), meshRefinement::mergeBaffles(), meshRefinement::mergeEdges(), meshRefinement::mergePatchFaces(), dynamicRefineFvMesh::refine(), meshRefinement::refine(), refinementIterator::setRefinement(), dynamicRefineFvMesh::unrefine(), and meshRefinement::zonify().

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

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