searchablePlate.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 Copyright (C) 2018-2020 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::searchablePlate
29
30Description
31 Searching on finite plate. Plate has to be aligned with coordinate
32 axes.
33 Plate defined as origin and span. One of the components of span has
34 to be 0 which defines the normal direction. E.g.
35
36 \verbatim
37 span = (Sx Sy 0) // plate in x-y plane
38 origin = (Ox Oy Oz)
39 \endverbatim
40
41 now plane is from (Ox Oy Oz) to (Ox+Sx Oy+Sy Oz)
42
43 \heading Dictionary parameters
44 \table
45 Property | Description | Required | Default
46 type | plate | selector |
47 origin | The minimum corner of the plate | yes |
48 span | The plate dimensions | yes |
49 \endtable
50
51Note
52 Longer type name : \c searchablePlate
53
54SourceFiles
55 searchablePlate.C
56
57\*---------------------------------------------------------------------------*/
58
59#ifndef searchablePlate_H
60#define searchablePlate_H
61
62#include "searchableSurface.H"
63#include "treeBoundBox.H"
64
65// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
66
67namespace Foam
68{
69
70/*---------------------------------------------------------------------------*\
71 Class searchablePlate Declaration
72\*---------------------------------------------------------------------------*/
73
74class searchablePlate
75:
76 public searchableSurface
77{
78 // Private Member Data
79
80 //- The minimum corner of the plate
81 const point origin_;
82
83 //- The span size of the plate
84 const vector span_;
85
86 //- Coordinate direction which is normal
87 const direction normalDir_;
88
89 //- Names of regions
90 mutable wordList regions_;
91
92
93 // Private Member Functions
94
95 //- Calculate normal direction from span
96 static direction calcNormal(const point&);
97
98 //- Inherit findNearest from searchableSurface
100
101 pointIndexHit findNearest
102 (
103 const point& sample,
104 const scalar nearestDistSqr
105 ) const;
106
107 pointIndexHit findLine
108 (
109 const point& start,
110 const point& end
111 ) const;
112
113 //- No copy construct
114 searchablePlate(const searchablePlate&) = delete;
115
116 //- No copy assignment
117 void operator=(const searchablePlate&) = delete;
118
119
120public:
121
122 //- Runtime type information
123 TypeName("searchablePlate");
124
125
126 // Constructors
127
128 //- Construct from components
130 (
131 const IOobject& io,
132 const point& origin,
133 const vector& span
134 );
135
136 //- Construct from dictionary (used by searchableSurface)
138 (
139 const IOobject& io,
140 const dictionary& dict
141 );
143
144 //- Destructor
145 virtual ~searchablePlate() = default;
146
147
148 // Member Functions
149
150 //- The centre (origin) of the plate
151 inline const point& centre() const noexcept
152 {
153 return origin_;
154 }
155
156 //- Names of regions
157 virtual const wordList& regions() const;
158
159 //- Whether supports volume type below
160 virtual bool hasVolumeType() const
161 {
162 return false;
163 }
165 //- What is type of points outside bounds
166 virtual volumeType outsideVolumeType() const
167 {
168 return volumeType::UNKNOWN;
169 }
171 //- Range of local indices that can be returned.
172 virtual label size() const
173 {
174 return 1;
175 }
176
177 //- Get representative set of element coordinates
178 // Usually the element centres (should be of length size()).
180
181 //- Get bounding spheres (centre and radius squared), one per element.
182 // Any point on element is guaranteed to be inside.
183 virtual void boundingSpheres
184 (
185 pointField& centres,
186 scalarField& radiusSqr
187 ) const;
188
189 //- Get the points that define the surface.
190 virtual tmp<pointField> points() const;
192 //- Does any part of the surface overlap the supplied bound box?
193 virtual bool overlaps(const boundBox& bb) const;
194
195
196 // Multiple point queries.
197
198 virtual void findNearest
199 (
200 const pointField& sample,
201 const scalarField& nearestDistSqr,
203 ) const;
204
205 virtual void findLine
206 (
207 const pointField& start,
208 const pointField& end,
210 ) const;
211
212 virtual void findLineAny
213 (
214 const pointField& start,
215 const pointField& end,
217 ) const;
218
219 //- Get all intersections in order from start to end.
220 virtual void findLineAll
221 (
222 const pointField& start,
223 const pointField& end,
225 ) const;
226
227 //- From a set of points and indices get the region
228 virtual void getRegion
229 (
230 const List<pointIndexHit>&,
231 labelList& region
232 ) const;
233
234 //- From a set of points and indices get the normal
235 virtual void getNormal
236 (
237 const List<pointIndexHit>&,
238 vectorField& normal
239 ) const;
240
241 //- Determine type (inside/outside/mixed) for point. unknown if
242 // cannot be determined (e.g. non-manifold surface)
243 virtual void getVolumeType
244 (
245 const pointField&,
247 ) const;
248
249
250 // regIOobject implementation
251
252 bool writeData(Ostream&) const
253 {
255 return false;
256 }
257};
258
259
260// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
261
262} // End namespace Foam
263
264// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
265
266#endif
267
268// ************************************************************************* //
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
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
Searching on finite plate. Plate has to be aligned with coordinate axes. Plate defined as origin and ...
virtual label size() const
Range of local indices that can be returned.
virtual void getVolumeType(const pointField &, List< volumeType > &) const
Determine type (inside/outside/mixed) for point. unknown if.
bool writeData(Ostream &) const
Pure virtual writeData function.
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit > > &) const
Get all intersections in order from start to end.
virtual bool overlaps(const boundBox &bb) const
Does any part of the surface overlap the supplied bound box?
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.
const point & centre() const noexcept
The centre (origin) of the plate.
virtual volumeType outsideVolumeType() const
What is type of points outside bounds.
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
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.
TypeName("searchablePlate")
Runtime type information.
virtual tmp< pointField > coordinates() const
Get representative set of element coordinates.
virtual ~searchablePlate()=default
Destructor.
virtual bool hasVolumeType() const
Whether supports volume type below.
virtual tmp< pointField > points() const
Get the points that define the surface.
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
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
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
vector point
Point is a vector.
Definition: point.H:43
uint8_t direction
Definition: direction.H:56
const direction noexcept
Definition: Scalar.H:223
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73