Public Member Functions | Data Fields | Private Member Functions | Private Attributes | Static Private Attributes
CV2D Class Reference

Conformal-Voronoi 2D automatic mesher with grid or read initial points and point position relaxation with optional "squarification". More...

Inheritance diagram for CV2D:
Inheritance graph
[legend]
Collaboration diagram for CV2D:
Collaboration graph
[legend]

Public Member Functions

 ClassName ("CV2D")
 Runtime type information. More...
 
 CV2D (const Time &runTime, const dictionary &controlDict)
 Construct for given surface. More...
 
 ~CV2D ()
 Destructor. More...
 
const cv2DControlsmeshControls () const
 
const point2DtoPoint2D (const point &) const
 
const point2DField toPoint2D (const pointField &) const
 
point toPoint3D (const point2D &) const
 
point2DFromPoint toPoint2D (const Point &) const
 
PointFromPoint2D toPoint (const point2D &) const
 
point toPoint3D (const Point &) const
 
void insertPoints (const point2DField &points, const scalar nearness)
 Create the initial mesh from the given internal points. More...
 
void insertPoints (const fileName &pointFileName)
 Create the initial mesh from the internal points in the given. More...
 
void insertGrid ()
 Create the initial mesh as a regular grid of points. More...
 
void insertSurfacePointPairs ()
 Insert all surface point-pairs from. More...
 
void boundaryConform ()
 Insert point-pairs where there are protrusions into. More...
 
void removeSurfacePointPairs ()
 Remove the point-pairs introduced by insertSurfacePointPairs. More...
 
void movePoint (const Vertex_handle &vh, const Point &P)
 
void newPoints ()
 Move the internal points to the given new locations and update. More...
 
void extractPatches (wordList &patchNames, labelList &patchSizes, EdgeMap< label > &mapEdgesRegion, EdgeMap< label > &indirectPatchEdge) const
 Extract patch names and sizes. More...
 
void writePoints (const fileName &fName, bool internalOnly) const
 Write internal points to .obj file. More...
 
void writeTriangles (const fileName &fName, bool internalOnly) const
 Write triangles as .obj file. More...
 
void writeFaces (const fileName &fName, bool internalOnly) const
 Write dual faces as .obj file. More...
 
void calcDual (point2DField &dualPoints, faceList &dualFaces, wordList &patchNames, labelList &patchSizes, EdgeMap< label > &mapEdgesRegion, EdgeMap< label > &indirectPatchEdge) const
 Calculates dual points (circumcentres of tets) and faces. More...
 
void writePatch (const fileName &fName) const
 Write patch. More...
 
void write () const
 

Data Fields

const typedef point2Dpoint2DFromPoint
 
const typedef PointPointFromPoint2D
 

Private Member Functions

 CV2D (const CV2D &)
 Disallow default bitwise copy construct. More...
 
void operator= (const CV2D &)
 Disallow default bitwise assignment. More...
 
label insertPoint (const point2D &pt, const label type)
 Insert point and return it's index. More...
 
label insertPoint (const point2D &pt, const label index, const label type)
 Insert point and return it's index. More...
 
label insertPoint (const Point &p, const label index, const label type)
 
bool insertMirrorPoint (const point2D &nearSurfPt, const point2D &surfPt)
 
void insertPointPair (const scalar mirrorDist, const point2D &surfPt, const vector2D &n)
 Insert a point-pair at a distance ppDist either side of. More...
 
void insertBoundingBox ()
 Create the initial mesh from the bounding-box. More...
 
bool on2DLine (const point2D &p, const linePointRef &line)
 Check if a point is within a line. More...
 
void insertFeaturePoints ()
 Insert point groups at the feature points. More...
 
void reinsertFeaturePoints ()
 Re-insert point groups at the feature points. More...
 
void insertPointPairs (const DynamicList< point2D > &nearSurfacePoints, const DynamicList< point2D > &surfacePoints, const DynamicList< label > &surfaceTris, const DynamicList< label > &surfaceHits, const fileName fName)
 Insert point-pairs at the given set of points using the surface. More...
 
