plane_searchableSurface.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-2026 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::searchableSurfaces::plane
26 
27 Description
28  Surface geometry of an infinite plane, which can be used with
29  snappyHexMesh.
30 
31  The searchable plane is considered to be a closed surface, as if it were
32  actually a locally flat part of an infinitely large sphere. Points behind
33  the plane (relative to the normal) are therefore taken to be inside.
34 
35 Usage
36  \table
37  Property | Description | Required
38  planeType | Method of specification. E.g., pointAndNormal. | no
39  point | A point in the plane (for pointAndNormal) | yes
40  normal | A vector normal to the plane (for pointAndNormal) | yes
41  \endtable
42 
43  Note: there are also other options for planeType, including
44  'planeEquation' and 'embeddedPoints'.
45 
46  Example specification in snappyHexMeshDict/geometry:
47  \verbatim
48  type plane;
49  point (10 10 10);
50  normal (0 1 0);
51  \endverbatim
52 
53 See also
54  Foam::plane
55 
56 SourceFiles
57  searchablePlane.C
58 
59 \*---------------------------------------------------------------------------*/
60 
61 #ifndef plane_searchableSurface_H
62 #define plane_searchableSurface_H
63 
64 #include "searchableSurface.H"
65 #include "plane.H"
66 
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68 
69 namespace Foam
70 {
71 namespace searchableSurfaces
72 {
73 
74 /*---------------------------------------------------------------------------*\
75  Class plane Declaration
76 \*---------------------------------------------------------------------------*/
77 
78 class plane
79 :
80  public searchableSurface,
81  public Foam::plane
82 {
83  // Private Data
84 
85  mutable wordList regions_;
86 
87 
88  // Private Member Functions
89 
90  pointIndexHit findLine
91  (
92  const point& start,
93  const point& end
94  ) const;
95 
96  //- Return the boundBox of the plane
97  boundBox calcBounds() const;
98 
99 
100 public:
101 
102  //- Runtime type information
103  TypeName("plane");
104 
105 
106  // Constructors
107 
108  //- Construct from components
109  plane
110  (
111  const IOobject& io,
112  const point& basePoint,
113  const vector& normal
114  );
115 
116  //- Construct from dictionary (used by searchableSurface)
117  plane
118  (
119  const IOobject& io,
120  const dictionary& dict
121  );
122 
123  //- Disallow default bitwise copy construction
124  plane(const plane&) = delete;
125 
126 
127  //- Destructor
128  virtual ~plane();
129 
130 
131  // Member Functions
132 
133  virtual const wordList& regions() const;
134 
135  //- Whether supports volume type below
136  virtual bool hasVolumeType() const
137  {
138  return false;
139  }
140 
141  //- Range of local indices that can be returned.
142  virtual label size() const
143  {
144  return 1;
145  }
146 
147  //- Get representative set of element coordinates
148  // Usually the element centres (should be of length size()).
149  virtual tmp<pointField> coordinates() const
150  {
152  return tCtrs;
153  }
154 
155  //- Get bounding spheres (centre and radius squared), one per element.
156  // Any point on element is guaranteed to be inside.
157  // Note: radius limited to sqr(great)
158  virtual void boundingSpheres
159  (
160  pointField& centres,
161  scalarField& radiusSqr
162  ) const;
163 
164  //- Get the points that define the surface.
165  virtual tmp<pointField> points() const
166  {
167  return coordinates();
168  }
169 
170  //- Does any part of the surface overlap the supplied bound box?
171  virtual bool overlaps(const boundBox& bb) const
172  {
174 
175  return false;
176  }
177 
178 
179  // Multiple point queries.
180 
181  virtual void findNearest
182  (
183  const pointField& sample,
184  const scalarField& nearestDistSqr,
186  ) const;
187 
188  virtual void findLine
189  (
190  const pointField& start,
191  const pointField& end,
193  ) const;
194 
195  virtual void findLineAny
196  (
197  const pointField& start,
198  const pointField& end,
200  ) const;
201 
202  //- Get all intersections in order from start to end.
203  virtual void findLineAll
204  (
205  const pointField& start,
206  const pointField& end,
208  ) const;
209 
210  //- From a set of points and indices get the region
211  virtual void getRegion
212  (
213  const List<pointIndexHit>&,
215  ) const;
216 
217  //- From a set of points and indices get the normal
218  virtual void getNormal
219  (
220  const List<pointIndexHit>&,
222  ) const;
223 
224  //- Determine type (inside/outside/mixed) for point. unknown if
225  // cannot be determined (e.g. non-manifold surface)
226  virtual void getVolumeType
227  (
228  const pointField&,
230  ) const;
231 
232 
233  // regIOobject implementation
234 
235  bool writeData(Ostream&) const
236  {
238  return false;
239  }
240 
241 
242  // Member Operators
243 
244  //- Disallow default bitwise assignment
245  void operator=(const plane&) = delete;
246 };
247 
248 
249 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
250 
251 } // End of namespace searchableSurfaces
252 } // End namespace Foam
253 
254 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
255 
256 #endif
257 
258 // ************************************************************************* //
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:60
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Geometric class that creates a 2D plane and can return the intersection point between a line and the ...
Definition: plane.H:62
const point & refPoint() const
Return the plane base point.
Definition: plane.H:189
const vector & normal() const
Return the plane normal.
Definition: plane.H:183
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.
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.
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 tmp< pointField > coordinates() const
Get representative set of element coordinates.
void operator=(const plane &)=delete
Disallow default bitwise assignment.
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit >> &) const
Get all intersections in order from start to end.
plane(const IOobject &io, const point &basePoint, const vector &normal)
Construct from components.
virtual bool hasVolumeType() const
Whether supports volume type below.
TypeName("plane")
Runtime type information.
A class for managing temporary objects.
Definition: tmp.H:55
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:381
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
const fvMesh & region(const dictionary &dict)
Cast the give dictionary to the corresponding region fvMesh.
Definition: fvMesh.C:1831
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:42
dictionary dict