searchablePlane.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) 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::searchablePlane
29
30Description
31 Searching on (infinite) plane.
32 The dictionary specifications are identical to the Foam::plane
33 requirements.
34
35 \heading Dictionary parameters
36 \table
37 Property | Description | Required | Default
38 type | plane | selector |
39 \endtable
40
41Note
42 Longer type name : \c searchablePlane
43
44SourceFiles
45 searchablePlane.C
46
47\*---------------------------------------------------------------------------*/
48
49#ifndef searchablePlane_H
50#define searchablePlane_H
51
52#include "searchableSurface.H"
53#include "plane.H"
54
55// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56
57namespace Foam
58{
59
60/*---------------------------------------------------------------------------*\
61 Class searchablePlane Declaration
62\*---------------------------------------------------------------------------*/
63
64class searchablePlane
65:
66 public searchableSurface,
67 public plane
68{
69private:
70
71 // Private Member Data
72
73 //- Names of regions
74 mutable wordList regions_;
75
76
77 // Private Member Functions
78
79 pointIndexHit findLine
80 (
81 const point& start,
82 const point& end
83 ) const;
84
85 //- Return the boundBox of the plane
86 boundBox calcBounds() const;
87
88 //- No copy construct
89 searchablePlane(const searchablePlane&) = delete;
90
91 //- No copy assignment
92 void operator=(const searchablePlane&) = delete;
93
94
95public:
96
97 //- Runtime type information
98 TypeName("searchablePlane");
99
100
101 // Constructors
102
103 //- Construct from components
105 (
106 const IOobject& io,
107 const point& basePoint,
108 const vector& normal
109 );
110
111 //- Construct from dictionary (used by searchableSurface)
113 (
114 const IOobject& io,
115 const dictionary& dict
116 );
117
118
119 //- Destructor
120 virtual ~searchablePlane() = default;
121
122
123 // Member Functions
124
125 //- Names of regions
126 virtual const wordList& regions() const;
127
128 //- Whether supports volume type below
129 virtual bool hasVolumeType() const
130 {
131 return false;
132 }
133
134 //- What is type of points outside bounds
135 virtual volumeType outsideVolumeType() const
136 {
137 return volumeType::UNKNOWN;
139
140 //- Range of local indices that can be returned.
141 virtual label size() const
142 {
143 return 1;
145
146 //- Get representative set of element coordinates
147 // Usually the element centres (should be of length size()).
148 virtual tmp<pointField> coordinates() const
149 {
151 }
152
153 //- Get bounding spheres (centre and radius squared), one per element.
154 // Any point on element is guaranteed to be inside.
155 // Note: radius limited to sqr(GREAT)
156 virtual void boundingSpheres
158 pointField& centres,
159 scalarField& radiusSqr
160 ) const;
161
162 //- Get the points that define the surface.
163 virtual tmp<pointField> points() const
164 {
165 return coordinates();
166 }
167
168 //- Does any part of the surface overlap the supplied bound box?
169 virtual bool overlaps(const boundBox& bb) const
170 {
172 return false;
173 }
174
175
176 // Multiple point queries.
177
178 virtual void findNearest
179 (
180 const pointField& sample,
181 const scalarField& nearestDistSqr,
183 ) const;
184
185 virtual void findLine
186 (
187 const pointField& start,
188 const pointField& end,
190 ) const;
191
192 virtual void findLineAny
193 (
194 const pointField& start,
195 const pointField& end,
197 ) const;
198
199 //- Get all intersections in order from start to end.
200 virtual void findLineAll
201 (
202 const pointField& start,
203 const pointField& end,
205 ) const;
206
207 //- From a set of points and indices get the region
208 virtual void getRegion
209 (
210 const List<pointIndexHit>&,
211 labelList& region
212 ) const;
213
214 //- From a set of points and indices get the normal
215 virtual void getNormal
216 (
217 const List<pointIndexHit>&,
219 ) const;
220
221 //- Determine type (inside/outside/mixed) for point.
222 // Unknown if cannot be determined (e.g. non-manifold surface)
223 virtual void getVolumeType
224 (
225 const pointField&,
227 ) const;
228
229
230 // regIOobject implementation
231
232 bool writeData(Ostream&) const
233 {
235 return false;
236 }
237
238};
239
240
241// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242
243} // End namespace Foam
244
245// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246
247#endif
248
249// ************************************************************************* //
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
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
const vector & normal() const noexcept
The plane unit normal.
Definition: planeI.H:39
Searching on (infinite) plane. The dictionary specifications are identical to the Foam::plane require...
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?
virtual void getVolumeType(const pointField &, List< volumeType > &) const
Determine type (inside/outside/mixed) for point.
bool writeData(Ostream &) const
Pure virtual writeData function.
virtual ~searchablePlane()=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.
TypeName("searchablePlane")
Runtime type information.
virtual void boundingSpheres(pointField &centres, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared), one per element.
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 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.
virtual void findNearest(const pointField &sample, const scalarField &nearestDistSqr, List< pointIndexHit > &) const
virtual bool hasVolumeType() const
Whether supports volume type below.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
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.
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:44
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