searchablePlane.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
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::searchablePlane
26 
27 Description
28  Surface geometry of an infinite plane, which can be used with
29  snappyHexMesh.
30 
31 Usage
32  \table
33  Property | Description | Required
34  planeType | Plane type, e.g. pointAndNormal | yes
35  point | Point location for pointAndNormal plane | yes
36  normal | Normal vector for pointAndNormal plane | yes
37  \endtable
38 
39  Note: there are also other options for planeType, including
40  'planeEquation' and 'embeddedPoints'.
41 
42  Example specification in snappyHexMeshDict/geometry:
43  \verbatim
44  type searchablePlane;
45  planeType pointAndNormal;
46  point (10 10 10);
47  normal (0 1 0);
48  \endverbatim
49 
50 SourceFiles
51  searchablePlane.C
52 
53 \*---------------------------------------------------------------------------*/
54 
55 #ifndef searchablePlane_H
56 #define searchablePlane_H
57 
58 #include "searchableSurface.H"
59 #include "plane.H"
60 
61 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
62 
63 namespace Foam
64 {
65 
66 // Forward declaration of classes
67 
68 /*---------------------------------------------------------------------------*\
69  Class searchablePlane Declaration
70 \*---------------------------------------------------------------------------*/
71 
72 class searchablePlane
73 :
74  public searchableSurface,
75  public plane
76 {
77  // Private Member Data
78 
79  mutable wordList regions_;
80 
81 
82  // Private Member Functions
83 
84  pointIndexHit findLine
85  (
86  const point& start,
87  const point& end
88  ) const;
89 
90  //- Return the boundBox of the plane
91  boundBox calcBounds() const;
92 
93 
94 public:
95 
96  //- Runtime type information
97  TypeName("searchablePlane");
98 
99 
100  // Constructors
101 
102  //- Construct from components
104  (
105  const IOobject& io,
106  const point& basePoint,
107  const vector& normal
108  );
109 
110  //- Construct from dictionary (used by searchableSurface)
112  (
113  const IOobject& io,
114  const dictionary& dict
115  );
116 
117  //- Disallow default bitwise copy construction
118  searchablePlane(const searchablePlane&) = delete;
119 
120 
121  //- Destructor
122  virtual ~searchablePlane();
123 
124 
125  // Member Functions
126 
127  virtual const wordList& regions() const;
128 
129  //- Whether supports volume type below
130  virtual bool hasVolumeType() const
131  {
132  return false;
133  }
134 
135  //- Range of local indices that can be returned.
136  virtual label size() const
137  {
138  return 1;
139  }
140 
141  //- Get representative set of element coordinates
142  // Usually the element centres (should be of length size()).
143  virtual tmp<pointField> coordinates() const
144  {
146  return tCtrs;
147  }
148 
149  //- Get bounding spheres (centre and radius squared), one per element.
150  // Any point on element is guaranteed to be inside.
151  // Note: radius limited to sqr(great)
152  virtual void boundingSpheres
153  (
154  pointField& centres,
155  scalarField& radiusSqr
156  ) const;
157 
158  //- Get the points that define the surface.
159  virtual tmp<pointField> points() const
160  {
161  return coordinates();
162  }
163 
164  //- Does any part of the surface overlap the supplied bound box?
165  virtual bool overlaps(const boundBox& bb) const
166  {
168 
169  return false;
170  }
171 
172 
173  // Multiple point queries.
174 
175  virtual void findNearest
176  (
177  const pointField& sample,
178  const scalarField& nearestDistSqr,
180  ) const;
181 
182  virtual void findLine
183  (
184  const pointField& start,
185  const pointField& end,
187  ) const;
188 
189  virtual void findLineAny
190  (
191  const pointField& start,
192  const pointField& end,
194  ) const;
195 
196  //- Get all intersections in order from start to end.
197  virtual void findLineAll
198  (
199  const pointField& start,
200  const pointField& end,
202  ) const;
203 
204  //- From a set of points and indices get the region
205  virtual void getRegion
206  (
207  const List<pointIndexHit>&,
208  labelList& region
209  ) const;
210 
211  //- From a set of points and indices get the normal
212  virtual void getNormal
213  (
214  const List<pointIndexHit>&,
216  ) const;
217 
218  //- Determine type (inside/outside/mixed) for point. unknown if
219  // cannot be determined (e.g. non-manifold surface)
220  virtual void getVolumeType
221  (
222  const pointField&,
224  ) const;
225 
226 
227  // regIOobject implementation
228 
229  bool writeData(Ostream&) const
230  {
232  return false;
233  }
234 
235 
236  // Member Operators
237 
238  //- Disallow default bitwise assignment
239  void operator=(const searchablePlane&) = delete;
240 };
241 
242 
243 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
244 
245 } // End namespace Foam
246 
247 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
248 
249 #endif
250 
251 // ************************************************************************* //
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A bounding box defined in terms of the points at its extremities.
Definition: boundBox.H:59
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
const point & refPoint() const
Return the plane base point.
Definition: plane.H:179
const vector & normal() const
Return the plane normal.
Definition: plane.H:173
Surface geometry of an infinite plane, which can be used with snappyHexMesh.
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. unknown if.
bool writeData(Ostream &) const
Pure virtual writaData function.
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 > points() const
Get the points that define the surface.
searchablePlane(const IOobject &io, const point &basePoint, const vector &normal)
Construct from components.
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
virtual ~searchablePlane()
Destructor.
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 tmp< pointField > coordinates() const
Get representative set of element coordinates.
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit >> &) const
Get all intersections in order from start to end.
virtual bool hasVolumeType() const
Whether supports volume type below.
void operator=(const searchablePlane &)=delete
Disallow default bitwise assignment.
A class for managing temporary objects.
Definition: tmp.H:55
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:353
Namespace for OpenFOAM.
List< word > wordList
A List of words.
Definition: fileName.H:54
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
PointIndexHit< point > pointIndexHit
Definition: pointIndexHit.H:42
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:42
vector point
Point is a vector.
Definition: point.H:41
dictionary dict