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
octreeDataEdges.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::octreeDataEdges
26
27
Description
28
Holds data for octree to work on an edges subset.
29
30
SourceFiles
31
octreeDataEdges.C
32
33
\*---------------------------------------------------------------------------*/
34
35
#ifndef octreeDataEdges_H
36
#define octreeDataEdges_H
37
38
#include <
OpenFOAM/line.H
>
39
#include <
OpenFOAM/linePointRef.H
>
40
#include "
treeBoundBoxList.H
"
41
#include <
OpenFOAM/labelList.H
>
42
#include <
OpenFOAM/className.H
>
43
44
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
46
namespace
Foam
47
{
48
49
// Forward declaration of classes
50
template
<
class
Type>
class
octree;
51
52
/*---------------------------------------------------------------------------*\
53
Class octreeDataEdges Declaration
54
\*---------------------------------------------------------------------------*/
55
56
class
octreeDataEdges
57
{
58
// Static data
59
60
//- tolerance on linear dimensions
61
static
scalar tol;
62
63
64
// Private data
65
66
//- Reference to edgeList
67
const
edgeList
& edges_;
68
69
//- Reference to points
70
const
pointField
& points_;
71
72
//- labels of edges
73
labelList
edgeLabels_;
74
75
//- bbs for all above edges
76
treeBoundBoxList
allBb_;
77
78
79
public
:
80
81
// Declare name of the class and its debug switch
82
ClassName
(
"octreeDataEdges"
);
83
84
// Constructors
85
86
//- Construct from selected edges. !Holds references to edges and points
87
octreeDataEdges
88
(
89
const
edgeList
&
edges
,
90
const
pointField
&
points
,
91
const
labelList
&
edgeLabels
92
);
93
94
//- Construct as copy
95
octreeDataEdges
(
const
octreeDataEdges
&);
96
97
98
// Destructor
99
100
~octreeDataEdges
();
101
102
103
// Member Functions
104
105
// Access
106
107
const
edgeList
&
edges
()
const
108
{
109
return
edges_;
110
}
111
112
const
pointField
&
points
()
const
113
{
114
return
points_;
115
}
116
117
const
labelList
&
edgeLabels
()
const
118
{
119
return
edgeLabels_;
120
}
121
122
const
treeBoundBoxList
&
allBb
()
const
123
{
124
return
allBb_;
125
}
126
127
label
size
()
const
128
{
129
return
allBb_.
size
();
130
}
131
132
133
// Search
134
135
//- Get type of sample
136
label
getSampleType
137
(
138
const
octree<octreeDataEdges>
&,
139
const
point
&
140
)
const
;
141
142
//- Does (bb of) shape at index overlap bb
143
bool
overlaps
144
(
145
const
label index,
146
const
treeBoundBox
& sampleBb
147
)
const
;
148
149
//- Does shape at index contain sample
150
bool
contains
151
(
152
const
label index,
153
const
point
& sample
154
)
const
;
155
156
//- Segment (from start to end) intersection with shape at index.
157
// If intersects returns true and sets intersectionPoint
158
bool
intersects
159
(
160
const
label index,
161
const
point
& start,
162
const
point
& end,
163
point
& intersectionPoint
164
)
const
;
165
166
//- Sets newTightest to bounding box (and returns true) if
167
// nearer to sample than tightest bounding box. Otherwise
168
// returns false.
169
bool
findTightest
170
(
171
const
label index,
172
const
point
& sample,
173
treeBoundBox
& tightest
174
)
const
;
175
176
//- Given index get unit normal and calculate (numerical) sign
177
// of sample.
178
// Used to determine accuracy of calcNearest or inside/outside.
179
scalar
calcSign
180
(
181
const
label index,
182
const
point
& sample,
183
vector
& n
184
)
const
;
185
186
//- Calculates nearest (to sample) point in shape.
187
// Returns point and mag(nearest - sample).
188
scalar
calcNearest
189
(
190
const
label index,
191
const
point
& sample,
192
point
& nearest
193
)
const
;
194
195
//- Calculates nearest (to line segment) point in shape.
196
// Returns distance and both point.
197
scalar
calcNearest
198
(
199
const
label index,
200
const
linePointRef
&
ln
,
201
point
& linePt,
// nearest point on line
202
point
& shapePt
// nearest point on shape
203
)
const
;
204
205
206
// Write
207
208
//- Write shape at index
209
void
write
(
Ostream
& os,
const
label index)
const
;
210
};
211
212
213
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214
215
}
// End namespace Foam
216
217
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218
219
220
#endif
221
222
// ************************ vim: set sw=4 sts=4 et: ************************ //