Data Structures | Public Member Functions | Private Types | Private Member Functions | Private Attributes
meshOptimizer Class Reference
Collaboration diagram for meshOptimizer:
Collaboration graph
[legend]

Data Structures

class  laplaceSmoother
 

Public Member Functions

 meshOptimizer (polyMeshGen &mesh)
 Construct from mesh. More...
 
 ~meshOptimizer ()
 
void enforceConstraints (const word subsetName="badPoints")
 
template<class labelListType >
void lockCells (const labelListType &)
 lock the cells which shall not be modified More...
 
void lockCellsInSubset (const word &subsetName)
 
template<class labelListType >
void lockFaces (const labelListType &)
 lock the faces whih shall not be modified More...
 
void lockFacesInSubset (const word &subsetName)
 
template<class labelListType >
void lockPoints (const labelListType &)
 lock points which shall not be moved More...
 
void lockPointsInSubset (const word &subsetName)
 
void removeUserConstraints ()
 reset to default constraints More...
 
void optimizeSurface (const meshOctree &)
 smooth surface vertices More...
 
void untangleMeshFV (const label maxNumGlobalIterations=10, const label maxNumIterations=50, const label maxNumSurfaceIterations=2, const bool relaxedCheck=false)
 
void optimizeBoundaryLayer (const bool addBufferLayer=true)
 
void untangleBoundaryLayer ()
 
void optimizeLowQualityFaces (const label maxNumIterations=10)
 
void optimizeMeshNearBoundaries (const label maxNumIterations=10, const label numLayersOfCells=2)
 
void optimizeMeshFV (const label numLaplaceIterations=5, const label maxNumGlobalIterations=10, const label maxNumIterations=50, const label maxNumSurfaceIterations=2)
 final optimisation More...
 
void optimizeMeshFVBestQuality (const label maxNumIterations=50, const scalar threshold=0.1)
 greedy optimisation until the mesh can be improved More...
 

Private Types

enum  vertexType_ {
  INSIDE = 1, BOUNDARY = 2, EDGE = 4, CORNER = 8,
  PARALLELBOUNDARY = 16, LOCKED = 32
}
 

Private Member Functions

const meshSurfaceEnginemeshSurface () const
 return mesh surface More...
 
void clearSurface ()
 
label findBadFaces (labelHashSet &, const boolList &) const
 find problematic faces More...
 
label findLowQualityFaces (labelHashSet &, const boolList &) const
 
void calculatePointLocations ()
 mark point locations More...
 
 meshOptimizer (const meshOptimizer &)
 Disallow default bitwise copy construct. More...
 
void operator= (const meshOptimizer &)
 Disallow default bitwise assignment. More...
 

Private Attributes

polyMeshGenmesh_
 reference to the mesh More...
 
List< directionvertexLocation_
 location of vertex (internal, boundary, edge, corner) More...
 
labelLongList lockedFaces_
 locked faces which shall not be changed More...
 
meshSurfaceEnginemsePtr_
 mesh surface More...
 
bool enforceConstraints_
 enforce constraints More...
 
word badPointsSubsetName_
 name of the subset contaning tangled points More...
 

Detailed Description

Definition at line 60 of file meshOptimizer.H.

Member Enumeration Documentation

◆ vertexType_

enum vertexType_
private
Enumerator
INSIDE 
BOUNDARY 
EDGE 
CORNER 
PARALLELBOUNDARY 
LOCKED 

Definition at line 191 of file meshOptimizer.H.

Constructor & Destructor Documentation

◆ meshOptimizer() [1/2]

meshOptimizer ( const meshOptimizer )
private

Disallow default bitwise copy construct.

◆ meshOptimizer() [2/2]

Construct from mesh.

Definition at line 171 of file meshOptimizer.C.

References meshOptimizer::calculatePointLocations().

Here is the call graph for this function:

◆ ~meshOptimizer()

Definition at line 185 of file meshOptimizer.C.

References meshOptimizer::clearSurface().

Here is the call graph for this function:

Member Function Documentation

◆ meshSurface()

const meshSurfaceEngine & meshSurface ( ) const
private

return mesh surface

Definition at line 45 of file meshOptimizer.C.

References meshOptimizer::mesh_, and meshOptimizer::msePtr_.

Referenced by meshOptimizer::calculatePointLocations(), meshOptimizer::optimizeBoundaryLayer(), and meshOptimizer::optimizeSurface().

