Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
edgeCollapser Class Reference

Does polyTopoChanges to remove edges. Can remove faces due to edge collapse but can not remove cells due to face removal! Also removes unused points. More...

Collaboration diagram for edgeCollapser:
Collaboration graph
[legend]

Public Types

enum  collapseType { noCollapse = 0, toPoint = 1, toEdge = 2 }
 

Public Member Functions

 ClassName ("edgeCollapser")
 Runtime type information. More...
 
 edgeCollapser (const polyMesh &mesh)
 Construct from mesh. More...
 
 edgeCollapser (const polyMesh &mesh, const dictionary &dict)
 Construct from mesh and dict. More...
 
void consistentCollapse (const globalIndex &globalPoints, const labelList &pointPriority, const Map< point > &collapsePointToLocation, PackedBoolList &collapseEdge, List< pointEdgeCollapse > &allPointInfo, const bool allowCellCollapse=false) const
 Ensure that the collapse is parallel consistent and update. More...
 
bool setRefinement (const List< pointEdgeCollapse > &allPointInfo, polyTopoChange &meshMod) const
 Play commands into polyTopoChange to create mesh. More...
 
label markSmallEdges (const scalarField &minEdgeLen, const labelList &pointPriority, PackedBoolList &collapseEdge, Map< point > &collapsePointToLocation) const
 Mark (in collapseEdge) any edges to collapse. More...
 
label markMergeEdges (const scalar maxCos, const labelList &pointPriority, PackedBoolList &collapseEdge, Map< point > &collapsePointToLocation) const
 Mark (in collapseEdge) any edges to merge. More...
 
labelPair markSmallSliverFaces (const scalarField &faceFilterFactor, const labelList &pointPriority, PackedBoolList &collapseEdge, Map< point > &collapsePointToLocation) const
 Find small faces and sliver faces in the mesh and mark the. More...
 
labelPair markFaceZoneEdges (const faceZone &fZone, const scalarField &faceFilterFactor, const labelList &pointPriority, PackedBoolList &collapseEdge, Map< point > &collapsePointToLocation) const
 Marks edges in the faceZone indirectPatchFaces for collapse. More...
 

Static Public Member Functions

static HashSet< labelcheckBadFaces (const polyMesh &mesh, const dictionary &meshQualityDict)
 Calls motionSmoother::checkMesh and returns a set of bad faces. More...
 
static label checkMeshQuality (const polyMesh &mesh, const dictionary &meshQualityDict, PackedBoolList &isErrorPoint)
 Check mesh and mark points on faces in error. More...
 

Private Member Functions

labelList edgesFromPoints (const label &faceI, const labelList &pointLabels) const
 Create an edgeList of edges in faceI which have both their points. More...
 
void collapseToEdge (const label faceI, const pointField &pts, const labelList &pointPriority, const vector &collapseAxis, const point &fC, const labelList &facePtsNeg, const labelList &facePtsPos, const scalarList &dNeg, const scalarList &dPos, const scalar dShift, PackedBoolList &collapseEdge, Map< point > &collapsePointToLocation) const
 Collapse a face to an edge, marking the collapsed edges and new. More...
 
void collapseToPoint (const label &faceI, const pointField &pts, const labelList &pointPriority, const point &fC, const labelList &facePts, PackedBoolList &collapseEdge, Map< point > &collapsePointToLocation) const
 Collapse a face to a point, marking the collapsed edges and new. More...
 
void faceCollapseAxisAndAspectRatio (const face &f, const point &fC, vector &collapseAxis, scalar &aspectRatio) const
 Do an eigenvector analysis of the face to get its collapse axis. More...
 
scalarField calcTargetFaceSizes () const
 Return the target length scale for each face. More...
 
