Home
Downloads
Documentation
Installation
User Guide
man-pages
API Documentation
README
Release Notes
Changes
License
Support
SourceForge Project
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
dynamicMesh
meshCut
meshModifiers
meshCutter
meshCutter.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) 1991-2010 OpenCFD Ltd.
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::meshCutter
26
27
Description
28
Cuts (splits) cells.
29
30
Description of cut is given as a loop of 'cuts' per cell (see cellCuts).
31
setRefinement() takes this cut description and inserts the nessecary
32
topoActions (add points/faces/cells) into the polyTopoChange.
33
34
Stores added cells/faces/points.
35
36
Cut description gives orientation to cut by calculating 'anchorPoints'.
37
The side of the cell that contains the anchorPoints is the master cell.
38
Likewise the cells' edges will have the split added as a duplicate of the
39
master (anchor) point.
40
Think of it as the cell with the anchor points at the bottom. Add a face
41
at the bottom to split the cell and then sweep this face up to be through
42
the middle of the cell (inflation).
43
44
45
-# Start:
46
cell with anchor points at bottom
47
@verbatim
48
+-------+
49
| +
50
| +
51
| +
52
| +
53
| +
54
| +
55
| +
56
+-------+
57
anchor anchor
58
@endverbatim
59
60
61
-# Topo change:
62
splitface introduced at bottom of cell, introducing a new
63
cell and splitting the side faces into two.
64
@verbatim
65
+-------+
66
| +
67
| +
68
| + <- addedCell
69
| +
70
| +
71
| +
72
+-------+ <- splitFace
73
+-------+ <- original cell
74
anchor anchor
75
@endverbatim
76
77
78
-# Inflation:
79
splitface shifted up to middle of cell (or wherever cut was)
80
@verbatim
81
+-------+
82
| +
83
| + <- addedCell
84
| +
85
+-------+ <- splitFace
86
| +
87
| + <- original cell
88
| +
89
+-------+
90
anchor anchor
91
@endverbatim
92
93
Anyway this was the original idea. Inflation was meant to handle
94
conservative properties distribution without interpolation.
95
(just face sweeping through space). But problem was that
96
only if the introduced splitface was exactly the same shape as bottom face
97
(so same 2D topo or perfectly flat) the volume between them was 0.
98
99
This meshCutting still uses anchorPoints though:
100
- the master cell is the one without the anchor points. The added cell
101
(on top of the splitFace) is the with.
102
- the splitFace is owned by the master cell (since it has the lower number)
103
- the side faces get split and get either the original cell as neighbour
104
or the added cell (if the faces contain the cell anchor points)
105
106
SourceFiles
107
meshCutter.C
108
109
\*---------------------------------------------------------------------------*/
110
111
#ifndef meshCutter_H
112
#define meshCutter_H
113
114
#include <
dynamicMesh/edgeVertex.H
>
115
#include <
OpenFOAM/labelList.H
>
116
#include <
OpenFOAM/typeInfo.H
>
117
#include <
OpenFOAM/Map.H
>
118
119
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120
121
namespace
Foam
122
{
123
124
// Forward declaration of classes
125
class
Time;
126
class
polyTopoChange;
127
class
cellCuts;
128
class
polyMesh;
129
class
face;
130
131
/*---------------------------------------------------------------------------*\
132
Class meshCutter Declaration
133
\*---------------------------------------------------------------------------*/
134
135
class
meshCutter
136
:
137
public
edgeVertex
138
{
139
// Private data
140
141
//- Cells added in last setRefinement. Per splitcell label of added
142
// cell
143
Map<label>
addedCells_;
144
145
//- Faces added in last setRefinement. Per split cell label of added
146
// face
147
Map<label>
addedFaces_;
148
149
//- Points added in last setRefinement. Per split edge label of added
150
// point
151
HashTable<label, edge, Hash<edge>
> addedPoints_;
152
153
154
// Private Static Functions
155
156
//- Do list 1 and 2 share elements?
157
static
bool
uses(
const
labelList
& elems1,
const
labelList
& elems2);
158
159
//- Do the elements of edge appear in consecutive order in the list
160
static
bool
isIn(
const
edge
&,
const
labelList
&);
161
162
163
// Private Member Functions
164
165
//- Returns -1 or the cell in cellLabels that is cut.
166
label findCutCell(
const
cellCuts
&,
const
labelList
&)
const
;
167
168
//- Returns first pointI in pointLabels that uses an internal
169
// face. Used to find point to inflate cell/face from (has to be
170
// connected to internal face)
171
label findInternalFacePoint(
const
labelList
&
pointLabels
)
const
;
172
173
//- Get new owner and neighbour of face. Checks anchor points to see if
174
// need to get original or added cell.
175
void
faceCells
176
(
177
const
cellCuts
& cuts,
178
const
label faceI,
179
label& own,
180
label& nei
181
)
const
;
182
183
//- Get patch information for face.
184
void
getFaceInfo
185
(
186
const
label faceI,
187
label& patchID,
188
label& zoneID,
189
label& zoneFlip
190
)
const
;
191
192
//- Adds a face on top of existing faceI. Flips face
193
// if owner>neighbour
194
void
addFace
195
(
196
polyTopoChange
& meshMod,
197
const
label faceI,
198
const
face
& newFace,
199
const
label owner,
200
const
label neighbour
201
);
202
203
//- Modifies existing faceI for either new owner/neighbour or
204
// new face points. Checks if anything changed and flips face
205
// if owner>neighbour
206
void
modFace
207
(
208
polyTopoChange
& meshMod,
209
const
label faceI,
210
const
face
& newFace,
211
const
label owner,
212
const
label neighbour
213
);
214
215
216
// Copies face starting from startFp. Jumps cuts. Marks visited
217
// vertices in visited.
218
void
copyFace
219
(
220
const
face
&
f
,
221
const
label startFp,
222
const
label endFp,
223
face
& newFace
224
)
const
;
225
226
//- Split face along cut into two faces. Faces are in same point
227
// order as original face (i.e. maintain normal direction)
228
void
splitFace
229
(
230
const
face
& f,
231
const
label v0,
232
const
label
v1
,
233
234
face
& f0,
235
face
& f1
236
)
const
;
237
238
//- Add cuts of edges to face
239
face
addEdgeCutsToFace(
const
label faceI)
const
;
240
241
//- Convert loop of cuts into face.
242
face
loopToFace
243
(
244
const
label cellI,
245
const
labelList
& loop
246
)
const
;
247
248
249
//- Get elements of cell.
250
void
getFacesEdgesPoints
251
(
252
const
label cellI,
253
labelHashSet
& faces,
254
labelHashSet
& edges,
255
labelHashSet
&
points
256
)
const
;
257
258
259
260
//- Disallow default bitwise copy construct
261
meshCutter
(
const
meshCutter
&);
262
263
//- Disallow default bitwise assignment
264
void
operator=(
const
meshCutter
&);
265
266
public
:
267
268
//- Runtime type information
269
ClassName
(
"meshCutter"
);
270
271
// Constructors
272
273
//- Construct from mesh
274
meshCutter
(
const
polyMesh
&
mesh
);
275
276
277
// Destructor
278
279
~meshCutter
();
280
281
282
// Member Functions
283
284
// Edit
285
286
//- Do actual cutting with cut description. Inserts mesh changes
287
// into meshMod.
288
void
setRefinement
(
const
cellCuts
& cuts,
polyTopoChange
& meshMod);
289
290
//- Force recalculation of locally stored data on topological change
291
void
updateMesh
(
const
mapPolyMesh
&);
292
293
// Access
294
295
//- Cells added. Per split cell label of added cell
296
const
Map<label>
&
addedCells
()
const
297
{
298
return
addedCells_;
299
}
300
301
//- Faces added. Per split cell label of added face
302
const
Map<label>
&
addedFaces
()
const
303
{
304
return
addedFaces_;
305
}
306
307
//- Points added. Per split edge label of added point
308
const
HashTable<label, edge, Hash<edge>
>&
addedPoints
()
const
309
{
310
return
addedPoints_;
311
}
312
};
313
314
315
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
316
317
}
// End namespace Foam
318
319
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
320
321
#endif
322
323
// ************************ vim: set sw=4 sts=4 et: ************************ //