Here is the caller graph for this function:

◆ clearSurface()

void clearSurface ( )
private

Definition at line 53 of file meshOptimizer.C.

References Foam::deleteDemandDrivenData(), and meshOptimizer::msePtr_.

Referenced by meshOptimizer::optimizeBoundaryLayer(), meshOptimizer::optimizeSurface(), and meshOptimizer::~meshOptimizer().

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

◆ findBadFaces()

label findBadFaces ( labelHashSet badFaces,
const boolList changedFace 
) const
private

◆ findLowQualityFaces()

label findLowQualityFaces ( labelHashSet badFaces,
const boolList  
) const
private

◆ calculatePointLocations()

void calculatePointLocations ( )
private

◆ operator=()

void operator= ( const meshOptimizer )
private

Disallow default bitwise assignment.

◆ enforceConstraints()

void enforceConstraints ( const word  subsetName = "badPoints")

Flag stopping the meshing process if it is not possible to untangle the surface without sacrificing geometry constraints Points which must be moved away from the required position are stored into a point subset

Definition at line 192 of file meshOptimizer.C.

References meshOptimizer::badPointsSubsetName_, and meshOptimizer::enforceConstraints_.

Referenced by tetMeshGenerator::optimiseFinalMesh(), voronoiMeshGenerator::optimiseFinalMesh(), and cartesianMeshGenerator::optimiseFinalMesh().

Here is the caller graph for this function:

◆ lockCells()

void lockCells ( const labelListType &  l)
inline

◆ lockCellsInSubset()

void lockCellsInSubset ( const word subsetName)

lock cells which shall not be modified contained inside the specified subset

lock the points in the cell subset with the given name

Definition at line 199 of file meshOptimizer.C.

References polyMeshGenCells::cellsInSubset(), polyMeshGenCells::cellSubsetIndex(), Foam::endl(), meshOptimizer::lockCells(), meshOptimizer::mesh_, and Foam::Warning.

Referenced by main().

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

◆ lockFaces()

void lockFaces ( const labelListType &  lf)
inline

◆ lockFacesInSubset()

void lockFacesInSubset ( const word subsetName)

lock faces which shall not be modified stored in a face subset

lock the points in the face subset with the given name

Definition at line 217 of file meshOptimizer.C.

References Foam::endl(), polyMeshGenFaces::facesInSubset(), polyMeshGenFaces::faceSubsetIndex(), meshOptimizer::lockFaces(), meshOptimizer::mesh_, and Foam::Warning.

Here is the call graph for this function:

◆ lockPoints()

void lockPoints ( const labelListType &  lp)
inline

◆ lockPointsInSubset()

void lockPointsInSubset ( const word subsetName)

lock points which shall not be modified given as a point subset

lock the points in the point subset with the given name

Definition at line 235 of file meshOptimizer.C.

References Foam::endl(), meshOptimizer::lockCells(), meshOptimizer::mesh_, polyMeshGenPoints::pointsInSubset(), polyMeshGenPoints::pointSubsetIndex(), and Foam::Warning.

Here is the call graph for this function:

◆ removeUserConstraints()

void removeUserConstraints ( )

reset to default constraints

unlock points

Definition at line 253 of file meshOptimizer.C.

References forAll, meshOptimizer::LOCKED, meshOptimizer::lockedFaces_, LongList< T, Offset >::setSize(), and meshOptimizer::vertexLocation_.

Referenced by meshOptimizer::optimizeBoundaryLayer(), and meshOptimizer::untangleBoundaryLayer().

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

◆ optimizeSurface()

void optimizeSurface ( const meshOctree octree)

smooth surface vertices

Definition at line 44 of file meshOptimizerOptimizeSurface.C.

References meshOptimizer::badPointsSubsetName_, meshOptimizer::clearSurface(), Foam::endl(), meshOptimizer::enforceConstraints_, Foam::Info, meshSurfaceMapper::mapVerticesOntoSurfacePatches(), and meshOptimizer::meshSurface().

Referenced by tetMeshGenerator::optimiseFinalMesh().

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

◆ untangleMeshFV()

void untangleMeshFV ( const label  maxNumGlobalIterations = 10,
const label  maxNumIterations = 50,
const label  maxNumSurfaceIterations = 2,
const bool  relaxedCheck = false 
)

