OpenFOAM: API Guide
v2112
The open source CFD toolbox
triSurfaceSearch.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 | www.openfoam.com
6
\\/ M anipulation |
7
-------------------------------------------------------------------------------
8
Copyright (C) 2011-2016 OpenFOAM Foundation
9
Copyright (C) 2017 OpenCFD Ltd.
10
-------------------------------------------------------------------------------
11
License
12
This file is part of OpenFOAM.
13
14
OpenFOAM is free software: you can redistribute it and/or modify it
15
under the terms of the GNU General Public License as published by
16
the Free Software Foundation, either version 3 of the License, or
17
(at your option) any later version.
18
19
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22
for more details.
23
24
You should have received a copy of the GNU General Public License
25
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27
Class
28
Foam::triSurfaceSearch
29
30
Description
31
Helper class to search on triSurface.
32
33
SourceFiles
34
triSurfaceSearch.C
35
36
\*---------------------------------------------------------------------------*/
37
38
#ifndef triSurfaceSearch_H
39
#define triSurfaceSearch_H
40
41
#include "
pointField.H
"
42
#include "
boolList.H
"
43
#include "
pointIndexHit.H
"
44
#include "
indexedOctree.H
"
45
#include "
treeDataTriSurface.H
"
46
47
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48
49
namespace
Foam
50
{
51
52
// Forward declaration of classes
53
class
triSurface;
54
55
/*---------------------------------------------------------------------------*\
56
Class triSurfaceSearch Declaration
57
\*---------------------------------------------------------------------------*/
58
59
class
triSurfaceSearch
60
{
61
// Private data
62
63
//- Reference to surface to work on
64
const
triSurface
& surface_;
65
66
//- Optional tolerance to use in searches
67
scalar tolerance_;
68
69
//- Optional max tree depth of octree
70
label maxTreeDepth_;
71
72
//- Octree for searches
73
mutable
autoPtr<indexedOctree<treeDataTriSurface>
> treePtr_;
74
75
76
// Private Member Functions
77
78
//- Check whether the current hit on the surface which lies on lineVec
79
// is unique.
80
// point : return 1 unique hit
81
// edge : return 1 hit if in the cone of the edge faces
82
// : return 2 hits if outside or on the cone.
83
bool
checkUniqueHit
84
(
85
const
pointIndexHit
& currHit,
86
const
UList<pointIndexHit>
& hits,
87
const
vector
& lineVec
88
)
const
;
89
90
//- No copy construct
91
triSurfaceSearch
(
const
triSurfaceSearch
&) =
delete
;
92
93
//- No copy assignment
94
void
operator=(
const
triSurfaceSearch
&) =
delete
;
95
96
97
public
:
98
99
// Constructors
100
101
//- Construct from surface. Holds reference to surface!
102
explicit
triSurfaceSearch
(
const
triSurface
&
surface
);
103
104
//- Construct from surface and dictionary.
105
triSurfaceSearch
(
const
triSurface
&
surface
,
const
dictionary
&
dict
);
106
107
//- Construct from components.
108
// A invalid (negative) tolerance uses the default tolerance.
109
triSurfaceSearch
110
(
111
const
triSurface
&
surface
,
112
const
scalar
tolerance
,
113
const
label
maxTreeDepth
= 10
114
);
115
116
117
//- Destructor
118
~triSurfaceSearch
();
119
120
//- Clear storage
121
void
clearOut
();
122
123
124
// Member Functions
125
126
//- Demand driven construction of the octree
127
const
indexedOctree<treeDataTriSurface>
&
tree
()
const
;
128
129
//- Return reference to the surface.
130
const
triSurface
&
surface
()
const
131
{
132
return
surface_;
133
}
134
135
//- Return tolerance to use in searches
136
scalar
tolerance
()
const
137
{
138
return
tolerance_;
139
}
140
141
//- Return max tree depth of octree
142
label
maxTreeDepth
()
const
143
{
144
return
maxTreeDepth_;
145
}
146
147
//- Calculate for each searchPoint inside/outside status.
148
boolList
calcInside
(
const
pointField
& searchPoints)
const
;
149
150
void
findNearest
151
(
152
const
pointField
&
samples
,
153
const
scalarField
& nearestDistSqr,
154
List<pointIndexHit>
& info
155
)
const
;
156
157
//- Calculate nearest point on surface for single searchPoint. Returns
158
// in pointIndexHit:
159
// - hit() : whether nearest point found within bounding box
160
// - hitPoint() : coordinate of nearest point
161
// - index() : surface triangle label
162
pointIndexHit
nearest
(
const
point
& pt,
const
vector
& span)
const
;
163
164
void
findLine
165
(
166
const
pointField
& start,
167
const
pointField
&
end
,
168
List<pointIndexHit>
& info
169
)
const
;
170
171
void
findLineAny
172
(
173
const
pointField
& start,
174
const
pointField
&
end
,
175
List<pointIndexHit>
& info
176
)
const
;
177
178
//- Calculate all intersections from start to end
179
void
findLineAll
180
(
181
const
pointField
& start,
182
const
pointField
&
end
,
183
List
<
List<pointIndexHit>
>& info
184
)
const
;
185
};
186
187
188
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189
190
}
// End namespace Foam
191
192
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193
194
#endif
195
196
// ************************************************************************* //
pointIndexHit.H
boolList.H
Foam::triSurfaceSearch::nearest
pointIndexHit nearest(const point &pt, const vector &span) const
Calculate nearest point on surface for single searchPoint. Returns.
Definition:
triSurfaceSearch.C:320
Foam::triSurfaceSearch::findLineAll
void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit >> &info) const
Calculate all intersections from start to end.
Definition:
triSurfaceSearch.C:379
indexedOctree.H
Foam::triSurfaceSearch::findNearest
void findNearest(const pointField &samples, const scalarField &nearestDistSqr, List< pointIndexHit > &info) const
Definition:
triSurfaceSearch.C:290
Foam::triSurfaceSearch::maxTreeDepth
label maxTreeDepth() const
Return max tree depth of octree.
Definition:
triSurfaceSearch.H:141
Foam::triSurfaceSearch
Helper class to search on triSurface.
Definition:
triSurfaceSearch.H:58
Foam::triSurfaceSearch::tolerance
scalar tolerance() const
Return tolerance to use in searches.
Definition:
triSurfaceSearch.H:135
Foam::PointIndexHit
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
Definition:
PointIndexHit.H:52
Foam::Field< vector >
Foam::triSurface
Triangulated surface description with patch information.
Definition:
triSurface.H:76
Foam::triSurfaceSearch::tree
const indexedOctree< treeDataTriSurface > & tree() const
Demand driven construction of the octree.
Definition:
triSurfaceSearch.C:206
Foam::triSurfaceSearch::~triSurfaceSearch
~triSurfaceSearch()
Destructor.
Definition:
triSurfaceSearch.C:191
Foam::indexedOctree
Non-pointer based hierarchical recursive searching.
Definition:
treeDataEdge.H:50
samples
scalarField samples(nIntervals, Zero)
Foam::triSurfaceSearch::clearOut
void clearOut()
Clear storage.
Definition:
triSurfaceSearch.C:197
dict
dictionary dict
Definition:
searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition:
dictionary.H:123
stdFoam::end
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
Definition:
stdFoam.H:121
Foam
Namespace for OpenFOAM.
Definition:
atmBoundaryLayer.C:33
Foam::triSurfaceSearch::calcInside
boolList calcInside(const pointField &searchPoints) const
Calculate for each searchPoint inside/outside status.
Definition:
triSurfaceSearch.C:262
treeDataTriSurface.H
pointField.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition:
HashPtrTable.H:53
Foam::triSurfaceSearch::findLine
void findLine(const pointField &start, const pointField &end, List< pointIndexHit > &info) const
Definition:
triSurfaceSearch.C:333
Foam::Vector< scalar >
Foam::List< bool >
Foam::UList
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition:
HashTable.H:103
Foam::triSurfaceSearch::surface
const triSurface & surface() const
Return reference to the surface.
Definition:
triSurfaceSearch.H:129
Foam::triSurfaceSearch::findLineAny
void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &info) const
Definition:
triSurfaceSearch.C:356
src
meshTools
triSurface
triSurfaceSearch
triSurfaceSearch.H
Generated by
1.8.17
OPENFOAM® is a registered
trademark
of OpenCFD Ltd.