All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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-2019 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  Searching on (infinite) plane. See plane.H
29 
30 SourceFiles
31  searchablePlane.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef searchablePlane_H
36 #define searchablePlane_H
37 
38 #include "searchableSurface.H"
39 #include "plane.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 // Forward declaration of classes
47 
48 /*---------------------------------------------------------------------------*\
49  Class searchablePlane Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 class searchablePlane
53 :
54  public searchableSurface,
55  public plane
56 {
57  // Private Member Data
58 
59  mutable wordList regions_;
60 
61 
62  // Private Member Functions
63 
64  pointIndexHit findLine
65  (
66  const point& start,
67  const point& end
68  ) const;
69 
70  //- Return the boundBox of the plane
71  boundBox calcBounds() const;
72 
73 
74 public:
75 
76  //- Runtime type information
77  TypeName("searchablePlane");
78 
79 
80  // Constructors
81 
82  //- Construct from components
84  (
85  const IOobject& io,
86  const point& basePoint,
87  const vector& normal
88  );
89 
90  //- Construct from dictionary (used by searchableSurface)
92  (
93  const IOobject& io,
94  const dictionary& dict
95  );
96 
97  //- Disallow default bitwise copy construction
98  searchablePlane(const searchablePlane&) = delete;
99 
100 
101  //- Destructor
102  virtual ~searchablePlane();
103 
104 
105  // Member Functions
106 
107  virtual const wordList& regions() const;
108 
109  //- Whether supports volume type below
110  virtual bool hasVolumeType() const
111  {
112  return false;
113  }
114 
115  //- Range of local indices that can be returned.
116  virtual label size() const
117  {
118  return 1;
119  }
120 
121  //- Get representative set of element coordinates
122  // Usually the element centres (should be of length size()).
123  virtual tmp<pointField> coordinates() const
124  {
125  tmp<pointField> tCtrs(new pointField(1, refPoint()));
126  return tCtrs;
127  }
128 
129  //- Get bounding spheres (centre and radius squared), one per element.
130  // Any point on element is guaranteed to be inside.
131  // Note: radius limited to sqr(great)
132  virtual void boundingSpheres
133  (
134  pointField& centres,
135  scalarField& radiusSqr
136  ) const;
137 
138  //- Get the points that define the surface.
139  virtual tmp<pointField> points() const
140  {
141  return coordinates();
142  }
143 
144  //- Does any part of the surface overlap the supplied bound box?
145  virtual bool overlaps(const boundBox& bb) const
146  {
148 
149  return false;
150  }
151 
152 
153  // Multiple point queries.
154 
155  virtual void findNearest
156  (
157  const pointField& sample,
158  const scalarField& nearestDistSqr,
160  ) const;
161 
162  virtual void findLine
163  (
164  const pointField& start,
165  const pointField& end,
167  ) const;
168 
169  virtual void findLineAny
170  (
171  const pointField& start,
172  const pointField& end,
174  ) const;
175 
176  //- Get all intersections in order from start to end.
177  virtual void findLineAll
178  (
179  const pointField& start,
180  const pointField& end,
182  ) const;
183 
184  //- From a set of points and indices get the region
185  virtual void getRegion
186  (
187  const List<pointIndexHit>&,
188  labelList& region
189  ) const;
190 
191  //- From a set of points and indices get the normal
192  virtual void getNormal
193  (
194  const List<pointIndexHit>&,
195  vectorField& normal
196  ) const;
197 
198  //- Determine type (inside/outside/mixed) for point. unknown if
199  // cannot be determined (e.g. non-manifold surface)
200  virtual void getVolumeType
201  (
202  const pointField&,
204  ) const;
205 
206 
207  // regIOobject implementation
209  bool writeData(Ostream&) const
210  {
212  return false;
213  }
214 
215 
216  // Member Operators
217 
218  //- Disallow default bitwise assignment
219  void operator=(const searchablePlane&) = delete;
220 };
221 
222 
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 
225 } // End namespace Foam
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 #endif
230 
231 // ************************************************************************* //
dictionary dict
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
virtual void getRegion(const List< pointIndexHit > &, labelList &region) const
From a set of points and indices get the region.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
virtual void boundingSpheres(pointField &centres, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared), one per element.
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit >> &) const
Get all intersections in order from start to end.
virtual tmp< pointField > coordinates() const
Get representative set of element coordinates.
virtual bool overlaps(const boundBox &bb) const
Does any part of the surface overlap the supplied bound box?
A bounding box defined in terms of the points at its extremities.
Definition: boundBox.H:58
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
Definition: PointIndexHit.H:53
Base class of (analytical or triangulated) surface. Encapsulates all the search routines. WIP.
void operator=(const searchablePlane &)=delete
Disallow default bitwise assignment.
Geometric class that creates a 2D plane and can return the intersection point between a line and the ...
Definition: plane.H:60
searchablePlane(const IOobject &io, const point &basePoint, const vector &normal)
Construct from components.
Searching on (infinite) plane. See plane.H.
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:42
const point & refPoint() const
Return or return plane base point.
Definition: plane.C:239
virtual ~searchablePlane()
Destructor.
virtual label size() const
Range of local indices that can be returned.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual const wordList & regions() const
Names of regions.
virtual bool hasVolumeType() const
Whether supports volume type below.
TypeName("searchablePlane")
Runtime type information.
const vector & normal() const
Return plane normal.
Definition: plane.C:233
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Return any intersection on segment from start to end.
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
A class for managing temporary objects.
Definition: PtrList.H:53
virtual void findNearest(const pointField &sample, const scalarField &nearestDistSqr, List< pointIndexHit > &) const
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:366
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
virtual tmp< pointField > points() const
Get the points that define the surface.
virtual void getVolumeType(const pointField &, List< volumeType > &) const
Determine type (inside/outside/mixed) for point. unknown if.
Namespace for OpenFOAM.
bool writeData(Ostream &) const
Pure virtual writaData function.