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
searchableSurface
searchableSurface.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::searchableSurface
26
27
Description
28
Base class of (analytical or triangulated) surface.
29
Encapsulates all the search routines. WIP.
30
31
Information returned is usually a pointIndexHit:
32
- bool : was intersection/nearest found?
33
- point : intersection point or nearest point
34
- index : unique index on surface (e.g. triangle for triSurfaceMesh)
35
36
SourceFiles
37
searchableSurface.C
38
39
\*---------------------------------------------------------------------------*/
40
41
#ifndef searchableSurface_H
42
#define searchableSurface_H
43
44
#include <
OpenFOAM/pointField.H
>
45
#include <
OpenFOAM/typeInfo.H
>
46
#include <
OpenFOAM/runTimeSelectionTables.H
>
47
#include <
meshTools/pointIndexHit.H
>
48
#include <
OpenFOAM/linePointRef.H
>
49
#include <
OpenFOAM/objectRegistry.H
>
50
51
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52
53
namespace
Foam
54
{
55
56
// Forward declaration of classes
57
class
objectRegistry;
58
class
mapDistribute;
59
class
treeBoundBox;
60
61
/*---------------------------------------------------------------------------*\
62
Class searchableSurface Declaration
63
\*---------------------------------------------------------------------------*/
64
65
class
searchableSurface
66
:
67
public
regIOobject
68
{
69
public
:
70
71
// Data types
72
73
//- volume types
74
enum
volumeType
75
{
76
UNKNOWN
= 0,
77
MIXED
= 1,
// not used. only here to maintain consistency with
78
// indexedOctree volumeType.
79
INSIDE
= 2,
80
OUTSIDE
= 3
81
};
82
83
private
:
84
85
// Private data
86
87
const
word
name_;
88
89
90
// Private Member Functions
91
92
//- Disallow default bitwise copy construct
93
searchableSurface
(
const
searchableSurface
&);
94
95
//- Disallow default bitwise assignment
96
void
operator=(
const
searchableSurface
&);
97
98
99
public
:
100
101
//- Runtime type information
102
TypeName
(
"searchableSurface"
);
103
104
// Declare run-time constructor selection table
105
106
// For the dictionary constructor
107
declareRunTimeSelectionTable
108
(
109
autoPtr
,
110
searchableSurface
,
111
dict,
112
(
113
const
IOobject
& io,
114
const
dictionary
& dict
115
),
116
(io, dict)
117
);
118
119
120
//- Class used for the read-construction of
121
// PtrLists of searchableSurface.
122
class
iNew
123
{
124
IOobject
& io_;
125
126
public
:
127
128
iNew
(
IOobject
& io)
129
:
130
io_(io)
131
{}
132
133
autoPtr<searchableSurface>
operator()
(
Istream
& is)
const
134
{
135
word
surfaceType(is);
136
word
readName(is);
137
dictionary
dict(is);
138
139
autoPtr<IOobject>
namedIO(io_.
clone
());
140
namedIO().rename(readName);
141
return
searchableSurface::New
(surfaceType, namedIO(), dict);
142
}
143
};
144
145
146
// Constructors
147
148
searchableSurface
(
const
IOobject
& io);
149
150
//- Clone
151
virtual
autoPtr<searchableSurface>
clone
()
const
152
{
153
notImplemented
(
"autoPtr<searchableSurface> clone() const"
);
154
return
autoPtr<searchableSurface>
(NULL);
155
}
156
157
158
// Selectors
159
160
//- Return a reference to the selected searchableSurface
161
static
autoPtr<searchableSurface>
New
162
(
163
const
word
& surfaceType,
164
const
IOobject
& io,
165
const
dictionary
& dict
166
);
167
168
169
// Destructor
170
171
virtual
~searchableSurface
();
172
173
174
// Member Functions
175
176
177
//- Names of regions.
178
virtual
const
wordList
&
regions
()
const
= 0;
179
180
//- Whether supports volume type below.
181
virtual
bool
hasVolumeType
()
const
= 0;
182
183
//- Range of local indices that can be returned.
184
virtual
label
size
()
const
= 0;
185
186
//- Range of global indices that can be returned.
187
virtual
label
globalSize
()
const
188
{
189
return
size
();
190
}
191
192
//- Get representative set of element coordinates
193
// Usually the element centres (should be of length size()).
194
virtual
pointField
coordinates
()
const
= 0;
195
196
197
// Single point queries.
198
204
//virtual pointIndexHit findNearest
205
//(
206
// const point& sample,
207
// const scalar nearestDistSqr
208
//) const = 0;
209
//
215
//virtual pointIndexHit findNearestOnEdge
216
//(
217
// const point& sample,
218
// const scalar nearestDistSqr
219
//) const = 0;
220
//
229
//virtual pointIndexHit findNearest
230
//(
231
// const linePointRef& ln,
232
// treeBoundBox& tightest,
233
// point& linePoint
234
//) const = 0;
235
//
237
//virtual pointIndexHit findLine
238
//(
239
// const point& start,
240
// const point& end
241
//) const = 0;
242
//
244
//virtual pointIndexHit findLineAny
245
//(
246
// const point& start,
247
// const point& end
248
//) const = 0;
249
250
251
// Multiple point queries. When surface is distributed the index
252
// should be a global index. Not done yet.
253
254
virtual
void
findNearest
255
(
256
const
pointField
& sample,
257
const
scalarField
& nearestDistSqr,
258
List<pointIndexHit>
&
259
)
const
= 0;
260
261
//- Find first intersection on segment from start to end.
262
// Note: searchableSurfacesQueries expects no
263
// intersection to be found if start==end. Is problem?
264
virtual
void
findLine
265
(
266
const
pointField
& start,
267
const
pointField
& end,
268
List<pointIndexHit>
&
269
)
const
= 0;
270
271
//- Return any intersection on segment from start to end.
272
virtual
void
findLineAny
273
(
274
const
pointField
& start,
275
const
pointField
& end,
276
List<pointIndexHit>
&
277
)
const
= 0;
278
279
//- Get all intersections in order from start to end.
280
virtual
void
findLineAll
281
(
282
const
pointField
& start,
283
const
pointField
& end,
284
List
<
List<pointIndexHit>
>&
285
)
const
= 0;
286
287
//- From a set of points and indices get the region
288
virtual
void
getRegion
289
(
290
const
List<pointIndexHit>
&,
291
labelList
& region
292
)
const
= 0;
293
294
//- From a set of points and indices get the normal
295
virtual
void
getNormal
296
(
297
const
List<pointIndexHit>
&,
298
vectorField
&
normal
299
)
const
= 0;
300
301
//- Determine type (inside/outside) for point. unknown if
302
// cannot be determined (e.g. non-manifold surface)
303
virtual
void
getVolumeType
304
(
305
const
pointField
&,
306
List<volumeType>
&
307
)
const
= 0;
308
309
310
// Other
311
312
//- Set bounds of surface. Bounds currently set as list of
313
// bounding boxes. The bounds are hints to the surface as for
314
// the range of queries it can expect. faceMap/pointMap can be
315
// set if the surface has done any redistribution.
316
virtual
void
distribute
317
(
318
const
List<treeBoundBox>
&,
319
const
bool
keepNonLocal,
320
autoPtr<mapDistribute>
& faceMap,
321
autoPtr<mapDistribute>
& pointMap
322
)
323
{}
324
325
//- WIP. Store element-wise field.
326
virtual
void
setField
(
const
labelList
& values)
327
{}
328
329
//- WIP. From a set of hits (points and
330
// indices) get the specified field. Misses do not get set. Return
331
// empty field if not supported.
332
virtual
void
getField
(
const
List<pointIndexHit>
&,
labelList
& values)
333
const
334
{
335
values.
clear
();
336
}
337
338
};
339
340
341
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
342
343
}
// End namespace Foam
344
345
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
346
347
#endif
348
349
// ************************ vim: set sw=4 sts=4 et: ************************ //