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