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 | Copyright (C) 2011-2016 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:
58 
59  // Private Member Data
60 
61  mutable wordList regions_;
62 
63 
64  // Private Member Functions
65 
66  pointIndexHit findLine
67  (
68  const point& start,
69  const point& end
70  ) const;
71 
72  //- Return the boundBox of the plane
73  boundBox calcBounds() const;
74 
75  //- Disallow default bitwise copy construct
77 
78  //- Disallow default bitwise assignment
79  void operator=(const searchablePlane&);
80 
81 
82 public:
83 
84  //- Runtime type information
85  TypeName("searchablePlane");
86 
87 
88  // Constructors
89 
90  //- Construct from components
92  (
93  const IOobject& io,
94  const point& basePoint,
95  const vector& normal
96  );
97 
98  //- Construct from dictionary (used by searchableSurface)
100  (
101  const IOobject& io,
102  const dictionary& dict
103  );
104 
105  //- Destructor
106  virtual ~searchablePlane();
107 
108 
109  // Member Functions
110 
111  virtual const wordList& regions() const;
112 
113  //- Whether supports volume type below
114  virtual bool hasVolumeType() const
115  {
116  return false;
117  }
118 
119  //- Range of local indices that can be returned.
120  virtual label size() const
121  {
122  return 1;
123  }
124 
125  //- Get representative set of element coordinates
126  // Usually the element centres (should be of length size()).
127  virtual tmp<pointField> coordinates() const
128  {
129  tmp<pointField> tCtrs(new pointField(1, refPoint()));
130  return tCtrs;
131  }
132 
133  //- Get bounding spheres (centre and radius squared), one per element.
134  // Any point on element is guaranteed to be inside.
135  // Note: radius limited to sqr(GREAT)
136  virtual void boundingSpheres
137  (
138  pointField& centres,
139  scalarField& radiusSqr
140  ) const;
141 
142  //- Get the points that define the surface.
143  virtual tmp<pointField> points() const
144  {
145  return coordinates();
146  }
147 
148  //- Does any part of the surface overlap the supplied bound box?
149  virtual bool overlaps(const boundBox& bb) const
150  {
152 
153  return false;
154  }
155 
156 
157  // Multiple point queries.
158 
159  virtual void findNearest
160  (
161  const pointField& sample,
162  const scalarField& nearestDistSqr,
164  ) const;
165 
166  virtual void findLine
167  (
168  const pointField& start,
169  const pointField& end,
171  ) const;
172 
173  virtual void findLineAny
174  (
175  const pointField& start,
176  const pointField& end,
178  ) const;
179 
180  //- Get all intersections in order from start to end.
181  virtual void findLineAll
182  (
183  const pointField& start,
184  const pointField& end,
186  ) const;
187 
188  //- From a set of points and indices get the region
189  virtual void getRegion
190  (
191  const List<pointIndexHit>&,
192  labelList& region
193  ) const;
194 
195  //- From a set of points and indices get the normal
196  virtual void getNormal
197  (
198  const List<pointIndexHit>&,
199  vectorField& normal
200  ) const;
201 
202  //- Determine type (inside/outside/mixed) for point. unknown if
203  // cannot be determined (e.g. non-manifold surface)
204  virtual void getVolumeType
205  (
206  const pointField&,
208  ) const;
209 
210 
211  // regIOobject implementation
213  bool writeData(Ostream&) const
214  {
216  return false;
217  }
218 
219 };
220 
221 
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 
224 } // End namespace Foam
225 
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 
228 #endif
229 
230 // ************************************************************************* //
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
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
const point & refPoint() const
Return or return plane base point.
Definition: plane.C:246
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.
virtual void boundingSpheres(pointField &centres, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared), one per element.
Geometric class that creates a 2D plane and can return the intersection point between a line and the ...
Definition: plane.H:60
virtual void getRegion(const List< pointIndexHit > &, labelList &region) const
From a set of points and indices get the region.
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Return any intersection on segment from start to end.
Searching on (infinite) plane. See plane.H.
virtual label size() const
Range of local indices that can be returned.
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:42
virtual ~searchablePlane()
Destructor.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual void findNearest(const pointField &sample, const scalarField &nearestDistSqr, List< pointIndexHit > &) const
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit >> &) const
Get all intersections in order from start to end.
A normal distribution model.
virtual tmp< pointField > coordinates() const
Get representative set of element coordinates.
TypeName("searchablePlane")
Runtime type information.
virtual void getVolumeType(const pointField &, List< volumeType > &) const
Determine type (inside/outside/mixed) for point. unknown if.
virtual bool hasVolumeType() const
Whether supports volume type below.
virtual bool overlaps(const boundBox &bb) const
Does any part of the surface overlap the supplied bound box?
A class for managing temporary objects.
Definition: PtrList.H:54
#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:91
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
bool writeData(Ostream &) const
Pure virtual writaData function.
virtual tmp< pointField > points() const
Get the points that define the surface.
Namespace for OpenFOAM.
virtual const wordList & regions() const
Names of regions.