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 | Copyright (C) 2011 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  //- Disallow default bitwise copy construct
117 
118  //- Disallow default bitwise assignment
119  void operator=(const faceCollapser&);
120 
121 
122 public:
123 
124  //- Runtime type information
125  ClassName("faceCollapser");
126 
127 
128  // Constructors
129 
130  //- Construct from mesh.
131  faceCollapser(const polyMesh& mesh);
132 
133 
134  // Member Functions
135 
136  // Edit
137 
138  //- Collapse faces along endpoints. Play commands into
139  // polyTopoChange to create mesh.
140  void setRefinement
141  (
142  const labelList& faceLabels,
143  const labelList& fpA,
144  const labelList& fpB,
146  ) const;
147 
148  //- Update stored quantities for new mesh labels.
149  void updateMesh(const mapPolyMesh&)
150  {}
151 };
152 
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 } // End namespace Foam
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 #endif
161 
162 // ************************************************************************* //
Foam::faceCollapser::updateMesh
void updateMesh(const mapPolyMesh &)
Update stored quantities for new mesh labels.
Definition: faceCollapser.H:148
typeInfo.H
Foam::faceCollapser::filterFace
void filterFace(const Map< labelList > &splitEdges, const label faceI, polyTopoChange &meshMod) const
Replace vertices in face.
Definition: faceCollapser.C:94
point.H
Foam::polyTopoChange
Direct mesh changes based on v1.3 polyTopoChange syntax.
Definition: polyTopoChange.H:97
Foam::Map
A HashTable to objects of type <T> with a label key.
Definition: PrimitivePatchTemplate.H:68
Foam::HashSet< label, Hash< label > >
Foam::faceCollapser::findEdge
static label findEdge(const edgeList &edges, const labelList &edgeLabels, const label v0, const label v1)
Find edge amongst candidate edges.
Definition: faceCollapser.C:59
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Map.H
Foam::faceCollapser::ClassName
ClassName("faceCollapser")
Runtime type information.
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
labelList.H
HashSet.H
Foam::faceCollapser::setRefinement
void setRefinement(const labelList &faceLabels, const labelList &fpA, const labelList &fpB, polyTopoChange &) const
Collapse faces along endpoints. Play commands into.
Definition: faceCollapser.C:210
edgeList.H
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::faceCollapser::insert
static void insert(const labelList &elems, const label excludeElem, labelHashSet &set)
Insert labelList into labelHashSet. Optional excluded element.
Definition: faceCollapser.C:41
Foam::faceCollapser
Collapses faces into edges. Used to remove sliver faces (faces with small area but non-zero span).
Definition: faceCollapser.H:75
Foam::faceCollapser::faceCollapser
faceCollapser(const faceCollapser &)
Disallow default bitwise copy construct.
Foam::faceCollapser::mesh_
const polyMesh & mesh_
Reference to mesh.
Definition: faceCollapser.H:80
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
Foam::faceCollapser::operator=
void operator=(const faceCollapser &)
Disallow default bitwise assignment.