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
searchableBox.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::searchableBox
26
27
Description
28
Searching on bounding box
29
30
SourceFiles
31
searchableBox.C
32
33
\*---------------------------------------------------------------------------*/
34
35
#ifndef searchableBox_H
36
#define searchableBox_H
37
38
#include "
searchableSurface.H
"
39
#include <
meshTools/treeBoundBox.H
>
40
41
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42
43
namespace
Foam
44
{
45
46
// Forward declaration of classes
47
48
/*---------------------------------------------------------------------------*\
49
Class searchableBox Declaration
50
\*---------------------------------------------------------------------------*/
51
52
class
searchableBox
53
:
54
public
searchableSurface
,
55
public
treeBoundBox
56
{
57
private
:
58
59
// Private Member Data
60
61
mutable
wordList
regions_;
62
63
64
// Private Member Functions
65
66
//- Project onto component dir of planePt and update index() (=face)
67
void
projectOntoCoordPlane
68
(
69
const
direction
dir,
70
const
point
& planePt,
71
pointIndexHit
&
info
72
)
const
;
73
74
//- Returns miss or hit with face (0..5)
75
pointIndexHit
findNearest
76
(
77
const
point
& bbMid,
78
const
point
& sample,
79
const
scalar nearestDistSqr
80
)
const
;
81
82
83
//- Disallow default bitwise copy construct
84
searchableBox
(
const
searchableBox
&);
85
86
//- Disallow default bitwise assignment
87
void
operator=(
const
searchableBox
&);
88
89
90
public
:
91
92
//- Runtime type information
93
TypeName
(
"searchableBox"
);
94
95
96
// Constructors
97
98
//- Construct from components
99
searchableBox
(
const
IOobject
& io,
const
treeBoundBox
& bb);
100
101
//- Construct from dictionary (used by searchableSurface)
102
searchableBox
103
(
104
const
IOobject
& io,
105
const
dictionary
& dict
106
);
107
108
// Destructor
109
110
virtual
~searchableBox
();
111
112
113
// Member Functions
114
115
virtual
const
wordList
&
regions
()
const
;
116
117
//- Whether supports volume type below
118
virtual
bool
hasVolumeType
()
const
119
{
120
return
true
;
121
}
122
123
//- Range of local indices that can be returned.
124
virtual
label
size
()
const
125
{
126
return
6;
127
}
128
129
//- Get representative set of element coordinates
130
// Usually the element centres (should be of length size()).
131
virtual
pointField
coordinates
()
const
;
132
133
// Single point queries.
134
135
//- Calculate nearest point on surface. Returns
136
// - bool : any point found nearer than nearestDistSqr
137
// - label: relevant index in surface (=face 0..5)
138
// - point: actual nearest point found
139
pointIndexHit
findNearest
140
(
141
const
point
& sample,
142
const
scalar nearestDistSqr
143
)
const
;
144
145
//- Calculate nearest point on edge. Returns
146
// - bool : any point found nearer than nearestDistSqr
147
// - label: relevant index in surface(=?)
148
// - point: actual nearest point found
149
pointIndexHit
findNearestOnEdge
150
(
151
const
point
& sample,
152
const
scalar nearestDistSqr
153
)
const
;
154
155
//- Find nearest to segment. Returns
156
// - bool : any point found?
157
// - label: relevant index in shapes (=face 0..5)
158
// - point: actual nearest point found
159
// sets:
160
// - tightest : bounding box
161
// - linePoint : corresponding nearest point on line
162
pointIndexHit
findNearest
163
(
164
const
linePointRef
&
ln
,
165
treeBoundBox
& tightest,
166
point
& linePoint
167
)
const
;
168
169
//- Find nearest intersection of line between start and end.
170
pointIndexHit
findLine
171
(
172
const
point
& start,
173
const
point
& end
174
)
const
;
175
176
//- Find any intersection of line between start and end.
177
pointIndexHit
findLineAny
178
(
179
const
point
& start,
180
const
point
& end
181
)
const
;
182
183
184
// Multiple point queries.
185
186
virtual
void
findNearest
187
(
188
const
pointField
& sample,
189
const
scalarField
& nearestDistSqr,
190
List<pointIndexHit>
&
191
)
const
;
192
193
virtual
void
findLine
194
(
195
const
pointField
& start,
196
const
pointField
& end,
197
List<pointIndexHit>
&
198
)
const
;
199
200
virtual
void
findLineAny
201
(
202
const
pointField
& start,
203
const
pointField
& end,
204
List<pointIndexHit>
&
205
)
const
;
206
207
//- Get all intersections in order from start to end.
208
virtual
void
findLineAll
209
(
210
const
pointField
& start,
211
const
pointField
& end,
212
List
<
List<pointIndexHit>
>&
213
)
const
;
214
215
//- From a set of points and indices get the region
216
virtual
void
getRegion
217
(
218
const
List<pointIndexHit>
&,
219
labelList
& region
220
)
const
;
221
222
//- From a set of points and indices get the normal
223
virtual
void
getNormal
224
(
225
const
List<pointIndexHit>
&,
226
vectorField
&
normal
227
)
const
;
228
229
//- Determine type (inside/outside/mixed) for point. unknown if
230
// cannot be determined (e.g. non-manifold surface)
231
virtual
void
getVolumeType
232
(
233
const
pointField
&,
234
List<volumeType>
&
235
)
const
;
236
237
238
// regIOobject implementation
239
240
bool
writeData
(
Ostream
&)
const
241
{
242
notImplemented
(
"searchableBox::writeData(Ostream&) const"
);
243
return
false
;
244
}
245
246
};
247
248
249
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
250
251
}
// End namespace Foam
252
253
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
254
255
#endif
256
257
// ************************ vim: set sw=4 sts=4 et: ************************ //