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
applications
utilities
surface
surfaceToPatch
treeDataPrimitivePatch.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::treeDataPrimitivePatch
26
27
Description
28
Encapsulation of data needed to search on PrimitivePatches
29
30
SourceFiles
31
treeDataPrimitivePatch.C
32
33
\*---------------------------------------------------------------------------*/
34
35
#ifndef treeDataPrimitivePatch_H
36
#define treeDataPrimitivePatch_H
37
38
#include <
OpenFOAM/PrimitivePatch_.H
>
39
//#include "indexedOctree.H"
40
#include <
meshTools/treeBoundBoxList.H
>
41
42
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43
44
namespace
Foam
45
{
46
47
// Forward declaration of classes
48
template
<
class
Type>
class
indexedOctree;
49
50
51
/*---------------------------------------------------------------------------*\
52
Class treeDataPrimitivePatchName Declaration
53
\*---------------------------------------------------------------------------*/
54
55
TemplateName
(treeDataPrimitivePatch);
56
57
58
/*---------------------------------------------------------------------------*\
59
Class treeDataPrimitivePatch Declaration
60
\*---------------------------------------------------------------------------*/
61
62
template
63
<
64
class
Face,
65
template
<
class
>
class
FaceList,
66
class
PointField,
67
class
PointType=
point
68
>
69
class
treeDataPrimitivePatch
70
:
71
public
treeDataPrimitivePatchName
72
{
73
// Static data
74
75
//- tolerance on linear dimensions
76
static
scalar tolSqr;
77
78
// Private data
79
80
//- Underlying geometry
81
const
PrimitivePatch<Face, FaceList, PointField, PointType>
& patch_;
82
83
//- Whether to precalculate and store face bounding box
84
const
bool
cacheBb_;
85
86
//- face bounding boxes (valid only if cacheBb_)
87
treeBoundBoxList
bbs_;
88
89
90
// Private Member Functions
91
92
//- Calculate face bounding box
93
static
treeBoundBox
calcBb(
const
pointField
&,
const
face
&);
94
95
//- Initialise all member data
96
void
update();
97
98
public
:
99
100
// Constructors
101
102
//- Construct from patch.
103
treeDataPrimitivePatch
104
(
105
const
bool
cacheBb,
106
const
PrimitivePatch<Face, FaceList, PointField, PointType>
&
107
);
108
109
110
// Member Functions
111
112
// Access
113
114
label
size
()
const
115
{
116
return
patch_.size();
117
}
118
119
//- Get representative point cloud for all shapes inside
120
// (one point per shape)
121
pointField
points
()
const
;
122
123
124
// Search
125
126
//- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
127
// Only makes sense for closed surfaces.
128
label
getVolumeType
129
(
130
const
indexedOctree
131
<
132
treeDataPrimitivePatch
133
<
134
Face,
135
FaceList,
136
PointField,
137
PointType
138
>
139
>&,
140
const
point
&
141
)
const
;
142
143
//- Does (bb of) shape at index overlap bb
144
bool
overlaps
145
(
146
const
label index,
147
const
treeBoundBox
& sampleBb
148
)
const
;
149
150
//- Calculates nearest (to sample) point in shape.
151
// Returns actual point and distance (squared)
152
void
findNearest
153
(
154
const
labelList
& indices,
155
const
point
& sample,
156
157
scalar& nearestDistSqr,
158
label& nearestIndex,
159
point
& nearestPoint
160
)
const
;
161
162
//- Calculates nearest (to line) point in shape.
163
// Returns point and distance (squared)
164
void
findNearest
165
(
166
const
labelList
& indices,
167
const
linePointRef
&
ln
,
168
169
treeBoundBox
& tightest,
170
label& minIndex,
171
point
& linePoint,
172
point
& nearestPoint
173
)
const
174
{
175
notImplemented
176
(
177
"treeDataPrimitivePatch::findNearest"
178
"(const labelList&, const linePointRef&, ..)"
179
);
180
}
181
182
//- Calculate intersection of shape with ray. Sets result
183
// accordingly
184
bool
intersects
185
(
186
const
label index,
187
const
point
& start,
188
const
point
& end,
189
point
& result
190
)
const
;
191
192
};
193
194
195
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196
197
}
// End namespace Foam
198
199
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200
201
#ifdef NoRepository
202
# include "
treeDataPrimitivePatch.C
"
203
#endif
204
205
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206
207
#endif
208
209
// ************************************************************************* //