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
searchableSurface
searchableSurfacesQueries.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::searchableSurfacesQueries
26
27
Description
28
A collection of tools for searchableSurfaces.
29
30
SourceFiles
31
searchableSurfacesQueries.C
32
33
\*---------------------------------------------------------------------------*/
34
35
#ifndef searchableSurfacesQueries_H
36
#define searchableSurfacesQueries_H
37
38
#include <
meshTools/searchableSurface.H
>
39
40
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41
42
namespace
Foam
43
{
44
45
// Forward declaration of classes
46
class
plane;
47
48
/*---------------------------------------------------------------------------*\
49
Class searchableSurfacesQueries Declaration
50
\*---------------------------------------------------------------------------*/
51
52
class
searchableSurfacesQueries
53
{
54
// Private data
55
56
// Private Member Functions
57
58
//- Temporary wrapper around findNearest. Used in facesIntersection only
59
static
pointIndexHit
tempFindNearest
60
(
61
const
searchableSurface
&,
62
const
point
& pt,
63
const
scalar initDistSqr
64
);
65
66
//- Calculate sum of distances to nearest point on surfaces. Is used
67
// in minimisation to find intersection. Returns sum of (square of)
68
// distances to the surfaces.
69
static
scalar sumDistSqr
70
(
71
const
PtrList<searchableSurface>
&,
72
const
labelList
& surfacesToTest,
73
const
scalar initialDistSqr,
// search box
74
const
point
& pt
75
);
76
77
//- Takes the tet (points p) and reflects the point with the
78
// highest value around the centre (pSum). Checks if it gets closer
79
// and updates p, y if so.
80
static
scalar tryMorphTet
81
(
82
const
PtrList<searchableSurface>
&,
83
const
labelList
& surfacesToTest,
84
const
scalar initialDistSqr,
85
List<vector>
&
p
,
86
List<scalar>
&
y
,
87
vector
& pSum,
88
const
label ihi,
89
const
scalar fac
90
);
91
92
//- Downhill simplex method: find the point with min cumulative
93
// distance to all surfaces. Does so by morphing a tet (points p).
94
// Returns the point on the 0th surface or hit if not reached within
95
// maxIters iterations.
96
static
bool
morphTet
97
(
98
const
PtrList<searchableSurface>
&,
99
const
labelList
& surfacesToTest,
100
const
scalar initialDistSqr,
101
const
scalar convergenceDistSqr,
102
const
label maxIter,
103
List<vector>
& p,
104
List<scalar>
& y
105
);
106
107
//static void findAllIntersections
108
//(
109
// const searchableSurface& s,
110
// const pointField& start,
111
// const pointField& end,
112
// const vectorField& smallVec,
113
// List<List<pointIndexHit> >&
114
//);
115
116
static
void
mergeHits
117
(
118
const
point
& start,
119
const
scalar mergeDist,
120
121
const
label surfI,
122
const
List<pointIndexHit>
& surfHits,
123
124
labelList
& allSurfaces,
125
List<pointIndexHit>
& allInfo,
126
scalarList
& allDistSqr
127
);
128
129
public
:
130
131
// Declare name of the class and its debug switch
132
ClassName
(
"searchableSurfacesQueries"
);
133
134
135
// Multiple point queries.
136
137
//- Find any intersection. Return hit point information and
138
// index in surfacesToTest. If multiple surfaces hit the first
139
// surface is returned, not necessarily the nearest (to start).
140
static
void
findAnyIntersection
141
(
142
const
PtrList<searchableSurface>
&,
143
const
labelList
& surfacesToTest,
144
const
pointField
& start,
145
const
pointField
& end,
146
labelList
& surfaces,
147
List<pointIndexHit>
&
148
);
149
150
//- Find all intersections in order from start to end. Returns for
151
// every hit the index in surfacesToTest and the hit info.
152
static
void
findAllIntersections
153
(
154
const
PtrList<searchableSurface>
&,
155
const
labelList
& surfacesToTest,
156
const
pointField
& start,
157
const
pointField
& end,
158
labelListList
& surfaces,
159
List
<
List<pointIndexHit>
>& surfaceHits
160
);
161
162
//- Find nearest. Return -1 (and a miss()) or surface and nearest
163
// point.
164
static
void
findNearest
165
(
166
const
PtrList<searchableSurface>
&,
167
const
labelList
& surfacesToTest,
168
const
pointField
&,
169
const
scalarField
& nearestDistSqr,
170
labelList
& surfaces,
171
List<pointIndexHit>
&
172
);
173
174
175
// Single point queries
176
177
//- Calculate point which is on a set of surfaces. WIP.
178
static
pointIndexHit
facesIntersection
179
(
180
const
PtrList<searchableSurface>
& allSurfaces,
181
const
labelList
& surfacesToTest,
182
const
scalar initDistSqr,
183
const
scalar convergenceDistSqr,
184
const
point
& start
185
);
186
};
187
188
189
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190
191
}
// End namespace Foam
192
193
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194
195
#endif
196
197
// ************************ vim: set sw=4 sts=4 et: ************************ //