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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2017 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::searchableSurfacesQueries
28
29Description
30 A collection of tools for searchableSurfaces.
31
32SourceFiles
33 searchableSurfacesQueries.C
34
35\*---------------------------------------------------------------------------*/
36
37#ifndef searchableSurfacesQueries_H
38#define searchableSurfacesQueries_H
39
40#include "searchableSurface.H"
41
42// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43
44namespace Foam
45{
46
47// Forward declarations
48class plane;
49class pointConstraint;
50
51/*---------------------------------------------------------------------------*\
52 Class searchableSurfacesQueries Declaration
53\*---------------------------------------------------------------------------*/
56{
57 // Private Member Functions
58
59 static void mergeHits
60 (
61 const point& start,
62
63 const label surfI,
64 const List<pointIndexHit>& surfHits,
65
66 labelList& allSurfaces,
67 List<pointIndexHit>& allInfo,
68 scalarList& allDistSqr
69 );
70
71public:
72
73 // Declare name of the class and its debug switch
74 ClassName("searchableSurfacesQueries");
75
76
77 // Multiple point queries.
78
79 //- Find any intersection. Return hit point information and
80 // index in surfacesToTest. If multiple surfaces hit the first
81 // surface is returned, not necessarily the nearest (to start).
82 static void findAnyIntersection
83 (
85 const labelList& surfacesToTest,
86 const pointField& start,
87 const pointField& end,
88 labelList& surfaces,
90 );
91
92 //- Find all intersections in order from start to end. Returns for
93 // every hit the index in surfacesToTest and the hit info.
94 static void findAllIntersections
95 (
97 const labelList& surfacesToTest,
98 const pointField& start,
99 const pointField& end,
100 labelListList& surfaces,
101 List<List<pointIndexHit>>& surfaceHits
102 );
103
104 //- Find intersections of edge nearest to both endpoints.
105 static void findNearestIntersection
106 (
107 const PtrList<searchableSurface>& allSurfaces,
108 const labelList& surfacesToTest,
109 const pointField& start,
110 const pointField& end,
111 labelList& surface1,
113 labelList& surface2,
115 );
116
117 //- Find nearest. Return -1 (and a miss()) or surface and nearest
118 // point.
119 static void findNearest
120 (
122 const labelList& surfacesToTest,
123 const pointField&,
124 const scalarField& nearestDistSqr,
125 labelList& surfaces,
127 );
128
129 //- Find nearest points to a specific regions of the surface
130 static void findNearest
131 (
132 const PtrList<searchableSurface>& allSurfaces,
133 const labelList& surfacesToTest,
134 const labelListList& regionIndices,
135 const pointField& samples,
136 const scalarField& nearestDistSqr,
137 labelList& nearestSurfaces,
138 List<pointIndexHit>& nearestInfo
139 );
140
141 //- Find nearest points that are on all supplied surfaces
142 // (nearest point if single surface; nearest intersection by
143 // steepest descent if on multiple surfaces). Returns current
144 // best guess). Wip.
145 static void findNearest
146 (
147 const PtrList<searchableSurface>& allSurfaces,
148 const labelList& surfacesToTest,
149 const pointField& start,
150 const scalarField& distSqr,
151 pointField& near,
152 List<pointConstraint>& constraint,
153 const label nIter = 20
154 );
155
156 //- Find signed distance to nearest surface. Outside is positive.
157 // illegalHandling: how to handle non-inside or outside
158 // OUTSIDE : treat as outside
159 // INSIDE : treat as inside
160 // UNKNOWN : throw fatal error
161 static void signedDistance
162 (
163 const PtrList<searchableSurface>& allSurfaces,
164 const labelList& surfacesToTest,
165 const pointField& samples,
166 const scalarField& nearestDistSqr,
167 const volumeType illegalHandling,
168 labelList& nearestSurfaces,
170 );
171
172 //- Find the boundBox of the selected surfaces
173 static boundBox bounds
174 (
175 const PtrList<searchableSurface>& allSurfaces,
176 const labelUList& surfacesToTest
177 );
178};
179
180
181// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182
183} // End namespace Foam
184
185// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186
187#endif
188
189// ************************************************************************* //
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:77
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: PtrList.H:73
A bounding box defined in terms of min/max extrema points.
Definition: boundBox.H:64
A collection of tools for searchableSurfaces.
static void findNearestIntersection(const PtrList< searchableSurface > &allSurfaces, const labelList &surfacesToTest, const pointField &start, const pointField &end, labelList &surface1, List< pointIndexHit > &hit1, labelList &surface2, List< pointIndexHit > &hit2)
Find intersections of edge nearest to both endpoints.
static void signedDistance(const PtrList< searchableSurface > &allSurfaces, const labelList &surfacesToTest, const pointField &samples, const scalarField &nearestDistSqr, const volumeType illegalHandling, labelList &nearestSurfaces, scalarField &distance)
Find signed distance to nearest surface. Outside is positive.
static void findAnyIntersection(const PtrList< searchableSurface > &, const labelList &surfacesToTest, const pointField &start, const pointField &end, labelList &surfaces, List< pointIndexHit > &)
Find any intersection. Return hit point information and.
ClassName("searchableSurfacesQueries")
static void findAllIntersections(const PtrList< searchableSurface > &, const labelList &surfacesToTest, const pointField &start, const pointField &end, labelListList &surfaces, List< List< pointIndexHit > > &surfaceHits)
Find all intersections in order from start to end. Returns for.
static void findNearest(const PtrList< searchableSurface > &, const labelList &surfacesToTest, const pointField &, const scalarField &nearestDistSqr, labelList &surfaces, List< pointIndexHit > &)
Find nearest. Return -1 (and a miss()) or surface and nearest.
static boundBox bounds(const PtrList< searchableSurface > &allSurfaces, const labelUList &surfacesToTest)
Find the boundBox of the selected surfaces.
An enumeration wrapper for classification of a location as being inside/outside of a volume.
Definition: volumeType.H:61
#define ClassName(TypeNameString)
Add typeName information from argument TypeNameString to a class.
Definition: className.H:67
Namespace for OpenFOAM.
scalar distance(const vector &p1, const vector &p2)
Definition: curveTools.C:12
scalarField samples(nIntervals, Zero)