bool dualCellSurfaceIntersection (const Triangulation::Finite_vertices_iterator &vit) const
 Check to see if dual cell specified by given vertex iterator. More...
 
void insertSurfaceNearestPointPairs ()
 Insert point-pairs at the nearest points on the surface to the. More...
 
void insertSurfaceNearPointPairs ()
 Insert point-pairs at small dual-cell edges on the surface in order. More...
 
void insertPointPair (Triangulation::Finite_vertices_iterator &vit, const point2D &p, const label trii, const label hitSurface)
 Insert point-pair and correcting the Finite_vertices_iterator. More...
 
bool insertPointPairAtIntersection (Triangulation::Finite_vertices_iterator &vit, const point2D &defVert, const point2D vertices[], const scalar maxProtSize)
 Insert point-pair at the best intersection point between the lines. More...
 
label insertBoundaryConformPointPairs (const fileName &fName)
 Insert point-pairs corresponding to dual-cells which intersect. More...
 
void markNearBoundaryPoints ()
 
void fast_restore_Delaunay (Vertex_handle vh)
 Restore the Delaunay contraint. More...
 
void external_flip (Face_handle &f, int i)
 
bool internal_flip (Face_handle &f, int i)
 
void write (const word &stage) const
 Write all the faces and all the triangles at a particular stage. More...
 

Private Attributes

const TimerunTime_
 The time registry of the application. More...
 
Random rndGen_
 
searchableSurfaces allGeometry_
 The surface to mesh. More...
 
conformationSurfaces qSurf_
 
cv2DControls controls_
 Meshing controls. More...
 
cellSizeAndAlignmentControls cellSizeControl_
 The cell size control object. More...
 
autoPtr< relaxationModelrelaxationModel_
 Relaxation coefficient model. Runtime selectable. More...
 
scalar z_
 z-level More...
 
label startOfInternalPoints_
 Keep track of the start of the internal points. More...
 
label startOfSurfacePointPairs_
 Keep track of the start of the surface point-pairs. More...
 
label startOfBoundaryConformPointPairs_
 Keep track of the boundary conform point-pairs. More...
 
std::list< VbfeaturePoints_
 Store the feature points. More...
 
point2D vertices [maxNvert+1]
 
vector2D edges [maxNvert+1]
 

Static Private Attributes

static const label maxNvert = 20
 Temporary storage for a dual-cell. More...
 

Detailed Description

Conformal-Voronoi 2D automatic mesher with grid or read initial points and point position relaxation with optional "squarification".

There are a substantial number of options to this mesher read from CV2DMesherDict file e.g.:

Min cell size used in tolerances when inserting points for boundary conforming. Also used to as the grid spacing usind in insertGrid. minCellSize 0.05;

Feature angle used to inser feature points 0 = all features, 180 = no features featureAngle 45;

Maximum quadrant angle allowed at a concave corner before additional "mitering" lines are added maxQuadAngle 110;

Should the mesh be square-dominated or of unbiased hexagons squares yes;

Near-wall region where cells are aligned with the wall specified as a number of cell layers nearWallAlignedDist 3;

Chose if the cell orientation should relax during the iterations or remain fixed to the x-y directions relaxOrientation no;

Insert near-boundary point mirror or point-pairs insertSurfaceNearestPointPairs yes;

Mirror near-boundary points rather than insert point-pairs mirrorPoints no;

Insert point-pairs vor dual-cell vertices very near the surface insertSurfaceNearPointPairs yes;

Choose if to randomise the initial grid created by insertGrid. randomiseInitialGrid yes;

Perturbation fraction, 1 = cell-size. randomPurturbation 0.1;

Number of relaxation iterations. nIterations 5;

Relaxation factor at the start of the iteration sequence. 0.5 is a sensible maximum and < 0.2 converges better. relaxationFactorStart 0.8;

