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
OpenFOAM
meshes
polyMesh
polyPatches
polyPatch
polyPatch.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::polyPatch
26
27
Description
28
A patch is a list of labels that address the faces in the global face list.
29
30
The patch can calculate its own edges based on the global faces.
31
Patch also contains all addressing between the faces.
32
33
SourceFiles
34
polyPatch.C
35
newPolyPatch.C
36
37
\*---------------------------------------------------------------------------*/
38
39
#ifndef polyPatch_H
40
#define polyPatch_H
41
42
#include <
OpenFOAM/patchIdentifier.H
>
43
#include <
OpenFOAM/primitivePatch.H
>
44
#include <
OpenFOAM/typeInfo.H
>
45
#include <
OpenFOAM/runTimeSelectionTables.H
>
46
47
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48
49
namespace
Foam
50
{
51
52
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53
54
// Forward declaration of friend functions and operators
55
56
class
polyBoundaryMesh;
57
class
polyPatch;
58
59
Ostream&
operator<<
(Ostream&,
const
polyPatch&);
60
61
62
/*---------------------------------------------------------------------------*\
63
Class polyPatch Declaration
64
\*---------------------------------------------------------------------------*/
65
66
class
polyPatch
67
:
68
public
patchIdentifier
,
69
public
primitivePatch
70
{
71
// Private data
72
73
//- Start label of this patch in the polyMesh face list
74
label start_;
75
76
//- Reference to boundary mesh
77
const
polyBoundaryMesh
& boundaryMesh_;
78
79
80
// Demand-driven private data
81
82
//- face-cell addressing
83
mutable
labelList::subList
* faceCellsPtr_;
84
85
//- Global edge addressing
86
mutable
labelList
* mePtr_;
87
88
89
// Private Member Functions
90
91
//- Calculate labels of mesh edges
92
void
calcMeshEdges()
const
;
93
94
95
protected
:
96
97
// Protected Member Functions
98
99
// The polyPatch geometry initialisation is called by polyBoundaryMesh
100
friend
class
polyBoundaryMesh
;
101
102
//- Initialise the calculation of the patch geometry
103
virtual
void
initGeometry
()
104
{}
105
106
//- Calculate the patch geometry
107
virtual
void
calcGeometry
()
108
{}
109
110
//- Initialise the patches for moving points
111
virtual
void
initMovePoints
(
const
pointField
&)
112
{}
113
114
//- Correct patches after moving points
115
virtual
void
movePoints
(
const
pointField
&
p
);
116
117
//- Initialise the update of the patch topology
118
virtual
void
initUpdateMesh
()
119
{}
120
121
//- Update of the patch topology
122
virtual
void
updateMesh
();
123
124
125
public
:
126
127
//- Runtime type information
128
TypeName
(
"patch"
);
129
130
//- Debug switch to disallow the use of genericPolyPatch
131
static
int
disallowGenericPolyPatch
;
132
133
134
// Declare run-time constructor selection tables
135
136
declareRunTimeSelectionTable
137
(
138
autoPtr
,
139
polyPatch
,
140
word
,
141
(
142
const
word
&
name
,
143
const
label size,
144
const
label
start
,
145
const
label
index
,
146
const
polyBoundaryMesh
& bm
147
),
148
(name, size, start, index, bm)
149
);
150
151
declareRunTimeSelectionTable
152
(
153
autoPtr
,
154
polyPatch
,
155
dictionary
,
156
(
157
const
word
& name,
158
const
dictionary
& dict,
159
const
label index,
160
const
polyBoundaryMesh
& bm
161
),
162
(name, dict, index, bm)
163
);
164
165
166
// Constructors
167
168
//- Construct from components
169
polyPatch
170
(
171
const
word
& name,
172
const
label size,
173
const
label start,
174
const
label index,
175
const
polyBoundaryMesh
& bm
176
);
177
178
//- Construct from dictionary
179
polyPatch
180
(
181
const
word
& name,
182
const
dictionary
& dict,
183
const
label index,
184
const
polyBoundaryMesh
& bm
185
);
186
187
//- Construct as copy, resetting the boundary mesh
188
polyPatch
(
const
polyPatch
&,
const
polyBoundaryMesh
&);
189
190
//- Construct given the original patch and resetting the
191
// face list and boundary mesh information
192
polyPatch
193
(
194
const
polyPatch
& pp,
195
const
polyBoundaryMesh
& bm,
196
const
label index,
197
const
label newSize,
198
const
label newStart
199
);
200
201
//- Construct as copy
202
polyPatch
(
const
polyPatch
&);
203
204
//- Construct and return a clone, resetting the boundary mesh
205
virtual
autoPtr<polyPatch>
clone
(
const
polyBoundaryMesh
& bm)
const
206
{
207
return
autoPtr<polyPatch>
(
new
polyPatch
(*
this
, bm));
208
}
209
210
//- Construct and return a clone, resetting the face list
211
// and boundary mesh
212
virtual
autoPtr<polyPatch>
clone
213
(
214
const
polyBoundaryMesh
& bm,
215
const
label index,
216
const
label newSize,
217
const
label newStart
218
)
const
219
{
220
return
autoPtr<polyPatch>
221
(
222
new
polyPatch
(*
this
, bm, index, newSize, newStart)
223
);
224
}
225
226
227
// Selectors
228
229
//- Return a pointer to a new patch created on freestore from
230
// components
231
static
autoPtr<polyPatch>
New
232
(
233
const
word
& patchType,
234
const
word
& name,
235
const
label size,
236
const
label start,
237
const
label index,
238
const
polyBoundaryMesh
& bm
239
);
240
241
//- Return a pointer to a new patch created on freestore from
242
// dictionary
243
static
autoPtr<polyPatch>
New
244
(
245
const
word
& name,
246
const
dictionary
& dict,
247
const
label index,
248
const
polyBoundaryMesh
& bm
249
);
250
251
252
// Destructor
253
254
virtual
~polyPatch
();
255
256
257
// Member Functions
258
259
//- Return start label of this patch in the polyMesh face list
260
label
start
()
const
261
{
262
return
start_;
263
}
264
265
//- Return boundaryMesh reference
266
const
polyBoundaryMesh
&
boundaryMesh
()
const
;
267
268
//- Return true if this patch field is coupled
269
virtual
bool
coupled
()
const
270
{
271
return
false
;
272
}
273
274
//- Return true if the given type is a constraint type
275
static
bool
constraintType
(
const
word
& pt);
276
277
//- Return a list of all the constraint patch types
278
static
wordList
constraintTypes
();
279
280
//- Slice list to patch
281
template
<
class
T>
282
const
typename
List<T>::subList
patchSlice
(
const
List<T>
& l)
const
283
{
284
return
typename
List<T>::subList
(l, this->size(), start_);
285
}
286
287
//- Slice Field to patch
288
template
<
class
T>
289
const
typename
Field<T>::subField
patchSlice
(
const
Field<T>
& l)
const
290
{
291
return
typename
Field<T>::subField
(l, this->size(), start_);
292
}
293
294
295
//- Write the polyPatch data as a dictionary
296
virtual
void
write
(
Ostream
&)
const
;
297
298
299
// Geometric data; point list required
300
301
//- Return face centres
302
const
vectorField::subField
faceCentres
()
const
;
303
304
//- Return face normals
305
const
vectorField::subField
faceAreas
()
const
;
306
307
//- Return face neighbour cell centres
308
tmp<vectorField>
faceCellCentres
()
const
;
309
310
311
// Addressing into mesh
312
313
//- Return face-cell addressing
314
const
unallocLabelList
&
faceCells
()
const
;
315
316
//- Return global edge index for local edges
317
const
labelList
&
meshEdges
()
const
;
318
319
//- Clear addressing
320
void
clearAddressing
();
321
322
323
// Other patch operations
324
325
//- Return label of face in patch from global face label
326
inline
label
whichFace
(
const
label l)
const
327
{
328
return
l - start_;
329
}
330
331
332
//- Initialize ordering for primitivePatch. Does not
333
// refer to *this (except for name() and type() etc.)
334
virtual
void
initOrder
(
const
primitivePatch
&)
const
;
335
336
//- Return new ordering for primitivePatch.
337
// Ordering is -faceMap: for every face
338
// index of the new face -rotation:for every new face the clockwise
339
// shift of the original face. Return false if nothing changes
340
// (faceMap is identity, rotation is 0), true otherwise.
341
virtual
bool
order
342
(
343
const
primitivePatch
&,
344
labelList
& faceMap,
345
labelList
& rotation
346
)
const
;
347
348
349
// Member operators
350
351
//- Assignment
352
void
operator=
(
const
polyPatch
&);
353
354
355
// Ostream Operator
356
357
friend
Ostream
&
operator<<
(
Ostream
&,
const
polyPatch
&);
358
};
359
360
361
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
362
363
}
// End namespace Foam
364
365
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
366
367
#endif
368
369
// ************************ vim: set sw=4 sts=4 et: ************************ //