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
octree
octreeDataPoint.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::octreeDataPoint
26
27
Description
28
Encapsulation of data needed for octree searches.
29
30
Used for searching for nearest point. No bounding boxes around points.
31
Only overlaps and calcNearest are implemented, rest makes little sense.
32
Holds (reference to) pointField.
33
34
SourceFiles
35
octreeDataPoint.C
36
octreeDataPointTreaLeaf.H (template specialization of treeleaf)
37
octreeDataPointTreeLeaf.C (template specialization of treeleaf)
38
39
\*---------------------------------------------------------------------------*/
40
41
#ifndef octreeDataPoint_H
42
#define octreeDataPoint_H
43
44
#include <
OpenFOAM/point.H
>
45
#include <
OpenFOAM/pointField.H
>
46
#include "
treeBoundBox.H
"
47
#include <
OpenFOAM/linePointRef.H
>
48
49
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50
51
namespace
Foam
52
{
53
54
template
<
class
Type>
class
octree;
55
56
/*---------------------------------------------------------------------------*\
57
Class octreeDataPoint Declaration
58
\*---------------------------------------------------------------------------*/
59
60
class
octreeDataPoint
61
{
62
// Private data
63
64
const
pointField
& points_;
65
66
public
:
67
68
// Constructors
69
70
//- Construct from components. Holds reference to points!
71
explicit
octreeDataPoint
(
const
pointField
&);
72
73
74
// Member Functions
75
76
// Access
77
78
const
pointField
&
points
()
const
79
{
80
return
points_;
81
}
82
83
label
size
()
const
84
{
85
return
points_.
size
();
86
}
87
88
// Search
89
90
//- Get type of sample
91
label
getSampleType
92
(
93
const
octree<octreeDataPoint>
&,
94
const
point
&
95
)
const
;
96
97
//- Does (bb of) shape at index overlap bb
98
bool
overlaps
99
(
100
const
label index,
101
const
treeBoundBox
& sampleBb
102
)
const
;
103
104
//- Does shape at index contain sample
105
bool
contains
106
(
107
const
label index,
108
const
point
& sample
109
)
const
;
110
111
//- Segment (from start to end) intersection with shape
112
// at index. If intersects returns true and sets intersectionPoint
113
bool
intersects
114
(
115
const
label index,
116
const
point
& start,
117
const
point
& end,
118
point
& intersectionPoint
119
)
const
;
120
121
//- Sets newTightest to bounding box (and returns true) if
122
// nearer to sample than tightest bounding box. Otherwise
123
// returns false.
124
bool
findTightest
125
(
126
const
label index,
127
const
point
& sample,
128
treeBoundBox
& tightest
129
)
const
;
130
131
//- Given index get unit normal and calculate (numerical) sign
132
// of sample.
133
// Used to determine accuracy of calcNearest or inside/outside.
134
// Note: always returns GREAT since no inside/outside.
135
scalar
calcSign
136
(
137
const
label index,
138
const
point
& sample,
139
vector
& n
140
)
const
;
141
142
143
//- Calculates nearest (to sample) point on/in shape.
144
// Returns point and mag(nearest - sample)
145
scalar
calcNearest
146
(
147
const
label index,
148
const
point
& sample,
149
point
& nearest
150
)
const
;
151
152
//- Calculates nearest (to line segment) point in shape.
153
// Returns distance and both point.
154
scalar
calcNearest
155
(
156
const
label index,
157
const
linePointRef
&
ln
,
158
point
& linePt,
// nearest point on line
159
point
& shapePt
// nearest point on shape
160
)
const
;
161
162
163
164
// Write
165
166
//- Write shape at index
167
void
write
(
Ostream
& os,
const
label index)
const
;
168
169
170
// IOstream Operators
171
172
friend
Ostream
&
operator<<
(
Ostream
&,
const
octreeDataPoint
&);
173
};
174
175
176
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177
178
}
// End namespace Foam
179
180
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181
182
#endif
183
184
// ************************ vim: set sw=4 sts=4 et: ************************ //