searchableDisk.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) 2014-2017 OpenFOAM Foundation
9 Copyright (C) 2018 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::searchableDisk
29
30Description
31 Searching on circular disk given as origin, normal (gets normalised)
32 and radius. Optionally it can be an annular ring.
33
34 \heading Dictionary parameters
35 \table
36 Property | Description | Required | Default
37 type | disk | selector |
38 origin | centre of disk | yes |
39 normal | normal vector | yes |
40 radius | disk radius | yes |
41 innerRadius | inner disk radius | no | 0
42 \endtable
43
44Note
45 Longer type name : \c searchableDisk
46
47SourceFiles
48 searchableDisk.C
49
50\*---------------------------------------------------------------------------*/
51
52#ifndef searchableDisk_H
53#define searchableDisk_H
54
55#include "plane.H"
56#include "MinMax.H"
57#include "searchableSurface.H"
58
59// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60
61namespace Foam
62{
63
64/*---------------------------------------------------------------------------*\
65 Class searchableDisk Declaration
66\*---------------------------------------------------------------------------*/
67
68class searchableDisk
69:
70 public searchableSurface,
71 public plane
72{
73private:
74
75 // Private Data
76
77 //- Inner/outer radial limits
78 const scalarMinMax radialLimits_;
79
80 //- Names of regions
81 mutable wordList regions_;
82
83
84 // Private Member Functions
85
86 //- Inherit findNearest from searchableSurface
88
89 //- Find nearest point on disk
90 pointIndexHit findNearest
91 (
92 const point& sample,
93 const scalar nearestDistSqr
94 ) const;
95
96 //- Find intersection with disk
97 void findLine
98 (
99 const point& start,
100 const point& end,
102 ) const;
103
104 //- No copy construct
105 searchableDisk(const searchableDisk&) = delete;
106
107 //- No copy assignment
108 void operator=(const searchableDisk&) = delete;
109
110public:
111
112 //- Runtime type information
113 TypeName("searchableDisk");
114
115
116 // Constructors
117
118 //- Construct from components
120 (
121 const IOobject& io,
122 const point& originPoint,
123 const vector& normalVector,
124 const scalar outerRadius,
125 const scalar innerRadius = 0
126 );
127
128 //- Construct from dictionary (used by searchableSurface)
130 (
131 const IOobject& io,
132 const dictionary& dict
133 );
134
135
136 //- Destructor
137 virtual ~searchableDisk() = default;
138
139
140 // Member Functions
141
142 //- Names of regions
143 virtual const wordList& regions() const;
144
145 //- Whether supports volume type (below)
146 virtual bool hasVolumeType() const
147 {
148 return false;
149 }
150
151 //- What is type of points outside bounds
152 virtual volumeType outsideVolumeType() const
153 {
154 return volumeType::UNKNOWN;
155 }
156
157 //- Range of local indices that can be returned.
158 virtual label size() const
159 {
160 return 1;
161 }
162
163 //- Get representative set of element coordinates
164 // Usually the element centres (should be of length size()).
165 virtual tmp<pointField> coordinates() const
167 return tmp<pointField>::New(one{}, origin());
168 }
169
170 //- Get bounding spheres (centre and radius squared), one per element.
171 // Any point on element is guaranteed to be inside.
172 virtual void boundingSpheres
173 (
174 pointField& centres,
175 scalarField& radiusSqr
176 ) const;
177
178 //- Get the points that define the surface.
179 virtual tmp<pointField> points() const
180 {
181 return coordinates();
182 }
183
184 //- Does any part of the surface overlap the supplied bound box?
185 virtual bool overlaps(const boundBox& bb) const
186 {
188 return false;
189 }
190
191
192 // Multiple point queries.
193
194 virtual void findNearest
195 (
196 const pointField& sample,
197 const scalarField& nearestDistSqr,
199 ) const;
200
201 virtual void findLine
202 (
203 const pointField& start,
204 const pointField& end,
206 ) const;
207
208 virtual void findLineAny
209 (
210 const pointField& start,
211 const pointField& end,
213 ) const;
215 //- Get all intersections in order from start to end.
216 virtual void findLineAll
217 (
218 const pointField& start,
219 const pointField& end,
221 ) const;
222
223 //- From a set of points and indices get the region
224 virtual void getRegion
225 (
226 const List<pointIndexHit>&,
227 labelList& region
228 ) const;
229
230 //- From a set of points and indices get the normal
231 virtual void getNormal
232 (
233 const List<pointIndexHit>&,
234 vectorField& normals
235 ) const;
236
237 //- Determine type (inside/outside/mixed) for point.
238 // Unknown if cannot be determined (e.g. non-manifold surface)
239 virtual void getVolumeType
240 (
241 const pointField& points,
242 List<volumeType>& volType
243 ) const;
244
245
246 // regIOobject implementation
247
248 bool writeData(Ostream&) const
249 {
251 return false;
252 }
253};
254
255
256// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
257
258} // End namespace Foam
259
260// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
261
262#endif
263
264// ************************************************************************* //
Minimal example by using system/controlDict.functions:
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
Definition: PointIndexHit.H:66
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: Time.C:717
A bounding box defined in terms of min/max extrema points.
Definition: boundBox.H:64
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
Definition: one.H:62
Geometric class that creates a 3D plane and can return the intersection point between a line and the ...
Definition: plane.H:95
const point & origin() const noexcept
The plane base point.
Definition: planeI.H:45
Searching on circular disk given as origin, normal (gets normalised) and radius. Optionally it can be...
virtual label size() const
Range of local indices that can be returned.
virtual bool overlaps(const boundBox &bb) const
Does any part of the surface overlap the supplied bound box?
bool writeData(Ostream &) const
Pure virtual writeData function.
virtual ~searchableDisk()=default
Destructor.
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit > > &) const
Get all intersections in order from start to end.
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Return any intersection on segment from start to end.
virtual void boundingSpheres(pointField &centres, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared), one per element.
TypeName("searchableDisk")
Runtime type information.
virtual void getVolumeType(const pointField &points, List< volumeType > &volType) const
Determine type (inside/outside/mixed) for point.
virtual tmp< pointField > coordinates() const
Get representative set of element coordinates.
virtual tmp< pointField > points() const
Get the points that define the surface.
virtual volumeType outsideVolumeType() const
What is type of points outside bounds.
virtual void getRegion(const List< pointIndexHit > &, labelList &region) const
From a set of points and indices get the region.
virtual const wordList & regions() const
Names of regions.
virtual bool hasVolumeType() const
Whether supports volume type (below)
virtual void getNormal(const List< pointIndexHit > &, vectorField &normals) const
From a set of points and indices get the normal.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
virtual void findNearest(const pointField &sample, const scalarField &nearestDistSqr, List< pointIndexHit > &) const =0
A class for managing temporary objects.
Definition: tmp.H:65
An enumeration wrapper for classification of a location as being inside/outside of a volume.
Definition: volumeType.H:61
@ UNKNOWN
Unknown state.
Definition: volumeType.H:67
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
Namespace for OpenFOAM.
List< word > wordList
A List of words.
Definition: fileName.H:63
PointIndexHit< point > pointIndexHit
A PointIndexHit for 3D points.
Definition: pointIndexHit.H:46
MinMax< scalar > scalarMinMax
A scalar min/max range.
Definition: MinMax.H:117
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:44
vector point
Point is a vector.
Definition: point.H:43
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73