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