meshCutAndRemove.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 Class
25  Foam::meshCutAndRemove
26 
27 Description
28  like meshCutter but also removes non-anchor side of cell.
29 
30 SourceFiles
31  meshCutAndRemove.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef meshCutAndRemove_H
36 #define meshCutAndRemove_H
37 
38 #include "edgeVertex.H"
39 #include "boolList.H"
40 #include "labelList.H"
41 #include "typeInfo.H"
42 #include "Map.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 // Forward declaration of classes
50 class Time;
51 class polyTopoChange;
52 class cellCuts;
53 class polyMesh;
54 class face;
55 class mapPolyMesh;
56 
57 /*---------------------------------------------------------------------------*\
58  Class meshCutAndRemove Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 class meshCutAndRemove
62 :
63  public edgeVertex
64 {
65  // Private data
66 
67  //- Faces added in last setRefinement. Per split cell label of added
68  // face
70 
71  //- Points added in last setRefinement. Per split edge label of added
72  // point
74 
75 
76  // Private Static Functions
77 
78  // Returns -1 or index in elems1 of first shared element.
79  static label firstCommon(const labelList& lst1, const labelList& lst2);
80 
81  //- Do the elements of edge appear in consecutive order in the list
82  static bool isIn(const edge&, const labelList&);
83 
84 
85  // Private Member Functions
86 
87  //- Returns -1 or the cell in cellLabels that is cut.
88  label findCutCell(const cellCuts&, const labelList&) const;
89 
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)
94 
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;
98 
99  //- Get new owner and neighbour of face. Checks anchor points to see if
100  // need to get original or added cell.
101  void faceCells
102  (
103  const cellCuts& cuts,
104  const label exposedPatchI,
105  const label faceI,
106  label& own,
107  label& nei,
108  label& patchID
109  ) const;
110 
111  //- Get zone information for face.
112  void getZoneInfo
113  (
114  const label faceI,
115  label& zoneID,
116  bool& zoneFlip
117  ) const;
118 
119  //- Adds a face from point. Flips face if owner>neighbour
120  void addFace
121  (
122  polyTopoChange& meshMod,
123  const label faceI,
124  const label masterPointI,
125  const face& newFace,
126  const label owner,
127  const label neighbour,
128  const label patchID
129  );
130 
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
134  void modFace
135  (
136  polyTopoChange& meshMod,
137  const label faceI,
138  const face& newFace,
139  const label owner,
140  const label neighbour,
141  const label patchID
142  );
143 
144  // Copies face starting from startFp. Jumps cuts. Marks visited
145  // vertices in visited.
146  void copyFace
147  (
148  const face& f,
149  const label startFp,
150  const label endFp,
151  face& newFace
152  ) const;
153 
154  //- Split face along cut into two faces. Faces are in same point
155  // order as original face (i.e. maintain normal direction)
156  void splitFace
157  (
158  const face& f,
159  const label v0,
160  const label v1,
161 
162  face& f0,
163  face& f1
164  ) const;
165 
166  //- Add cuts of edges to face
167  face addEdgeCutsToFace(const label faceI) const;
168 
169  //- Convert loop of cuts into face.
171  (
172  const label cellI,
173  const labelList& loop
174  ) const;
175 
176 
177 
178  //- Disallow default bitwise copy construct
180 
181  //- Disallow default bitwise assignment
182  void operator=(const meshCutAndRemove&);
183 
184 public:
185 
186  //- Runtime type information
187  ClassName("meshCutAndRemove");
188 
189 
190  // Constructors
191 
192  //- Construct from mesh
194 
195 
196  // Member Functions
197 
198  // Edit
199 
200  //- Do actual cutting with cut description. Inserts mesh changes
201  // into meshMod.
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
205  void setRefinement
206  (
207  const label exposedPatchI,
208  const cellCuts& cuts,
209  const labelList& cutPatch,
210  polyTopoChange& meshMod
211  );
212 
213  //- Force recalculation of locally stored data on topological change
214  void updateMesh(const mapPolyMesh&);
215 
216 
217  // Access
218 
219  //- Faces added. Per split cell label of added face
220  const Map<label>& addedFaces() const
221  {
222  return addedFaces_;
223  }
224 
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)
229  {
230  return addedPoints_;
231  }
232 };
233 
234 
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 
237 } // End namespace Foam
238 
239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240 
241 #endif
242 
243 // ************************************************************************* //
boolList.H
typeInfo.H
Foam::meshCutAndRemove::findCutCell
label findCutCell(const cellCuts &, const labelList &) const
Returns -1 or the cell in cellLabels that is cut.
Definition: meshCutAndRemove.C:94
Foam::meshCutAndRemove::ClassName
ClassName("meshCutAndRemove")
Runtime type information.
Foam::meshCutAndRemove::addedFaces
const Map< label > & addedFaces() const
Faces added. Per split cell label of added face.
Definition: meshCutAndRemove.H:219
Foam::polyTopoChange
Direct mesh changes based on v1.3 polyTopoChange syntax.
Definition: polyTopoChange.H:97
Foam::meshCutAndRemove::addEdgeCutsToFace
face addEdgeCutsToFace(const label faceI) const
Add cuts of edges to face.
Definition: meshCutAndRemove.C:479
Foam::edge
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Definition: edge.H:58
Foam::edgeVertex
Combines edge or vertex in single label. Used to specify cuts across cell circumference.
Definition: edgeVertex.H:52
Foam::Map< label >
Foam::meshCutAndRemove
like meshCutter but also removes non-anchor side of cell.
Definition: meshCutAndRemove.H:60
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::meshCutAndRemove::loopToFace
face loopToFace(const label cellI, const labelList &loop) const
Convert loop of cuts into face.
Definition: meshCutAndRemove.C:515
Foam::meshCutAndRemove::faceCells
void faceCells(const cellCuts &cuts, const label exposedPatchI, const label faceI, label &own, label &nei, label &patchID) const
Get new owner and neighbour of face. Checks anchor points to see if.
Definition: meshCutAndRemove.C:183
Foam::meshCutAndRemove::addedPoints_
HashTable< label, edge, Hash< edge > > addedPoints_
Points added in last setRefinement. Per split edge label of added.
Definition: meshCutAndRemove.H:72
Foam::meshCutAndRemove::isIn
static bool isIn(const edge &, const labelList &)
Do the elements of edge appear in consecutive order in the list.
Definition: meshCutAndRemove.C:70
Map.H
Foam::meshCutAndRemove::addedFaces_
Map< label > addedFaces_
Faces added in last setRefinement. Per split cell label of added.
Definition: meshCutAndRemove.H:68
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
labelList.H
Foam::meshCutAndRemove::getZoneInfo
void getZoneInfo(const label faceI, label &zoneID, bool &zoneFlip) const
Get zone information for face.
Definition: meshCutAndRemove.C:228
Foam::meshCutAndRemove::addedPoints
const HashTable< label, edge, Hash< edge > > & addedPoints() const
Points added. Per split edge label of added point.
Definition: meshCutAndRemove.H:227
Foam::meshCutAndRemove::operator=
void operator=(const meshCutAndRemove &)
Disallow default bitwise assignment.
f1
scalar f1
Definition: createFields.H:28
Foam::meshCutAndRemove::meshCutAndRemove
meshCutAndRemove(const meshCutAndRemove &)
Disallow default bitwise copy construct.
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::meshCutAndRemove::updateMesh
void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
Definition: meshCutAndRemove.C:1280
Foam::HashTable
An STL-conforming hash table.
Definition: HashTable.H:61
Foam::meshCutAndRemove::findPatchFacePoint
label findPatchFacePoint(const face &f, const label patchI) const
Find point on face that is part of original mesh and that is.
Definition: meshCutAndRemove.C:151
Foam::meshCutAndRemove::setRefinement
void setRefinement(const label exposedPatchI, const cellCuts &cuts, const labelList &cutPatch, polyTopoChange &meshMod)
Do actual cutting with cut description. Inserts mesh changes.
Definition: meshCutAndRemove.C:588
f
labelList f(nPoints)
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::meshCutAndRemove::addFace
void addFace(polyTopoChange &meshMod, const label faceI, const label masterPointI, const face &newFace, const label owner, const label neighbour, const label patchID)
Adds a face from point. Flips face if owner>neighbour.
Definition: meshCutAndRemove.C:249
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
Foam::face
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
Foam::meshCutAndRemove::splitFace
void splitFace(const face &f, const label v0, const label v1, face &f0, face &f1) const
Split face along cut into two faces. Faces are in same point.
Definition: meshCutAndRemove.C:438
Foam::meshCutAndRemove::modFace
void modFace(polyTopoChange &meshMod, const label faceI, const face &newFace, const label owner, const label neighbour, const label patchID)
Modifies existing faceI for either new owner/neighbour or.
Definition: meshCutAndRemove.C:333
pointLabels
labelList pointLabels(nPoints, -1)
edgeVertex.H
Foam::meshCutAndRemove::findInternalFacePoint
label findInternalFacePoint(const labelList &pointLabels) const
Returns first pointI in pointLabels that uses an internal.
Definition: meshCutAndRemove.C:117
Foam::meshCutAndRemove::copyFace
void copyFace(const face &f, const label startFp, const label endFp, face &newFace) const
Definition: meshCutAndRemove.C:412
Foam::meshCutAndRemove::firstCommon
static label firstCommon(const labelList &lst1, const labelList &lst2)
Definition: meshCutAndRemove.C:50
Foam::cellCuts
Description of cuts across cells.
Definition: cellCuts.H:108
Foam::edgeVertex::mesh
const polyMesh & mesh() const
Definition: edgeVertex.H:98