1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
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
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
29 Combines boundary faces into single face. The faces get the patch
30 of the first face ('the master')
35 \*---------------------------------------------------------------------------*/
37 #ifndef combineFaces_H
38 #define combineFaces_H
40 #include "indirectPrimitivePatch.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 // Forward declaration of classes
53 /*---------------------------------------------------------------------------*\
54 Class combineFaces Declaration
55 \*---------------------------------------------------------------------------*/
62 const polyMesh& mesh_;
67 //- If undoable: masterface for every set.
68 labelList masterFace_;
70 //- If undoable: per set the vertices of all the faces in the set.
71 List<faceList> faceSetsVertices_;
73 //- If undoable: saved point labels.
74 labelList savedPointLabels_;
76 //- If undoable: saved coordinates of above points.
77 pointField savedPoints_;
81 // Private Member Functions
83 //- Test if face is convex. Allow slight concavity through
85 static bool convexFace
87 const scalar minConcaveCos,
92 //- Test if set of faces (in primitivePatch) can be combined into
93 // single face. Uses convexFace.
96 const scalar minConcaveCos,
97 const indirectPrimitivePatch&
100 //- Create cell-local map from face to region (formed by merging faces
106 const labelList& cEdges,
107 Map<label>& faceRegion
110 //- Does merging faces invalidate (unmerged) neighbouring faces?
111 bool faceNeighboursValid
114 const Map<label>& faceRegion
119 //- Disallow default bitwise copy construct
120 combineFaces(const combineFaces&);
122 //- Disallow default bitwise assignment
123 void operator=(const combineFaces&);
127 //- Runtime type information
128 ClassName("combineFaces");
133 //- Construct from mesh
134 combineFaces(const polyMesh& mesh, const bool undoable = false);
141 //- If undoable: masterface for every set.
142 const labelList& masterFace() const
147 //- If undoable: set of original point labels of stored points
148 const labelList& savedPointLabels() const
150 return savedPointLabels_;
156 //- Extract lists of all (non-coupled) boundary faces on selected
157 // cells that can be merged. Uses getFaceRegions.
158 labelListList getMergeSets
160 const scalar featureCos,
161 const scalar minConcaveCos,
162 const labelHashSet& boundaryCells
165 //- Extract lists of all (non-coupled) boundary faces that can
166 // be merged. Uses getFaceRegions.
167 labelListList getMergeSets
169 const scalar featureCos,
170 const scalar minConcaveCos
173 //- Gets outside of patch as a face (in mesh point labels)
174 static face getOutsideFace(const indirectPrimitivePatch&);
179 //- Play commands into polyTopoChange to combine faces. Gets
180 // labelListList of sets of faces to combine. Does no check
181 // for whether resulting face is legal.
184 const labelListList&,
188 //- Force recalculation of locally stored data on topological change
189 void updateMesh(const mapPolyMesh&);
191 //- Play commands into polyTopoChange to reinsert original faces.
192 // No other topo changes can be done inbetween setRefinement and
193 // setUnrefinement. Can be called multiple times to undo parts
194 // of the last setRefinement call.
195 // Gets the master face labels whose sets need to be restored.
196 // Returns maps from added restored point to
197 // original point label (i.e. content of savedPointLabels_).
198 // (only restoredPoints are actually set; rest are just for
202 const labelList& masterFaces,
203 polyTopoChange& meshMod,
204 Map<label>& restoredPoints,
205 Map<label>& restoredFaces,
206 Map<label>& restoredCells
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 } // End namespace Foam
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 // ************************************************************************* //