Relaxation factor at the end of the iteration sequence. Should be <= relaxationFactorStart relaxationFactorEnd 0;

writeInitialTriangulation no; writeFeatureTriangulation no; writeNearestTriangulation no; writeInsertedPointPairs no; writeFinalTriangulation yes;

Maximum number of iterations used in boundaryConform. maxBoundaryConformingIter 5;

minEdgeLenCoeff 0.5; maxNotchLenCoeff 0.3; minNearPointDistCoeff 0.25; ppDistCoeff 0.05;

Source files

Definition at line 146 of file CV2D.H.

Constructor & Destructor Documentation

◆ CV2D() [1/2]

CV2D ( const CV2D )
private

Disallow default bitwise copy construct.

◆ CV2D() [2/2]

CV2D ( const Time runTime,
const dictionary controlDict 
)

Construct for given surface.

◆ ~CV2D()

~CV2D ( )

Destructor.

Member Function Documentation

◆ operator=()

void operator= ( const CV2D )
private

Disallow default bitwise assignment.

◆ insertPoint() [1/3]

Foam::label insertPoint ( const point2D pt,
const label  type 
)
inlineprivate

Insert point and return it's index.

Definition at line 29 of file CV2DI.H.

References p, Foam::toPoint(), and Foam::type().

Here is the call graph for this function:

◆ insertPoint() [2/3]

Foam::label insertPoint ( const point2D pt,
const label  index,
const label  type 
)
inlineprivate

Insert point and return it's index.

Definition at line 41 of file CV2DI.H.

References p, Foam::toPoint(), and Foam::type().

Here is the call graph for this function:

◆ insertPoint() [3/3]

Foam::label insertPoint ( const Point p,
const label  index,
const label  type 
)
inlineprivate

Definition at line 52 of file CV2DI.H.

References Foam::endl(), insert(), p, Foam::type(), and WarningInFunction.

Here is the call graph for this function:

◆ insertMirrorPoint()

bool insertMirrorPoint ( const point2D nearSurfPt,
const point2D surfPt 
)
inlineprivate

Definition at line 78 of file CV2DI.H.

References indexedVertex::MIRROR_POINT.

◆ insertPointPair() [1/2]

void insertPointPair ( const scalar  mirrorDist,
const point2D surfPt,
const vector2D n 
)
inlineprivate

Insert a point-pair at a distance ppDist either side of.

surface point point surfPt in the direction n

Definition at line 98 of file CV2DI.H.

References n.

◆ insertBoundingBox()

void insertBoundingBox ( )
private

Create the initial mesh from the bounding-box.

◆ on2DLine()

bool on2DLine ( const point2D p,
const linePointRef line 
)
private

Check if a point is within a line.

◆ insertFeaturePoints()

void insertFeaturePoints ( )
private

Insert point groups at the feature points.

◆ reinsertFeaturePoints()

void reinsertFeaturePoints ( )
private

Re-insert point groups at the feature points.

◆ insertPointPairs()

void insertPointPairs ( const DynamicList< point2D > &  nearSurfacePoints,
const DynamicList< point2D > &  surfacePoints,
const DynamicList< label > &  surfaceTris,
const DynamicList< label > &  surfaceHits,
const fileName  fName 
)
private

Insert point-pairs at the given set of points using the surface.

normals corresponding to the given set of surface triangles and write the inserted point locations to the given file.

◆ dualCellSurfaceIntersection()

bool dualCellSurfaceIntersection ( const Triangulation::Finite_vertices_iterator &  vit) const
private

Check to see if dual cell specified by given vertex iterator.

intersects the boundary and hence reqires a point-pair.

◆ insertSurfaceNearestPointPairs()

void insertSurfaceNearestPointPairs ( )
private

Insert point-pairs at the nearest points on the surface to the.

control vertex of dual-cells which intersect the boundary in order to provide a boundary-layer mesh. NB: This is not guaranteed to close the boundary

◆ insertSurfaceNearPointPairs()

void insertSurfaceNearPointPairs ( )
private

