1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
25 Foam::meshCutAndRemove
28 like meshCutter but also removes non-anchor side of cell.
33 \*---------------------------------------------------------------------------*/
35 #ifndef meshCutAndRemove_H
36 #define meshCutAndRemove_H
38 #include "edgeVertex.H"
40 #include "labelList.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 // Forward declaration of classes
57 /*---------------------------------------------------------------------------*\
58 Class meshCutAndRemove Declaration
59 \*---------------------------------------------------------------------------*/
61 class meshCutAndRemove
67 //- Faces added in last setRefinement. Per split cell label of added
69 Map<label> addedFaces_;
71 //- Points added in last setRefinement. Per split edge label of added
73 HashTable<label, edge, Hash<edge> > addedPoints_;
76 // Private Static Functions
78 // Returns -1 or index in elems1 of first shared element.
79 static label firstCommon(const labelList& lst1, const labelList& lst2);
81 //- Do the elements of edge appear in consecutive order in the list
82 static bool isIn(const edge&, const labelList&);
85 // Private Member Functions
87 //- Returns -1 or the cell in cellLabels that is cut.
88 label findCutCell(const cellCuts&, const labelList&) const;
90 //- Returns first pointI in pointLabels that uses an internal
91 // face. Used to find point to inflate cell/face from (has to be
92 // connected to internal face)
93 label findInternalFacePoint(const labelList& pointLabels) const;
95 //- Find point on face that is part of original mesh and that is
96 // point connected to the patch
97 label findPatchFacePoint(const face& f, const label patchI) const;
99 //- Get new owner and neighbour of face. Checks anchor points to see if
100 // need to get original or added cell.
103 const cellCuts& cuts,
104 const label exposedPatchI,
111 //- Get zone information for face.
119 //- Adds a face from point. Flips face if owner>neighbour
122 polyTopoChange& meshMod,
124 const label masterPointI,
127 const label neighbour,
131 //- Modifies existing faceI for either new owner/neighbour or
132 // new face points. Checks if anything changed and flips face
133 // if owner>neighbour
136 polyTopoChange& meshMod,
140 const label neighbour,
144 // Copies face starting from startFp. Jumps cuts. Marks visited
145 // vertices in visited.
154 //- Split face along cut into two faces. Faces are in same point
155 // order as original face (i.e. maintain normal direction)
166 //- Add cuts of edges to face
167 face addEdgeCutsToFace(const label faceI) const;
169 //- Convert loop of cuts into face.
173 const labelList& loop
178 //- Disallow default bitwise copy construct
179 meshCutAndRemove(const meshCutAndRemove&);
181 //- Disallow default bitwise assignment
182 void operator=(const meshCutAndRemove&);
186 //- Runtime type information
187 ClassName("meshCutAndRemove");
192 //- Construct from mesh
193 meshCutAndRemove(const polyMesh& mesh);
200 //- Do actual cutting with cut description. Inserts mesh changes
202 // cuts: all loops and topological information
203 // cutPatch: for every cell that has loop the patch number
204 // exposedPatch: patch for other exposed faces
207 const label exposedPatchI,
208 const cellCuts& cuts,
209 const labelList& cutPatch,
210 polyTopoChange& meshMod
213 //- Force recalculation of locally stored data on topological change
214 void updateMesh(const mapPolyMesh&);
219 //- Faces added. Per split cell label of added face
220 const Map<label>& addedFaces() const
225 //- Points added. Per split edge label of added point.
226 // (note: fairly useless across topology changes since one of the
227 // points of the edge will probably disappear)
228 const HashTable<label, edge, Hash<edge> >& addedPoints() const
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237 } // End namespace Foam
239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243 // ************************************************************************* //