initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / dynamicMesh / polyTopoChange / polyTopoChange / faceCollapser.H
blob57487a91390ec8826401742e66c3b1e5c821dede
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
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.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::faceCollapser
28 Description
29     Collapses faces into edges. Used to remove sliver faces (faces with small
30     area but non-zero span).
32     Passed in as
33     - face label
34     - the two indices in the face (fpA, fpB) which delimit the vertices to be
35       kept.
37     Takes the vertices outside the range fpA..fpB and projects them onto the
38     kept edges (edges using kept vertices only).
40     Note:
41     - Use in combination with edge collapse to cleanup meshes.
42     - Can not remove cells so will mess up trying to remove a face on a tet.
43     - WIP. Should be combined with edge collapsing and cell collapsing into
44       proper 'collapser'.
45     - Caller is responsible for making sure kept vertices (fpA..fpB) for one
46       face are not the vertices to be removed for another face.
48 SourceFiles
49     faceCollapser.C
51 \*---------------------------------------------------------------------------*/
53 #ifndef faceCollapser_H
54 #define faceCollapser_H
56 #include "labelList.H"
57 #include "point.H"
58 #include "Map.H"
59 #include "HashSet.H"
60 #include "typeInfo.H"
61 #include "edgeList.H"
63 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
65 namespace Foam
68 // Forward declaration of classes
69 class polyMesh;
70 class polyTopoChange;
71 class mapPolyMesh;
73 /*---------------------------------------------------------------------------*\
74                            Class faceCollapser Declaration
75 \*---------------------------------------------------------------------------*/
77 class faceCollapser
79     // Private data
81         //- Reference to mesh
82         const polyMesh& mesh_;
85     // Static Functions
87         //- Insert labelList into labelHashSet. Optional excluded element.
88         static void insert
89         (
90             const labelList& elems,
91             const label excludeElem,
92             labelHashSet& set
93         );
95         //- Find edge amongst candidate edges.
96         static label findEdge
97         (
98             const edgeList& edges,
99             const labelList& edgeLabels,
100             const label v0,
101             const label v1
102         );
105     // Private Member Functions
107         //- Replace vertices in face
108         void filterFace
109         (
110             const Map<labelList>& splitEdges,
111             const label faceI,
112             polyTopoChange& meshMod
113         ) const;
116         //- Disallow default bitwise copy construct
117         faceCollapser(const faceCollapser&);
119         //- Disallow default bitwise assignment
120         void operator=(const faceCollapser&);
123 public:
125     //- Runtime type information
126     ClassName("faceCollapser");
129     // Constructors
131         //- Construct from mesh.
132         faceCollapser(const polyMesh& mesh);
135     // Member Functions
137         // Edit
139             //- Collapse faces along endpoints. Play commands into
140             //  polyTopoChange to create mesh.
141             void setRefinement
142             (
143                 const labelList& faceLabels,
144                 const labelList& fpA,
145                 const labelList& fpB,
146                 polyTopoChange&
147             ) const;
149             //- Update stored quantities for new mesh labels.
150             void updateMesh(const mapPolyMesh&)
151             {}
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 } // End namespace Foam
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 #endif
163 // ************************************************************************* //