Insert point-pairs at small dual-cell edges on the surface in order.

to improve the boundary-layer mesh generated by insertSurfaceNearestPointPairs.

◆ insertPointPair() [2/2]

void insertPointPair ( Triangulation::Finite_vertices_iterator &  vit,
const point2D p,
const label  trii,
const label  hitSurface 
)
private

Insert point-pair and correcting the Finite_vertices_iterator.

to account for the additional vertices

◆ insertPointPairAtIntersection()

bool insertPointPairAtIntersection ( Triangulation::Finite_vertices_iterator &  vit,
const point2D defVert,
const point2D  vertices[],
const scalar  maxProtSize 
)
private

Insert point-pair at the best intersection point between the lines.

from the dual-cell real centroid and it's vertices and the surface.

◆ insertBoundaryConformPointPairs()

label insertBoundaryConformPointPairs ( const fileName fName)
private

Insert point-pairs corresponding to dual-cells which intersect.

the boundary surface

◆ markNearBoundaryPoints()

void markNearBoundaryPoints ( )
private

◆ fast_restore_Delaunay()

void fast_restore_Delaunay ( Vertex_handle  vh)
private

Restore the Delaunay contraint.

◆ external_flip()

void external_flip ( Face_handle &  f,
int  i 
)
private

◆ internal_flip()

bool internal_flip ( Face_handle &  f,
int  i 
)
private

◆ write() [1/2]

void write ( const word stage) const
private

Write all the faces and all the triangles at a particular stage.

◆ ClassName()

ClassName ( "CV2D"  )

Runtime type information.

◆ meshControls()

const Foam::cv2DControls & meshControls ( ) const
inline

Definition at line 118 of file CV2DI.H.

References CV2D::controls_.

◆ toPoint2D() [1/3]

const Foam::point2D & toPoint2D ( const point p) const
inline

Definition at line 124 of file CV2DI.H.

References p.

◆ toPoint2D() [2/3]

const Foam::point2DField toPoint2D ( const pointField p) const
inline

Definition at line 130 of file CV2DI.H.

References forAll, p, x, and y.

◆ toPoint3D() [1/2]

Foam::point toPoint3D ( const point2D p) const
inline

Definition at line 141 of file CV2DI.H.

References p.

◆ toPoint2D() [3/3]

Foam::CV2D::point2DFromPoint toPoint2D ( const Point P) const
inline

Definition at line 162 of file CV2DI.H.

◆ toPoint()

Foam::CV2D::PointFromPoint2D toPoint ( const point2D p) const
inline

Definition at line 168 of file CV2DI.H.

References p.

◆ toPoint3D() [2/2]

Foam::point toPoint3D ( const Point P) const
inline

Definition at line 176 of file CV2DI.H.

◆ insertPoints() [1/2]

void insertPoints ( const point2DField points,
const scalar  nearness 
)

Create the initial mesh from the given internal points.

Points must be inside the boundary by at least nearness otherwise they are ignored.

◆ insertPoints() [2/2]

void insertPoints ( const fileName pointFileName)

Create the initial mesh from the internal points in the given.

file. Points outside the geometry are ignored.

◆ insertGrid()

void insertGrid ( )

Create the initial mesh as a regular grid of points.

Points outside the geometry are ignored.

◆ insertSurfacePointPairs()

void insertSurfacePointPairs ( )

Insert all surface point-pairs from.

insertSurfaceNearestPointPairs and findIntersectionForOutsideCentroid

◆ boundaryConform()

void boundaryConform ( )

Insert point-pairs where there are protrusions into.

or out of the surface

◆ removeSurfacePointPairs()

void removeSurfacePointPairs ( )

Remove the point-pairs introduced by insertSurfacePointPairs.

and boundaryConform

◆ movePoint()

void movePoint ( const Vertex_handle &  vh,
const Point P 
)
inline

Definition at line 182 of file CV2DI.H.

References insert().

Here is the call graph for this function:

◆ newPoints()

