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 Given list of faces to remove insert all the topology changes. Contains
30 helper function to get consistent set of faces to remove.
32 Not very well tested in parallel.
37 \*---------------------------------------------------------------------------*/
46 #include "indirectPrimitivePatch.H"
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 // Forward declaration of classes
58 class mapDistributePolyMesh;
60 /*---------------------------------------------------------------------------*\
61 Class removeFaces Declaration
62 \*---------------------------------------------------------------------------*/
69 const polyMesh& mesh_;
71 //- Cosine of angles between boundary faces. Boundary faces can be
72 // merged only if angle between faces > minCos.
76 // Private Member Functions
78 //- Change elements in cellRegion that are oldRegion to newRegion.
79 // Recurses to cell neighbours.
83 const label oldRegion,
84 const label newRegion,
88 //- Changes region of connected set of faces
89 label changeFaceRegion
91 const labelList& cellRegion,
92 const boolList& removedFace,
93 const labelList& nFacesPerEdge,
95 const label newRegion,
96 const labelList& fEdges,
100 //- Get all affected faces (including faces marked for removal)
101 boolList getFacesAffected
103 const labelList& cellRegion,
104 const labelList& cellRegionMaster,
105 const labelList& facesToRemove,
106 const labelHashSet& edgesToRemove,
107 const labelHashSet& pointsToRemove
111 // Topological changes
113 //- Debug: write set of faces to file in obj format.
116 const indirectPrimitivePatch&,
120 //- Merge faceLabels into single face.
123 const labelList& cellRegion,
124 const labelList& cellRegionMaster,
125 const labelHashSet& pointsToRemove,
126 const labelList& faceLabels,
127 polyTopoChange& meshMod
130 //- Get patch, zone info for faceI
139 //- Return face with all pointsToRemove removed.
140 face filterFace(const labelHashSet& pointsToRemove, const label)
143 //- Wrapper for meshMod.modifyFace. Reverses face if own>nei.
147 const label masterFaceID,
150 const bool flipFaceFlux,
151 const label newPatchID,
152 const bool removeFromZone,
156 polyTopoChange& meshMod
161 //- Disallow default bitwise copy construct
162 removeFaces(const removeFaces&);
164 //- Disallow default bitwise assignment
165 void operator=(const removeFaces&);
170 //- Runtime type information
171 ClassName("removeFaces");
176 //- Construct from mesh and min cos of angle for boundary faces
177 // to be considered aligned. Set to >= 1 to disable checking
178 // and always merge (if on same patch)
179 removeFaces(const polyMesh&, const scalar minCos);
183 //- Given set of faces to pierce calculates:
184 // - region for connected cells
185 // - mastercell for each region. This is the lowest numbered cell
186 // of all cells that get merged.
187 // - new set of faces which contains input set + additional ones
188 // where cells on both sides would have same mastercell.
189 // Returns number of regions.
190 label compatibleRemoves
192 const labelList& inPiercedFaces,
193 labelList& cellRegion,
194 labelList& cellRegionMaster,
195 labelList& outPiercedFaces
199 //- Play commands into polyTopoChange to remove faces.
202 const labelList& piercedFaces,
203 const labelList& cellRegion,
204 const labelList& cellRegionMaster,
208 //- Force recalculation of locally stored data on topological change
209 void updateMesh(const mapPolyMesh&)
212 //- Force recalculation of locally stored data for mesh distribution
213 void distribute(const mapDistributePolyMesh&)
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 } // End namespace Foam
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 // ************************************************************************* //