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
zones
pointZone
pointZone.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::pointZone
26
27
Description
28
A subset of mesh points.
29
The labels of points in the zone can be obtained from the addressing()
30
list.
31
32
For quick check whether a point belongs to the zone use the lookup
33
mechanism in pointZoneMesh, where all the zoned points are registered
34
with their zone number.
35
36
SourceFiles
37
pointZone.C
38
newPointZone.C
39
40
\*---------------------------------------------------------------------------*/
41
42
#ifndef pointZone_H
43
#define pointZone_H
44
45
#include <
OpenFOAM/labelList.H
>
46
#include <
OpenFOAM/typeInfo.H
>
47
#include <
OpenFOAM/dictionary.H
>
48
#include <
OpenFOAM/pointZoneMeshFwd.H
>
49
#include <
OpenFOAM/Map.H
>
50
#include <
OpenFOAM/pointField.H
>
51
52
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53
54
namespace
Foam
55
{
56
57
// Forward declaration of friend functions and operators
58
59
class
pointZone;
60
Ostream&
operator<<
(Ostream&,
const
pointZone&);
61
62
63
/*---------------------------------------------------------------------------*\
64
Class pointZone Declaration
65
\*---------------------------------------------------------------------------*/
66
67
class
pointZone
68
:
69
public
labelList
70
{
71
// Private data
72
73
//- Name of zone
74
word
name_;
75
76
//- Index of zone
77
label index_;
78
79
//- Reference to zone list
80
const
pointZoneMesh
& zoneMesh_;
81
82
83
// Demand-driven private data
84
85
//- Map of point labels in zone for fast location lookup
86
mutable
Map<label>
* pointLookupMapPtr_;
87
88
89
// Private Member Functions
90
91
//- Disallow default bitwise copy construct
92
pointZone
(
const
pointZone
&);
93
94
//- Return map of local point indices
95
const
Map<label>
& pointLookupMap()
const
;
96
97
//- Build map of local point indices
98
void
calcPointLookupMap()
const
;
99
100
101
public
:
102
103
//- Runtime type information
104
TypeName
(
"pointZone"
);
105
106
107
// Declare run-time constructor selection tables
108
109
declareRunTimeSelectionTable
110
(
111
autoPtr
,
112
pointZone
,
113
dictionary
,
114
(
115
const
word
&
name
,
116
const
dictionary
& dict,
117
const
label
index
,
118
const
pointZoneMesh
& zm
119
),
120
(name, dict, index, zm)
121
);
122
123
124
// Constructors
125
126
//- Construct from components
127
pointZone
128
(
129
const
word
& name,
130
const
labelList
& addr,
131
const
label index,
132
const
pointZoneMesh
&
133
);
134
135
//- Construct from components, transferring contents
136
pointZone
137
(
138
const
word
& name,
139
const
Xfer<labelList>
& addr,
140
const
label index,
141
const
pointZoneMesh
&
142
);
143
144
//- Construct from dictionary
145
pointZone
146
(
147
const
word
& name,
148
const
dictionary
&,
149
const
label index,
150
const
pointZoneMesh
&
151
);
152
153
//- Construct given the original zone and resetting the
154
// point list and zone mesh information
155
pointZone
156
(
157
const
pointZone
&,
158
const
labelList
& addr,
159
const
label index,
160
const
pointZoneMesh
&
161
);
162
163
//- Construct given the original zone, resetting the
164
// face list and zone mesh information
165
pointZone
166
(
167
const
pointZone
&,
168
const
Xfer<labelList>
& addr,
169
const
label index,
170
const
pointZoneMesh
&
171
);
172
173
//- Construct and return a clone, resetting the zone mesh
174
virtual
autoPtr<pointZone>
clone
(
const
pointZoneMesh
& zm)
const
175
{
176
return
autoPtr<pointZone>
177
(
178
new
pointZone
(*
this
, *
this
,
index
(), zm)
179
);
180
}
181
182
//- Construct and return a clone, resetting the point list
183
// and zone mesh
184
virtual
autoPtr<pointZone>
clone
185
(
186
const
pointZoneMesh
& zm,
187
const
label index,
188
const
labelList
& addr
189
)
const
190
{
191
return
autoPtr<pointZone>
192
(
193
new
pointZone
(*
this
, addr, index, zm)
194
);
195
}
196
197
198
// Selectors
199
200
//- Return a pointer to a new point zone
201
// created on freestore from dictionary
202
static
autoPtr<pointZone>
New
203
(
204
const
word
& name,
205
const
dictionary
&,
206
const
label index,
207
const
pointZoneMesh
&
208
);
209
210
211
//- Destructor
212
213
virtual
~pointZone
();
214
215
216
// Member Functions
217
218
//- Return name
219
const
word
&
name
()
const
220
{
221
return
name_;
222
}
223
224
//- Map storing the local point index for every global point
225
// index. Used to find out the index of point in the zone from
226
// the known global point index. If the point is not in the
227
// zone, returns -1
228
label
whichPoint
(
const
label globalPointID)
const
;
229
230
//- Return the index of this zone in zone list
231
label
index
()
const
232
{
233
return
index_;
234
}
235
236
//- Return zoneMesh reference
237
const
pointZoneMesh
&
zoneMesh
()
const
;
238
239
//- Clear addressing
240
void
clearAddressing
();
241
242
//- Check zone definition. Return true if in error.
243
bool
checkDefinition
(
const
bool
report =
false
)
const
;
244
245
//- Correct patch after moving points
246
virtual
void
movePoints
(
const
pointField
&)
247
{}
248
249
//- Write
250
virtual
void
write
(
Ostream
&)
const
;
251
252
//- Write dictionary
253
virtual
void
writeDict
(
Ostream
&)
const
;
254
255
256
// Member Operators
257
258
//- Assign to zone clearing demand-driven data
259
void
operator=
(
const
pointZone
&);
260
261
//- Assign addressing clearing demand-driven data
262
void
operator=
(
const
labelList
&);
263
264
265
// Ostream Operator
266
267
friend
Ostream
&
operator<<
(
Ostream
&,
const
pointZone
&);
268
};
269
270
271
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
272
273
}
// End namespace Foam
274
275
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
276
277
#endif
278
279
// ************************ vim: set sw=4 sts=4 et: ************************ //