void newPoints ( )

Move the internal points to the given new locations and update.

the triangulation to ensure it is Delaunay void moveInternalPoints(const point2DField& newPoints); Calculate the displacements to create the new points

◆ extractPatches()

void extractPatches ( wordList patchNames,
labelList patchSizes,
EdgeMap< label > &  mapEdgesRegion,
EdgeMap< label > &  indirectPatchEdge 
) const

Extract patch names and sizes.

◆ writePoints()

void writePoints ( const fileName fName,
bool  internalOnly 
) const

Write internal points to .obj file.

◆ writeTriangles()

void writeTriangles ( const fileName fName,
bool  internalOnly 
) const

Write triangles as .obj file.

◆ writeFaces()

void writeFaces ( const fileName fName,
bool  internalOnly 
) const

Write dual faces as .obj file.

◆ calcDual()

void calcDual ( point2DField dualPoints,
faceList dualFaces,
wordList patchNames,
labelList patchSizes,
EdgeMap< label > &  mapEdgesRegion,
EdgeMap< label > &  indirectPatchEdge 
) const

Calculates dual points (circumcentres of tets) and faces.

(point-cell walk of tets). Returns:

  • dualPoints (in triangle ordering)
  • dualFaces (compacted)

◆ writePatch()

void writePatch ( const fileName fName) const

Write patch.

◆ write() [2/2]

void write ( ) const

Field Documentation

◆ point2DFromPoint

const typedef point2D& point2DFromPoint

Definition at line 356 of file CV2D.H.

◆ PointFromPoint2D

const typedef Point& PointFromPoint2D

Definition at line 357 of file CV2D.H.

◆ runTime_

const Time& runTime_
private

The time registry of the application.

Definition at line 156 of file CV2D.H.

◆ rndGen_

Random rndGen_
mutableprivate

Definition at line 158 of file CV2D.H.

◆ allGeometry_

searchableSurfaces allGeometry_
private

The surface to mesh.

const querySurface& qSurf_; ! All geometry of the meshing process, including surfaces to be /*! conformed to and those to be used for refinement

Definition at line 164 of file CV2D.H.

◆ qSurf_

conformationSurfaces qSurf_
private

Definition at line 166 of file CV2D.H.

◆ controls_

cv2DControls controls_
private

Meshing controls.

Definition at line 169 of file CV2D.H.

Referenced by CV2D::meshControls().

◆ cellSizeControl_

cellSizeAndAlignmentControls cellSizeControl_
private

The cell size control object.

Definition at line 172 of file CV2D.H.

◆ relaxationModel_

autoPtr<relaxationModel> relaxationModel_
private

Relaxation coefficient model. Runtime selectable.

Definition at line 175 of file CV2D.H.

◆ z_

scalar z_
private

z-level

Definition at line 178 of file CV2D.H.

◆ startOfInternalPoints_

label startOfInternalPoints_
private

Keep track of the start of the internal points.

Definition at line 181 of file CV2D.H.

◆ startOfSurfacePointPairs_

label startOfSurfacePointPairs_
private

Keep track of the start of the surface point-pairs.

Definition at line 184 of file CV2D.H.

◆ startOfBoundaryConformPointPairs_

label startOfBoundaryConformPointPairs_
private

Keep track of the boundary conform point-pairs.

stored after the insertion of the surface point-pairs in case the boundary conform function is called more than once without removing and insertin the surface point-pairs

Definition at line 190 of file CV2D.H.

◆ featurePoints_

std::list<Vb> featurePoints_
private

Store the feature points.

Definition at line 193 of file CV2D.H.

◆ maxNvert

const label maxNvert = 20
staticprivate

Temporary storage for a dual-cell.

Definition at line 196 of file CV2D.H.

◆ vertices

point2D vertices[maxNvert+1]
mutableprivate

Definition at line 197 of file CV2D.H.

◆ edges

vector2D edges[maxNvert+1]
mutableprivate

Definition at line 198 of file CV2D.H.


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