meshUntangler.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | cfMesh: A library for mesh generation
4  \\ / O peration |
5  \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6  \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of cfMesh.
10 
11  cfMesh is free software; you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by the
13  Free Software Foundation; either version 3 of the License, or (at your
14  option) any later version.
15 
16  cfMesh is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  meshUntangler
26 
27 Description
28  Mesh smoothing without any topological changes. The vertex is put
29  into the centre of the convex feasible region.
30 
31 SourceFiles
32  meshUntangler.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef meshUntangler_H
37 #define meshUntangler_H
38 
39 #include "simplexSmoother.H"
40 #include "polyMeshGen.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 // Forward declarations
48 class plane;
49 class partTetMeshSimplex;
50 
51 /*---------------------------------------------------------------------------*\
52  Class meshUntangler Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 class meshUntangler
56 :
57  public simplexSmoother
58 {
59  // Private nested classes
60 
61  class cutRegion
62  {
63  // Private data
67 
68  //- helper data
72 
78 
79  scalar tol_;
80  bool valid_;
81 
82  // Private member functions
83  bool findNewVertices(const plane& plane);
84  void findNewEdges();
85  void findNewFaces();
86 
87  //- tie break to resolve problems due to truncation
88  //- errors
89  void tieBreak(const DynList<label, 8>& f);
90 
91  //- remove coincident vertices to improve tie breaking
93 
95 
96  // Enumerations
97  enum vTypes
98  {
99  NONE = 0,
100  KEEP = 1,
101  INPLANE = 2,
102  USED = 4
103  };
104 
105  public:
106 
107  // Constructor
108  //- Construct from boundBox
109  cutRegion(const boundBox&);
110 
111  // Destructor
112  ~cutRegion();
113 
114  // Member functions
115  //- return the vertices of the feasible region
116  inline const DynList<point, 64>& points() const
117  {
118  return *pointsPtr_;
119  }
120 
121  //- cut the region woth the plane
122  void planeCut(const plane& plane);
123 
124  //- export the feasible region as polyMeshGen
126  };
127 
128  public:
129 
130  // Constructor
131  //- Construct from partTetMeshSimplex
133 
134  // Destructor
135  ~meshUntangler();
136 
137  // Member functions
138  //- improve the position the the node by putting it
139  //- into the feasible region
140  void optimizeNodePosition(const scalar tol = 0.001);
141 };
142 
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 } // End namespace Foam
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 #endif
151 
152 // ************************************************************************* //
Foam::meshUntangler::cutRegion::planeCut
void planeCut(const plane &plane)
cut the region woth the plane
Definition: meshUntanglerCutRegion.C:195
Foam::meshUntangler::cutRegion::vertexTypes_
DynList< direction, 64 > vertexTypes_
Definition: meshUntangler.H:74
Foam::partTetMeshSimplex
Definition: partTetMeshSimplex.H:52
Foam::meshUntangler::cutRegion::KEEP
@ KEEP
Definition: meshUntangler.H:99
Foam::meshUntangler::cutRegion::facesPtr_
DynList< DynList< label, 8 >, 64 > * facesPtr_
Definition: meshUntangler.H:65
Foam::meshUntangler::cutRegion::USED
@ USED
Definition: meshUntangler.H:101
Foam::meshUntangler::cutRegion::edgesPtr_
DynList< edge, 128 > * edgesPtr_
Definition: meshUntangler.H:64
Foam::meshUntangler::optimizeNodePosition
void optimizeNodePosition(const scalar tol=0.001)
Definition: meshUntangler.C:60
Foam::meshUntangler::cutRegion::points
const DynList< point, 64 > & points() const
return the vertices of the feasible region
Definition: meshUntangler.H:115
Foam::polyMeshGen
Definition: polyMeshGen.H:46
Foam::meshUntangler::cutRegion::removeCoincidentVertices
void removeCoincidentVertices()
remove coincident vertices to improve tie breaking
Definition: meshUntanglerCutRegionPoints.C:115
Foam::plane
Geometric class that creates a 2D plane and can return the intersection point between a line and the ...
Definition: plane.H:60
Foam::meshUntangler::cutRegion::tieBreak
void tieBreak(const DynList< label, 8 > &f)
Definition: meshUntanglerCutRegionTieBreak.C:41
Foam::meshUntangler::cutRegion::valid_
bool valid_
Definition: meshUntangler.H:79
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::simplexSmoother
class for volume optimizer
Definition: simplexSmoother.H:56
Foam::meshUntangler::cutRegion::createInitialConfiguration
void createInitialConfiguration(const boundBox &)
Definition: meshUntanglerCutRegion.C:50
partTetMeshSimplex
A simplex which is used for smoothing purposes.
polyMeshGen.H
Foam::meshUntangler
Definition: meshUntangler.H:54
Foam::meshUntangler::cutRegion::cFacesPtr_
DynList< DynList< label, 8 >, 64 > * cFacesPtr_
Definition: meshUntangler.H:70
Foam::meshUntangler::cutRegion::tol_
scalar tol_
Definition: meshUntangler.H:78
Foam::meshUntangler::cutRegion::NONE
@ NONE
Definition: meshUntangler.H:98
Foam::meshUntangler::cutRegion::vTypes
vTypes
Definition: meshUntangler.H:96
Foam::meshUntangler::cutRegion::newEdgeLabel_
DynList< label, 128 > newEdgeLabel_
Definition: meshUntangler.H:75
Foam::meshUntangler::cutRegion
Definition: meshUntangler.H:60
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::DynList
Definition: DynList.H:53
Foam::meshUntangler::cutRegion::cEdgesPtr_
DynList< edge, 128 > * cEdgesPtr_
Definition: meshUntangler.H:69
Foam::meshUntangler::meshUntangler
meshUntangler(partTetMeshSimplex &simplex)
Construct from partTetMeshSimplex.
Definition: meshUntangler.C:47
Foam::meshUntangler::cutRegion::cPtsPtr_
DynList< point, 64 > * cPtsPtr_
helper data
Definition: meshUntangler.H:68
Foam::meshUntangler::cutRegion::findNewVertices
bool findNewVertices(const plane &plane)
Definition: meshUntanglerCutRegionPoints.C:50
Foam::meshUntangler::cutRegion::findNewFaces
void findNewFaces()
Definition: meshUntanglerCutRegionFaces.C:44
Foam::meshUntangler::cutRegion::findNewEdges
void findNewEdges()
Definition: meshUntanglerCutRegionEdges.C:40
f
labelList f(nPoints)
Foam::meshUntangler::cutRegion::INPLANE
@ INPLANE
Definition: meshUntangler.H:100
Foam::meshUntangler::cutRegion::pointsPtr_
DynList< point, 64 > * pointsPtr_
Definition: meshUntangler.H:63
Foam::boundBox
A bounding box defined in terms of the points at its extremities.
Definition: boundBox.H:55
Foam::meshUntangler::cutRegion::newVertexLabel_
DynList< label, 64 > newVertexLabel_
Definition: meshUntangler.H:72
Foam::meshUntangler::cutRegion::vertexDistance_
DynList< scalar, 64 > vertexDistance_
Definition: meshUntangler.H:73
Foam::meshUntangler::cutRegion::cutRegion
cutRegion(const boundBox &)
Construct from boundBox.
Definition: meshUntanglerCutRegion.C:164
Foam::meshUntangler::~meshUntangler
~meshUntangler()
Definition: meshUntangler.C:55
Foam::meshUntangler::cutRegion::~cutRegion
~cutRegion()
Definition: meshUntanglerCutRegion.C:183
simplexSmoother.H
Foam::meshUntangler::cutRegion::createPolyMeshFromRegion
void createPolyMeshFromRegion(polyMeshGen &) const
export the feasible region as polyMeshGen
Definition: meshUntanglerCutRegion.C:249
Foam::meshUntangler::cutRegion::origNumVertices_
label origNumVertices_
Definition: meshUntangler.H:76