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
meshTools
sets
topoSets
topoSet.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::topoSet
26
27
Description
28
General set of labels of mesh quantity (points, cells, faces).
29
30
Contains various 'notImplemented' functions, but I do not want to make
31
this class abstract since it is quite handy to work on topoSets.
32
33
SourceFiles
34
topoSet.C
35
36
\*---------------------------------------------------------------------------*/
37
38
#ifndef topoSet_H
39
#define topoSet_H
40
41
#include <
OpenFOAM/HashSet.H
>
42
#include <
OpenFOAM/regIOobject.H
>
43
#include <
OpenFOAM/labelList.H
>
44
#include <
OpenFOAM/typeInfo.H
>
45
#include <
OpenFOAM/autoPtr.H
>
46
#include <
OpenFOAM/pointField.H
>
47
48
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49
50
namespace
Foam
51
{
52
53
54
class
mapPolyMesh;
55
class
polyMesh;
56
class
primitiveMesh;
57
58
/*---------------------------------------------------------------------------*\
59
Class topoSet Declaration
60
\*---------------------------------------------------------------------------*/
61
62
class
topoSet
63
:
64
public
regIOobject
,
65
public
labelHashSet
66
{
67
68
protected
:
69
70
// Protected Member Functions
71
72
//- Update map from map. Used to update cell/face labels
73
// after morphing
74
void
updateLabels
(
const
labelList
& map);
75
76
//- Check validity of contents.
77
void
check
(
const
label maxLabel);
78
79
//- Write part of contents nicely formatted. Prints labels only.
80
void
writeDebug
81
(
82
Ostream
& os,
83
const
label maxElem,
84
topoSet::const_iterator
& iter,
85
label& elemI
86
)
const
;
87
88
//- Write part of contents nicely formatted. Prints label
89
// and corresponding coordinate.
90
void
writeDebug
91
(
92
Ostream
& os,
93
const
pointField
& coords,
94
const
label maxElem,
95
topoSet::const_iterator
& iter,
96
label& elemI
97
)
const
;
98
99
//- Write labels and coordinates columnwise to os. Truncate to maxLen.
100
void
writeDebug
101
(
102
Ostream
& os,
103
const
pointField
& coords,
104
const
label maxLen
105
)
const
;
106
107
108
//- Disallow default bitwise copy construct
109
topoSet
(
const
topoSet
&);
110
111
public
:
112
113
//- Runtime type information
114
TypeName
(
"topoSet"
);
115
116
117
// Static
118
119
//- Name of file set will use.
120
static
fileName
localPath
(
const
polyMesh
&
mesh
,
const
word
&
name
);
121
122
123
// Declare run-time constructor selection table
124
125
// For the direct constructor
126
declareRunTimeSelectionTable
127
(
128
autoPtr
,
129
topoSet
,
130
word
,
131
(
132
const
polyMesh
& mesh,
133
const
word
& name,
134
readOption
r,
135
writeOption
w
136
),
137
(mesh, name, r, w)
138
);
139
140
// For the constructor from size
141
declareRunTimeSelectionTable
142
(
143
autoPtr
,
144
topoSet
,
145
size
,
146
(
147
const
polyMesh
& mesh,
148
const
word
& name,
149
const
label
size
,
150
writeOption
w
151
),
152
(mesh, name, size, w)
153
);
154
155
// For the constructor as copy
156
declareRunTimeSelectionTable
157
(
158
autoPtr
,
159
topoSet
,
160
set
,
161
(
162
const
polyMesh
& mesh,
163
const
word
& name,
164
const
topoSet
&
set
,
165
writeOption
w
166
),
167
(mesh, name,
set
, w)
168
);
169
170
171
// Constructors
172
173
174
//- Construct from IOobject as explicitly passed type.
175
// Can't use typeName info here since subclasses not yet instantiated
176
topoSet
(
const
IOobject
&,
const
word
& wantedType);
177
178
//- Construct from polyMesh and name
179
topoSet
180
(
181
const
polyMesh
& mesh,
182
const
word
& wantedType,
183
const
word
& name,
184
readOption
r=
MUST_READ
,
185
writeOption
w=
NO_WRITE
186
);
187
188
//- Construct empty from additional size of labelHashSet
189
topoSet
190
(
191
const
polyMesh
& mesh,
192
const
word
& name,
193
const
label,
194
writeOption
w=
NO_WRITE
195
);
196
197
//- Construct empty from additional labelHashSet
198
topoSet
199
(
200
const
polyMesh
& mesh,
201
const
word
& name,
202
const
labelHashSet
&,
203
writeOption
w=
NO_WRITE
204
);
205
206
//- Construct empty from IOobject and size
207
topoSet
(
const
IOobject
&,
const
label size);
208
209
//- Construct from IOobject and labelHashSet
210
topoSet
(
const
IOobject
&,
const
labelHashSet
&);
211
212
213
214
//- Clone
215
autoPtr<topoSet>
clone
()
const
216
{
217
notImplemented
(
"autoPtr<topoSet> clone() const"
);
218
return
autoPtr<topoSet>
(NULL);
219
}
220
221
222
// Selectors
223
224
//- Return a pointer to a toposet read from file
225
static
autoPtr<topoSet>
New
226
(
227
const
word
& setType,
228
const
polyMesh
& mesh,
229
const
word
& name,
230
readOption
r=
MUST_READ
,
231
writeOption
w=
NO_WRITE
232
);
233
234
//- Return a pointer to a new toposet of given size
235
static
autoPtr<topoSet>
New
236
(
237
const
word
& setType,
238
const
polyMesh
& mesh,
239
const
word
& name,
240
const
label size,
241
writeOption
w=
NO_WRITE
242
);
243
244
//- Return a pointer to a new toposet as copy of another toposet
245
static
autoPtr<topoSet>
New
246
(
247
const
word
& setType,
248
const
polyMesh
& mesh,
249
const
word
& name,
250
const
topoSet
&
set
,
251
writeOption
w=
NO_WRITE
252
);
253
254
255
// Destructor
256
257
virtual
~topoSet
();
258
259
260
// Member functions
261
262
//- Invert contents. (insert all members 0..maxLen-1 which were not in
263
// set)
264
virtual
void
invert
(
const
label maxLen);
265
266
//- Subset contents. Only elements present in both sets remain.
267
virtual
void
subset
(
const
topoSet
&
set
);
268
269
//- Add elements present in set.
270
virtual
void
addSet
(
const
topoSet
&
set
);
271
272
//- Delete elements present in set.
273
virtual
void
deleteSet
(
const
topoSet
&
set
);
274
275
//- Sync set across coupled patches.
276
virtual
void
sync
(
const
polyMesh
& mesh);
277
278
//- Write labels columnwise to os. Truncate to maxLen.
279
virtual
void
writeDebug
(
Ostream
& os,
const
label maxLen)
const
;
280
281
//- Like above but also writes mesh related quantity
282
// (usually coordinate).
283
virtual
void
writeDebug
284
(
285
Ostream
& os,
286
const
primitiveMesh
&,
287
const
label maxLen
288
)
const
;
// = 0;
289
290
//- Write contents.
291
virtual
bool
writeData
(
Ostream
&)
const
;
292
293
//- Update any stored data for new labels. Not implemented.
294
virtual
void
updateMesh
(
const
mapPolyMesh
& morphMap);
295
296
//- Return max allowable index (+1). Not implemented.
297
virtual
label
maxSize
(
const
polyMesh
& mesh)
const
;
// = 0;
298
299
300
301
// Member operators
302
303
//- Copy labelHashSet part only
304
void
operator=
(
const
topoSet
&);
305
306
};
307
308
309
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
310
311
}
// End namespace Foam
312
313
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
314
315
#endif
316
317
// ************************ vim: set sw=4 sts=4 et: ************************ //