1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 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 Map<label>& faceRegion
109 //- Does merging faces invalidate (unmerged) neighbouring faces?
110 bool faceNeighboursValid
113 const Map<label>& faceRegion
118 //- Disallow default bitwise copy construct
119 combineFaces(const combineFaces&);
121 //- Disallow default bitwise assignment
122 void operator=(const combineFaces&);
126 //- Runtime type information
127 ClassName("combineFaces");
132 //- Construct from mesh
133 combineFaces(const polyMesh& mesh, const bool undoable = false);
140 //- If undoable: masterface for every set.
141 const labelList& masterFace() const
146 //- If undoable: set of original point labels of stored points
147 const labelList& savedPointLabels() const
149 return savedPointLabels_;
155 //- Extract lists of all (non-coupled) boundary faces on selected
156 // cells that can be merged. Uses getFaceRegions.
157 labelListList getMergeSets
159 const scalar featureCos,
160 const scalar minConcaveCos,
161 const labelHashSet& boundaryCells
164 //- Extract lists of all (non-coupled) boundary faces that can
165 // be merged. Uses getFaceRegions.
166 labelListList getMergeSets
168 const scalar featureCos,
169 const scalar minConcaveCos
172 //- Gets outside of patch as a face (in mesh point labels)
173 static face getOutsideFace(const indirectPrimitivePatch&);
178 //- Play commands into polyTopoChange to combine faces. Gets
179 // labelListList of sets of faces to combine. Does no check
180 // for whether resulting face is legal.
183 const labelListList&,
187 //- Force recalculation of locally stored data on topological change
188 void updateMesh(const mapPolyMesh&);
190 //- Play commands into polyTopoChange to reinsert original faces.
191 // No other topo changes can be done inbetween setRefinement and
192 // setUnrefinement. Can be called multiple times to undo parts
193 // of the last setRefinement call.
194 // Gets the master face labels whose sets need to be restored.
195 // Returns maps from added restored point to
196 // original point label (i.e. content of savedPointLabels_).
197 // (only restoredPoints are actually set; rest are just for
201 const labelList& masterFaces,
202 polyTopoChange& meshMod,
203 Map<label>& restoredPoints,
204 Map<label>& restoredFaces,
205 Map<label>& restoredCells
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 } // End namespace Foam
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 // ************************************************************************* //