performs mesh untangling based on detected negative normals a global iteration consists of maxNumIterations iterations when only internal points are moved and maxNumSurfaceIterations when surface points are moved

check if any points in the tet mesh shall not move

perform optimisation

create a tet mesh from the mesh and the labels of bad faces

construct tetMeshOptimisation and improve positions of points in the tet mesh

update points in the mesh from the coordinates in the tet mesh

perform optimisation

create tethrahedral mesh from the cells which shall be smoothed

contruct tetMeshOptimisation

the point stays in the plane determined by the point normal

move points without any constraints on the movement

move boundary points without any constraints

Definition at line 57 of file optimizeMeshFV.C.

References Foam::abort(), LongList< T, Offset >::append(), partTetMesh::createPolyMesh(), Foam::endl(), f(), polyMeshGenFaces::faces(), Foam::FatalError, FatalErrorIn, Foam::polyMeshGenChecks::findBadFaces(), Foam::polyMeshGenChecks::findBadFacesRelaxed(), forAll, forAllConstIter(), forAllRow, Foam::Info, polyMeshGenFaces::neighbour(), tetMeshOptimisation::optimiseBoundarySurfaceLaplace(), tetMeshOptimisation::optimiseBoundaryVolumeOptimizer(), tetMeshOptimisation::optimiseUsingKnuppMetric(), tetMeshOptimisation::optimiseUsingMeshUntangler(), tetMeshOptimisation::optimiseUsingVolumeOptimizer(), polyMeshGenPoints::points(), partTetMesh::points(), partTetMesh::pointTets(), polyMeshGenModifier::removeUnusedVertices(), Foam::returnReduce(), faceListPMG::size(), pointFieldPMG::size(), partTetMesh::smoothVertex(), partTetMesh::tets(), partTetMesh::updateOrigMesh(), and WarningIn.

Referenced by main(), meshOptimisation(), tetMeshGenerator::optimiseFinalMesh(), voronoiMeshGenerator::optimiseFinalMesh(), cartesianMeshGenerator::optimiseFinalMesh(), meshOptimizer::optimizeBoundaryLayer(), and meshOptimizer::untangleBoundaryLayer().

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

◆ optimizeBoundaryLayer()

void optimizeBoundaryLayer ( const bool  addBufferLayer = true)

performs optimisation of boundary layer cells it is applied to the first boundary layer, only

create a buffer layer which will not be modified by the smoother

check if the bnd layer is tangled somewhere

lock boundary layer points, faces and cells

optimize mesh quality

untangle remaining faces and lock the boundary layer cells

unlock bnd layer points

Definition at line 302 of file optimizeMeshFV.C.

References Foam::abort(), refineBoundaryLayers::activateSpecialMode(), polyMeshGenCells::addCellSubset(), polyMeshGenCells::addCellToSubset(), LongList< T, Offset >::append(), meshOptimizer::calculatePointLocations(), polyMeshGenCells::clearAddressingData(), meshOptimizer::clearSurface(), Foam::endl(), meshSurfaceEngine::faceOwners(), Foam::FatalError, forAll, dictionary::found(), objectRegistry::foundObject(), Foam::Info, boundaryLayerOptimisation::isBaseFace(), meshOptimizer::lockCells(), meshOptimizer::LOCKED, dictionary::lookup(), objectRegistry::lookupObject(), Foam::mag(), meshOptimizer::mesh_, meshOptimizer::meshSurface(), boundaryLayerOptimisation::optimiseLayer(), meshOptimizer::optimizeMeshFV(), polyMeshGenPoints::points(), Foam::readBool(), boundaryLayerOptimisation::readSettings(), refineBoundaryLayers::readSettings(), refineBoundaryLayers::refineLayers(), meshOptimizer::removeUserConstraints(), polyMeshGenPoints::returnTime(), pointFieldPMG::size(), dictionary::subDict(), meshOptimizer::untangleMeshFV(), and meshOptimizer::vertexLocation_.

Referenced by meshOptimisation(), tetMeshGenerator::optimiseFinalMesh(), voronoiMeshGenerator::optimiseFinalMesh(), and cartesianMeshGenerator::optimiseFinalMesh().

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

◆ untangleBoundaryLayer()

void untangleBoundaryLayer ( )

◆ optimizeLowQualityFaces()

void optimizeLowQualityFaces ( const label  maxNumIterations = 10)

performs mesh optimisation for faces with high non-orthogonality and skewness

