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
applications
utilities
surface
surfaceToPatch
boundaryMesh.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::boundaryMesh
26
27
Description
28
Addressing for all faces on surface of mesh. Can either be read
29
from polyMesh or from triSurface. Used for repatching existing meshes.
30
31
SourceFiles
32
boundaryMesh.C
33
34
\*---------------------------------------------------------------------------*/
35
36
#ifndef boundaryMesh_H
37
#define boundaryMesh_H
38
39
#include <
dynamicMesh/bMesh.H
>
40
#include <
dynamicMesh/boundaryPatch.H
>
41
#include <
OpenFOAM/PrimitivePatch_.H
>
42
#include <
OpenFOAM/PtrList.H
>
43
#include <
OpenFOAM/polyPatchList.H
>
44
#include <
OpenFOAM/className.H
>
45
46
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48
namespace
Foam
49
{
50
51
// Forward declaration of classes
52
class
Time;
53
class
polyMesh;
54
class
primitiveMesh;
55
56
/*---------------------------------------------------------------------------*\
57
Class boundaryMesh Declaration
58
\*---------------------------------------------------------------------------*/
59
60
class
boundaryMesh
61
{
62
// Static data
63
64
//- Normal along which to divide faces into categories
65
// (used in getNearest)
66
static
const
vector
splitNormal_;
67
68
//- Distance to face tolerance for getNearest. Triangles are considered
69
// near if they are nearer than distanceTol_*typDim where typDim is
70
// the largest distance from face centre to one of its vertices.
71
static
const
scalar distanceTol_;
72
73
// Private data
74
75
//- All boundary mesh data. Reconstructed every time faces are repatched
76
bMesh
* meshPtr_;
77
78
//- Patches. Reconstructed every time faces are repatched.
79
PtrList<boundaryPatch> patches_;
80
81
//- For every face in mesh() gives corresponding polyMesh face
82
// (not sensible if mesh read from triSurface)
83
labelList
meshFace_;
84
85
86
//
87
// Edge handling
88
//
89
90
//- points referenced by feature edges.
91
pointField
featurePoints_;
92
93
//- feature edges. Indices into featurePoints.
94
edgeList
featureEdges_;
95
96
//- from feature edge to mesh edge.
97
labelList
featureToEdge_;
98
99
//- from mesh edges to featureEdges_;
100
labelList
edgeToFeature_;
101
102
//- Feature 'segments'. Collections of connected featureEdges.
103
// Indices into featureEdges_.
104
labelListList
featureSegments_;
105
106
//- Additional edges (indices of mesh edges)
107
labelList
extraEdges_;
108
109
110
// Private Member Functions
111
112
//- Number of connected feature edges.
113
label nFeatureEdges(label pointI)
const
;
114
115
//- Step to next feature edge
116
label nextFeatureEdge(
const
label edgeI,
const
label vertI)
const
;
117
118
//- Return connected list of feature edges.
119
labelList
collectSegment
120
(
121
const
boolList
& isFeaturePoint,
122
const
label startEdgeI,
123
boolList
& featVisited
124
)
const
;
125
126
//- Do point-edge walk to determine nearest (to edgeI). Stops if
127
// distance >= maxDistance. Used to determine edges close to seed
128
// point.
129
void
markEdges
130
(
131
const
label maxDistance,
132
const
label edgeI,
133
const
label
distance
,
134
labelList
& minDistance,
135
DynamicList<label>& visited
136
)
const
;
137
138
//- Get index of polypatch by name
139
label findPatchID(
const
polyPatchList
&,
const
word&)
const
;
140
141
//- Get index of patch for face
142
label whichPatch(
const
polyPatchList
&,
const
label)
const
;
143
144
//- Gets labels of changed faces and propagates them to the edges.
145
// Returns labels of edges changed. Fills edgeRegion of visited edges
146
// with current region.
147
labelList
faceToEdge
148
(
149
const
boolList
& regionEdge,
150
const
label region,
151
const
labelList
& changedFaces,
152
labelList
& edgeRegion
153
)
const
;
154
155
//- Reverse of faceToEdge: gets edges and returns faces
156
labelList
edgeToFace
157
(
158
const
label region,
159
const
labelList
& changedEdges,
160
labelList
& faceRegion
161
)
const
;
162
163
//- Finds area, starting at faceI, delimited by borderEdge. Marks all
164
// faces thus visited with currentZone.
165
void
markZone
166
(
167
const
boolList
& borderEdge,
168
label faceI,
169
label currentZone,
170
labelList
& faceZone
171
)
const
;
172
173
174
//- Disallow default bitwise copy construct
175
boundaryMesh
(
const
boundaryMesh
&);
176
177
//- Disallow default bitwise assignment
178
void
operator=(
const
boundaryMesh
&);
179
180
181
public
:
182
183
//- Runtime type information
184
ClassName
(
"boundaryMesh"
);
185
186
187
// Constructors
188
189
//- Construct null
190
boundaryMesh
();
191
192
193
// Destructor
194
195
~boundaryMesh
();
196
197
void
clearOut
();
198
199
200
// Member Functions
201
202
// Access
203
204
const
bMesh
&
mesh
()
const
205
{
206
if
(!meshPtr_)
207
{
208
FatalErrorIn
(
"boundaryMesh::mesh()"
)
209
<<
"No mesh available. Probably mesh not yet"
210
<<
" read."
<<
abort
(
FatalError
);
211
}
212
return
*meshPtr_;
213
}
214
215
const
PtrList<boundaryPatch>
&
patches
()
const
216
{
217
return
patches_;
218
}
219
220
221
//- Label of original face in polyMesh (before patchify(...))
222
const
labelList
&
meshFace
()
const
223
{
224
return
meshFace_;
225
}
226
227
//- Feature points.
228
const
pointField
&
featurePoints
()
const
229
{
230
return
featurePoints_;
231
}
232
233
//- Feature edges. Indices into featurePoints.
234
const
edgeList
&
featureEdges
()
const
235
{
236
return
featureEdges_;
237
}
238
239
//- From index into featureEdge to index into meshedges,
240
const
labelList
&
featureToEdge
()
const
241
{
242
return
featureToEdge_;
243
}
244
245
//- From edge into featureEdges
246
const
labelList
&
edgeToFeature
()
const
247
{
248
return
edgeToFeature_;
249
}
250
251
//- Lists of connected featureEdges. Indices into featureEdges.
252
const
labelListList
&
featureSegments
()
const
253
{
254
return
featureSegments_;
255
}
256
257
//- Indices into edges of additional edges.
258
const
labelList
&
extraEdges
()
const
259
{
260
return
extraEdges_;
261
}
262
263
264
// Edit
265
266
//- Read from boundaryMesh of polyMesh.
267
void
read
(
const
polyMesh
&);
268
269
//- Read from triSurface
270
void
readTriSurface
(
const
fileName
&);
271
272
//- Write to file.
273
void
writeTriSurface
(
const
fileName
&)
const
;
274
275
//- Get bMesh index of nearest face for every boundary face in
276
// pMesh. Gets passed initial search box. If not found
277
// returns -1 for the face.
278
labelList
getNearest
279
(
280
const
primitiveMesh
& pMesh,
281
const
vector
& searchSpan
282
)
const
;
283
284
//- Take over patches onto polyMesh from nearest face in *this
285
// (from call to getNearest). Insert as
286
// -new set of patches (newMesh.addPatches)
287
// -topoChanges to change faces.
288
// nearest is list of nearest face in *this for every boundary
289
// face. oldPatches is list of existing patches in mesh.
290
// newMesh is the mesh to which the new patches are added.
291
// (so has to be constructed without patches).
292
void
patchify
293
(
294
const
labelList
& nearest,
295
const
polyBoundaryMesh
& oldPatches,
296
polyMesh
& newMesh
297
)
const
;
298
299
// Patches
300
301
//- Get index of patch face is in
302
label whichPatch(
const
label faceI)
const
;
303
304
//- Get index of patch by name
305
label findPatchID(
const
word
& patchName)
const
;
306
307
//- Get names of patches
308
wordList
patchNames
()
const
;
309
310
//- Add to back of patch list.
311
void
addPatch
(
const
word
& patchName);
312
313
//- Delete from patch list.
314
void
deletePatch
(
const
word
& patchName);
315
316
//- Change patch.
317
void
changePatchType
(
const
word
& patchName,
const
word
&
type
);
318
319
//- Recalculate face ordering and patches. Return old to new
320
// mapping.
321
void
changeFaces
(
const
labelList
& patchIDs,
labelList
& oldToNew);
322
323
324
// Edges
325
326
//- Set featureEdges, edgeToFeature, featureSegments according
327
// to angle of faces across edge
328
void
setFeatureEdges
(
const
scalar minCos);
329
330
//- Set extraEdges to edges 'near' to edgeI. Uses point-edge walk
331
// to determine 'near'.
332
void
setExtraEdges
(
const
label edgeI);
333
334
335
// Faces
336
337
//- Simple triangulation of face subset. Returns number of triangles
338
// needed.
339
label
getNTris
(
const
label faceI)
const
;
340
341
//- Simple triangulation of face subset. TotalNTris is total number
342
// of triangles, nTris is per face number of triangles.
343
label
getNTris
344
(
345
const
label startFaceI,
346
const
label nFaces,
347
labelList
& nTris
348
)
const
;
349
350
//- Simple triangulation of face subset. TotalNTris is total number
351
// of triangles (from call to getNTris)
352
// triVerts is triangle vertices, three per triangle.
353
void
triangulate
354
(
355
const
label startFaceI,
356
const
label nFaces,
357
const
label totalNTris,
358
labelList
& triVerts
359
)
const
;
360
361
//- Number of points used in face subset.
362
label
getNPoints
(
const
label startFaceI,
const
label nFaces)
const
;
363
364
//- Same as triangulate but in local vertex numbering.
365
// (Map returned).
366
void
triangulateLocal
367
(
368
const
label startFaceI,
369
const
label nFaces,
370
const
label totalNTris,
371
labelList
& triVerts,
372
labelList
& localToGlobal
373
)
const
;
374
375
// Other
376
377
// Flood filling without crossing protected edges.
378
void
markFaces
379
(
380
const
labelList
& protectedEdges,
381
const
label faceI,
382
boolList
& visited
383
)
const
;
384
};
385
386
387
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
388
389
}
// End namespace Foam
390
391
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
392
393
#endif
394
395
// ************************************************************************* //