faceCollapser.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::faceCollapser
26 
27 Description
28  Collapses faces into edges. Used to remove sliver faces (faces with small
29  area but non-zero span).
30 
31  Passed in as
32  - face label
33  - the two indices in the face (fpA, fpB) which delimit the vertices to be
34  kept.
35 
36  Takes the vertices outside the range fpA..fpB and projects them onto the
37  kept edges (edges using kept vertices only).
38 
39  Note:
40  - Use in combination with edge collapse to cleanup meshes.
41  - Can not remove cells so will mess up trying to remove a face on a tet.
42  - WIP. Should be combined with edge collapsing and cell collapsing into
43  proper 'collapser'.
44  - Caller is responsible for making sure kept vertices (fpA..fpB) for one
45  face are not the vertices to be removed for another face.
46 
47 SourceFiles
48  faceCollapser.C
49 
50 \*---------------------------------------------------------------------------*/
51 
52 #ifndef faceCollapser_H
53 #define faceCollapser_H
54 
55 #include "labelList.H"
56 #include "point.H"
57 #include "Map.H"
58 #include "HashSet.H"
59 #include "typeInfo.H"
60 #include "edgeList.H"
61 
62 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
63 
64 namespace Foam
65 {
66 
67 // Forward declaration of classes
68 class polyMesh;
69 class polyTopoChange;
70 class mapPolyMesh;
71 
72 /*---------------------------------------------------------------------------*\
73  Class faceCollapser Declaration
74 \*---------------------------------------------------------------------------*/
75 
76 class faceCollapser
77 {
78  // Private Data
79 
80  //- Reference to mesh
81  const polyMesh& mesh_;
82 
83 
84  // Static Functions
85 
86  //- Insert labelList into labelHashSet. Optional excluded element.
87  static void insert
88  (
89  const labelList& elems,
90  const label excludeElem,
91  labelHashSet& set
92  );
93 
94  //- Find edge amongst candidate edges.
95  static label findEdge
96  (
97  const edgeList& edges,
98  const labelList& edgeLabels,
99  const label v0,
100  const label v1
101  );
102 
103 
104  // Private Member Functions
105 
106  //- Replace vertices in face
107  void filterFace
108  (
109  const Map<labelList>& splitEdges,
110  const label facei,
111  polyTopoChange& meshMod
112  ) const;
113 
114 
115 public:
116 
117  //- Runtime type information
118  ClassName("faceCollapser");
119 
120 
121  // Constructors
122 
123  //- Construct from mesh.
124  faceCollapser(const polyMesh& mesh);
125 
126  //- Disallow default bitwise copy construction
127  faceCollapser(const faceCollapser&) = delete;
128 
129 
130  // Member Functions
131 
132  // Edit
133 
134  //- Collapse faces along endpoints. Play commands into
135  // polyTopoChange to create mesh.
136  void setRefinement
137  (
138  const labelList& faceLabels,
139  const labelList& fpA,
140  const labelList& fpB,
142  ) const;
143 
144  //- Update stored quantities for new mesh labels.
145  void updateMesh(const mapPolyMesh&)
146  {}
147 
148 
149  // Member Operators
150 
151  //- Disallow default bitwise assignment
152  void operator=(const faceCollapser&) = delete;
153 };
154 
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 } // End namespace Foam
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 #endif
163 
164 // ************************************************************************* //
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
ClassName("faceCollapser")
Runtime type information.
faceCollapser(const polyMesh &mesh)
Construct from mesh.
void setRefinement(const labelList &faceLabels, const labelList &fpA, const labelList &fpB, polyTopoChange &) const
Collapse faces along endpoints. Play commands into.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
dynamicFvMesh & mesh
Collapses faces into edges. Used to remove sliver faces (faces with small area but non-zero span)...
Definition: faceCollapser.H:75
void operator=(const faceCollapser &)=delete
Disallow default bitwise assignment.
void updateMesh(const mapPolyMesh &)
Update stored quantities for new mesh labels.
Direct mesh changes based on v1.3 polyTopoChange syntax.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Namespace for OpenFOAM.
A HashTable to objects of type <T> with a label key.
Definition: Map.H:49