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