collapseType collapseFace (const labelList &pointPriority, const face &f, const label faceI, const scalar targetFaceSize, PackedBoolList &collapseEdge, Map< point > &collapsePointToLocation, const scalarField &faceFilterFactor) const
 Decides whether a face should be collapsed (and if so it it is to a. More...
 
label edgeMaster (const labelList &pointPriority, const edge &e) const
 Return label of point that has the highest priority. This will be. More...
 
void checkBoundaryPointMergeEdges (const label pointI, const label otherPointI, const labelList &pointPriority, Map< point > &collapsePointToLocation) const
 Decides which points in an edge to collapse, based on their priority. More...
 
label breakStringsAtEdges (const PackedBoolList &markedEdges, PackedBoolList &collapseEdge, List< pointEdgeCollapse > &allPointInfo) const
 Helper function that breaks strings of collapses if an edge is not. More...
 
void determineDuplicatePointsOnFace (const face &f, PackedBoolList &markedPoints, labelHashSet &uniqueCollapses, labelHashSet &duplicateCollapses, List< pointEdgeCollapse > &allPointInfo) const
 Prevent face pinching by finding points in a face that will be. More...
 
label countEdgesOnFace (const face &f, List< pointEdgeCollapse > &allPointInfo) const
 Count the number of edges on the face that will exist as a result. More...
 
bool isFaceCollapsed (const face &f, List< pointEdgeCollapse > &allPointInfo) const
 Does the face have fewer than 3 edges as a result of the potential. More...
 
label syncCollapse (const globalIndex &globalPoints, const labelList &boundaryPoint, const PackedBoolList &collapseEdge, const Map< point > &collapsePointToLocation, List< pointEdgeCollapse > &allPointInfo) const
 Given the collapse information, propagates the information using. More...
 
void filterFace (const Map< DynamicList< label > > &collapseStrings, const List< pointEdgeCollapse > &allPointInfo, face &f) const
 Renumber f with new vertices. Removes consecutive duplicates. More...
 
 edgeCollapser (const edgeCollapser &)
 Disallow default bitwise copy construct. More...
 
void operator= (const edgeCollapser &)
 Disallow default bitwise assignment. More...
 

Private Attributes

const polyMeshmesh_
 Reference to mesh. More...
 
const scalar guardFraction_
 Controls collapse of a face to an edge. More...
 
const scalar maxCollapseFaceToPointSideLengthCoeff_
 Only collapse face to a point if high aspect ratio. More...
 
const Switch allowEarlyCollapseToPoint_
 Allow a face to be collapsed to a point early, before the test. More...
 
const scalar allowEarlyCollapseCoeff_
 Fraction of maxCollapseFaceToPointSideLengthCoeff_ to use when. More...
 

Detailed Description

Does polyTopoChanges to remove edges. Can remove faces due to edge collapse but can not remove cells due to face removal! Also removes unused points.

Source files

Definition at line 66 of file edgeCollapser.H.

Member Enumeration Documentation

◆ collapseType

Enumerator
noCollapse 
toPoint 
toEdge 

Definition at line 71 of file edgeCollapser.H.

Constructor & Destructor Documentation

◆ edgeCollapser() [1/3]

edgeCollapser ( const edgeCollapser )
private

Disallow default bitwise copy construct.

◆ edgeCollapser() [2/3]

edgeCollapser ( const polyMesh mesh)

Construct from mesh.

Definition at line 1214 of file edgeCollapser.C.

◆ edgeCollapser() [3/3]

edgeCollapser ( const polyMesh mesh,
const dictionary dict 
)

Construct from mesh and dict.

Definition at line 1225 of file edgeCollapser.C.

References Foam::endl(), Foam::Info, and Foam::nl.

Here is the call graph for this function:

Member Function Documentation

◆ edgesFromPoints()

Foam::labelList edgesFromPoints ( const label faceI,
const labelList pointLabels 
) const
private

Create an edgeList of edges in faceI which have both their points.

in pointLabels

Definition at line 121 of file edgeCollapser.C.

References Foam::constant::electromagnetic::e, forAll, pointLabels(), List::setSize(), and List::size().

Here is the call graph for this function:

◆ collapseToEdge()

void collapseToEdge ( const label  faceI,
const pointField pts,
const labelList pointPriority,
const vector collapseAxis,
const point fC,
const labelList facePtsNeg,
const labelList facePtsPos,
const scalarList dNeg,
const scalarList dPos,
const scalar  dShift,
PackedBoolList collapseEdge,
Map< point > &  collapsePointToLocation 
) const
private

Collapse a face to an edge, marking the collapsed edges and new.

locations for points that will move as a result of the collapse

Definition at line 170 of file edgeCollapser.C.

References DynamicList::append(), DynamicList::clear(), collapseEdge(), forAll, Foam::labelMin, Foam::max(), and List::size().

Here is the call graph for this function:

◆ collapseToPoint()

void collapseToPoint ( const label faceI,
const pointField pts,
const labelList pointPriority,
const point fC,
const labelList facePts,
PackedBoolList collapseEdge,
Map< point > &  collapsePointToLocation 
) const
private

Collapse a face to a point, marking the collapsed edges and new.

locations for points that will move as a result of the collapse

Definition at line 288 of file edgeCollapser.C.

References DynamicList::append(), DynamicList::clear(), collapseEdge(), f(), forAll, and Foam::labelMin.

Here is the call graph for this function:

◆ faceCollapseAxisAndAspectRatio()

void faceCollapseAxisAndAspectRatio ( const face f,
const point fC,
vector collapseAxis,
scalar &  aspectRatio 
) const
private

Do an eigenvector analysis of the face to get its collapse axis.

and aspect ratio

Definition at line 390 of file edgeCollapser.C.

References Foam::det(), Foam::constant::electromagnetic::e, Foam::eigenValues(), Foam::eigenVector(), f(), Foam::longestEdge(), Foam::mag(), Foam::magSqr(), Foam::max(), Foam::sqrt(), Vector< Cmpt >::x(), and Vector< Cmpt >::y().

Here is the call graph for this function:

◆ calcTargetFaceSizes()

Foam::scalarField calcTargetFaceSizes ( ) const
private

◆ collapseFace()

Foam::edgeCollapser::collapseType collapseFace ( const labelList pointPriority,
const face f,
const label  faceI,
const scalar  targetFaceSize,
PackedBoolList collapseEdge,
Map< point > &  collapsePointToLocation,
const scalarField faceFilterFactor 
) const
private

Decides whether a face should be collapsed (and if so it it is to a.

point or an edge)

Definition at line 563 of file edgeCollapser.C.

References collapseEdge(), Foam::endl(), f(), UList< T >::first(), forAll, Foam::inplaceReorder(), Foam::invert(), UList< T >::last(), Foam::magSqr(), List::size(), UList< T >::size(), Foam::sortedOrder(), Foam::sqr(), Foam::toPoint(), WarningInFunction, and Vector< scalar >::zero.

Here is the call graph for this function:

◆ edgeMaster()

Foam::label edgeMaster ( const labelList pointPriority,
const edge e 
) const
private

Return label of point that has the highest priority. This will be.

the point on the edge that will be collapsed to.

Definition at line 750 of file edgeCollapser.C.

References Foam::e.

◆ checkBoundaryPointMergeEdges()

void checkBoundaryPointMergeEdges ( const label  pointI,
const label  otherPointI,
const labelList pointPriority,
Map< point > &  collapsePointToLocation 
) const
private

Decides which points in an edge to collapse, based on their priority.

Definition at line 808 of file edgeCollapser.C.

References points.

◆ breakStringsAtEdges()

Foam::label breakStringsAtEdges ( const PackedBoolList markedEdges,
PackedBoolList collapseEdge,
List< pointEdgeCollapse > &  allPointInfo 
) const
private

Helper function that breaks strings of collapses if an edge is not.

labelled to collapse, but its points both collapse to the same location

Definition at line 856 of file edgeCollapser.C.

References collapseEdge(), Foam::e, and forAll.

Here is the call graph for this function:

◆ determineDuplicatePointsOnFace()

void determineDuplicatePointsOnFace ( const face f,
PackedBoolList markedPoints,
labelHashSet uniqueCollapses,
labelHashSet duplicateCollapses,
List< pointEdgeCollapse > &  allPointInfo 
) const
private

Prevent face pinching by finding points in a face that will be.

collapsed to the same location, but that are not ordered consecutively in the face

Definition at line 918 of file edgeCollapser.C.

References HashTable::clear(), f(), forAll, HashTable::found(), and HashSet< Key, Hash >::insert().

Here is the call graph for this function:

◆ countEdgesOnFace()

Foam::label countEdgesOnFace ( const face f,
List< pointEdgeCollapse > &  allPointInfo 
) const
private

Count the number of edges on the face that will exist as a result.

of the collapse

Definition at line 958 of file edgeCollapser.C.

References f(), and forAll.

Here is the call graph for this function:

◆ isFaceCollapsed()

bool isFaceCollapsed ( const face f,
List< pointEdgeCollapse > &  allPointInfo 
) const
private

Does the face have fewer than 3 edges as a result of the potential.

collapse

Definition at line 992 of file edgeCollapser.C.

References f().

Here is the call graph for this function:

◆ syncCollapse()

Foam::label syncCollapse ( const globalIndex globalPoints,
const labelList boundaryPoint,
const PackedBoolList collapseEdge,
const Map< point > &  collapsePointToLocation,
List< pointEdgeCollapse > &  allPointInfo 
) const
private

Given the collapse information, propagates the information using.

PointEdgeWave. Result is a list of new point locations and indices

Definition at line 1016 of file edgeCollapser.C.

References Foam::abort(), DynamicList::append(), List::clear(), collapseEdge(), Foam::e, Foam::FatalError, FatalErrorInFunction, forAll, Foam::labelMax, Foam::labelMin, List::setSize(), and Vector< scalar >::zero.

Here is the call graph for this function:

◆ filterFace()

void filterFace ( const Map< DynamicList< label > > &  collapseStrings,
const List< pointEdgeCollapse > &  allPointInfo,
face f 
) const
private

Renumber f with new vertices. Removes consecutive duplicates.

Definition at line 1122 of file edgeCollapser.C.

References Foam::endl(), f(), Foam::findIndex(), forAll, List::setSize(), and WarningInFunction.

Here is the call graph for this function:

◆ operator=()

void operator= ( const edgeCollapser )
private

Disallow default bitwise assignment.

◆ ClassName()

ClassName ( "edgeCollapser"  )

Runtime type information.

◆ checkBadFaces()

Foam::HashSet< Foam::label > checkBadFaces ( const polyMesh mesh,
const dictionary meshQualityDict 
)
static

Calls motionSmoother::checkMesh and returns a set of bad faces.

Definition at line 46 of file edgeCollapser.C.

References DynamicList::append(), Foam::polyMeshGenChecks::checkMesh(), Foam::endl(), forAll, Foam::Info, Foam::mag(), and mesh.

Here is the call graph for this function:

◆ checkMeshQuality()

Foam::label checkMeshQuality ( const polyMesh mesh,
const dictionary meshQualityDict,
PackedBoolList isErrorPoint 
)
static

Check mesh and mark points on faces in error.

Returns boolList with points in error set

Definition at line 82 of file edgeCollapser.C.

References f(), forAll, forAllConstIter(), mesh, Foam::returnReduce(), and HashTable::size().

Referenced by polyMeshFilter::filterEdges(), and polyMeshFilter::filterFacesLoop().

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

◆ consistentCollapse()

void consistentCollapse ( const globalIndex globalPoints,
const labelList pointPriority,
const Map< point > &  collapsePointToLocation,
PackedBoolList collapseEdge,
List< pointEdgeCollapse > &  allPointInfo,
const bool  allowCellCollapse = false 
) const

Ensure that the collapse is parallel consistent and update.

allPointInfo. Returns a list of edge collapses that is consistent across coupled boundaries and a list of pointEdgeCollapses.

Definition at line 1637 of file edgeCollapser.C.

References Foam::abort(), cells, collapseEdge(), Foam::endl(), f(), Foam::FatalError, FatalErrorInFunction, forAll, Foam::Info, Foam::nl, Foam::reduce(), Foam::returnReduce(), List::size(), syncTools::syncEdgeList(), and syncTools::syncPointList().

Referenced by polyMeshFilter::filterEdges(), polyMeshFilter::filterFaces(), and main().

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

◆ setRefinement()

bool setRefinement ( const List< pointEdgeCollapse > &  allPointInfo,
polyTopoChange meshMod 
) const

◆ markSmallEdges()

Foam::label markSmallEdges ( const scalarField minEdgeLen,
const labelList pointPriority,
PackedBoolList collapseEdge,
Map< point > &  collapsePointToLocation 
) const

Mark (in collapseEdge) any edges to collapse.

Definition at line 1828 of file edgeCollapser.C.

References Foam::average(), collapseEdge(), Foam::e, forAll, and points.

Referenced by polyMeshFilter::filterEdges().

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

◆ markMergeEdges()

Foam::label markMergeEdges ( const scalar  maxCos,
const labelList pointPriority,
PackedBoolList collapseEdge,
Map< point > &  collapsePointToLocation 
) const

Mark (in collapseEdge) any edges to merge.

Definition at line 1880 of file edgeCollapser.C.

References collapseEdge(), removePoints::countPointUsage(), forAll, Foam::mag(), points, and List::size().

Referenced by polyMeshFilter::filterEdges().

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

◆ markSmallSliverFaces()

Foam::labelPair markSmallSliverFaces ( const scalarField faceFilterFactor,
const labelList pointPriority,
PackedBoolList collapseEdge,
Map< point > &  collapsePointToLocation 
) const

Find small faces and sliver faces in the mesh and mark the.

edges that need to be collapsed in order to remove these faces. Also returns a map of new locations for points that will move as a result of the collapse. Use in conjuctions with edgeCollapser to synchronise the collapses and modify the mesh

Definition at line 1967 of file edgeCollapser.C.

References Foam::abort(), collapseEdge(), f(), Foam::FatalError, FatalErrorInFunction, forAll, and Foam::toPoint().

Referenced by polyMeshFilter::filterFaces().

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

◆ markFaceZoneEdges()

Foam::labelPair markFaceZoneEdges ( const faceZone fZone,
const scalarField faceFilterFactor,
const labelList pointPriority,
PackedBoolList collapseEdge,
Map< point > &  collapsePointToLocation 
) const

Marks edges in the faceZone indirectPatchFaces for collapse.

Definition at line 2028 of file edgeCollapser.C.

References Foam::abort(), collapseEdge(), f(), Foam::FatalError, FatalErrorInFunction, forAll, Foam::toPoint(), and faceZone::whichFace().

Here is the call graph for this function:

Field Documentation

◆ mesh_

const polyMesh& mesh_
private

Reference to mesh.

Definition at line 84 of file edgeCollapser.H.

Referenced by edgeCollapser::calcTargetFaceSizes().

◆ guardFraction_

const scalar guardFraction_
private

Controls collapse of a face to an edge.

Definition at line 87 of file edgeCollapser.H.

◆ maxCollapseFaceToPointSideLengthCoeff_

const scalar maxCollapseFaceToPointSideLengthCoeff_
private

Only collapse face to a point if high aspect ratio.

Definition at line 90 of file edgeCollapser.H.

◆ allowEarlyCollapseToPoint_

const Switch allowEarlyCollapseToPoint_
private

Allow a face to be collapsed to a point early, before the test.

to collapse to an edge

Definition at line 94 of file edgeCollapser.H.

◆ allowEarlyCollapseCoeff_

const scalar allowEarlyCollapseCoeff_
private

Fraction of maxCollapseFaceToPointSideLengthCoeff_ to use when.

allowEarlyCollapseToPoint_ is on

Definition at line 98 of file edgeCollapser.H.


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