check if any points in the tet mesh shall not move

perform optimisation

construct tetMeshOptimisation and improve positions of points in the tet mesh

update points in the mesh from the new coordinates in the tet mesh

Definition at line 469 of file optimizeMeshFV.C.

References LongList< T, Offset >::append(), Foam::endl(), polyMeshGenFaces::faces(), Foam::polyMeshGenChecks::findLowQualityFaces(), forAll, forAllConstIter(), Foam::Info, meshOptimizer::LOCKED, meshOptimizer::mesh_, tetMeshOptimisation::optimiseUsingVolumeOptimizer(), faceListPMG::size(), partTetMesh::updateOrigMesh(), and meshOptimizer::vertexLocation_.

Referenced by meshOptimisation(), tetMeshGenerator::optimiseFinalMesh(), voronoiMeshGenerator::optimiseFinalMesh(), cartesianMeshGenerator::optimiseFinalMesh(), and meshOptimizer::untangleBoundaryLayer().

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

◆ optimizeMeshNearBoundaries()

void optimizeMeshNearBoundaries ( const label  maxNumIterations = 10,
const label  numLayersOfCells = 2 
)

perform optimization of cells near the boundary the use shall specify the number of iterations and the number of cell layers which shall be taken into account

check if any points in the tet mesh shall not move

Definition at line 522 of file optimizeMeshFV.C.

References LongList< T, Offset >::append(), Foam::endl(), Foam::flush(), forAll, Foam::Info, tetMeshOptimisation::optimiseUsingVolumeOptimizer(), faceListPMG::size(), and partTetMesh::updateOrigMesh().

Here is the call graph for this function:

◆ optimizeMeshFV()

void optimizeMeshFV ( const label  numLaplaceIterations = 5,
const label  maxNumGlobalIterations = 10,
const label  maxNumIterations = 50,
const label  maxNumSurfaceIterations = 2 
)

final optimisation

Definition at line 557 of file optimizeMeshFV.C.

References Foam::endl(), Foam::Info, and meshOptimizer::laplaceSmoother::optimizeLaplacianPC().

Referenced by main(), meshOptimisation(), tetMeshGenerator::optimiseFinalMesh(), voronoiMeshGenerator::optimiseFinalMesh(), cartesianMeshGenerator::optimiseFinalMesh(), and meshOptimizer::optimizeBoundaryLayer().

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

◆ optimizeMeshFVBestQuality()

void optimizeMeshFVBestQuality ( const label  maxNumIterations = 50,
const scalar  threshold = 0.1 
)

greedy optimisation until the mesh can be improved

check if any points in the tet mesh shall not move

perform optimisation

update the iteration number when the minimum is achieved

construct tetMeshOptimisation and improve positions of points in the tet mesh

update points in the mesh from the new coordinates in the tet mesh

Definition at line 580 of file optimizeMeshFV.C.

References LongList< T, Offset >::append(), Foam::endl(), Foam::polyMeshGenChecks::findWorstQualityFaces(), forAll, forAllConstIter(), Foam::Info, tetMeshOptimisation::optimiseUsingVolumeOptimizer(), faceListPMG::size(), and partTetMesh::updateOrigMesh().

Referenced by main().

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

Field Documentation

◆ mesh_

polyMeshGen& mesh_
private

◆ vertexLocation_

List<direction> vertexLocation_
private

◆ lockedFaces_

labelLongList lockedFaces_
private

locked faces which shall not be changed

Definition at line 70 of file meshOptimizer.H.

Referenced by meshOptimizer::lockCells(), meshOptimizer::lockFaces(), and meshOptimizer::removeUserConstraints().

◆ msePtr_

meshSurfaceEngine* msePtr_
mutableprivate

mesh surface

Definition at line 73 of file meshOptimizer.H.

Referenced by meshOptimizer::clearSurface(), and meshOptimizer::meshSurface().

◆ enforceConstraints_

bool enforceConstraints_
private

enforce constraints

Definition at line 76 of file meshOptimizer.H.

Referenced by meshOptimizer::enforceConstraints(), and meshOptimizer::optimizeSurface().

◆ badPointsSubsetName_

word badPointsSubsetName_
private

name of the subset contaning tangled points

Definition at line 79 of file meshOptimizer.H.

Referenced by meshOptimizer::enforceConstraints(), and meshOptimizer::optimizeSurface().


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