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 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::searchablePlane
28 
29 Description
30  Searching on (infinite) plane.
31  The dictionary specifications are identical to the Foam::plane
32  requirements.
33 
34  \heading Dictionary parameters
35  \table
36  Property | Description | Required | Default
37  type | plane / searchablePlane | selector |
38  \endtable
39 
40 SourceFiles
41  searchablePlane.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef searchablePlane_H
46 #define searchablePlane_H
47 
48 #include "searchableSurface.H"
49 #include "plane.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 /*---------------------------------------------------------------------------*\
57  Class searchablePlane Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 class searchablePlane
61 :
62  public searchableSurface,
63  public plane
64 {
65 private:
66 
67  // Private Member Data
68 
69  //- Names of regions
70  mutable wordList regions_;
71 
72 
73  // Private Member Functions
74 
75  pointIndexHit findLine
76  (
77  const point& start,
78  const point& end
79  ) const;
80 
81  //- Return the boundBox of the plane
82  boundBox calcBounds() const;
83 
84  //- No copy construct
85  searchablePlane(const searchablePlane&) = delete;
86 
87  //- No copy assignment
88  void operator=(const searchablePlane&) = delete;
89 
90 
91 public:
92 
93  //- Runtime type information
94  TypeName("searchablePlane");
95 
96 
97  // Constructors
98 
99  //- Construct from components
101  (
102  const IOobject& io,
103  const point& basePoint,
104  const vector& normal
105  );
106 
107  //- Construct from dictionary (used by searchableSurface)
109  (
110  const IOobject& io,
111  const dictionary& dict
112  );
113 
114  //- Destructor
115  virtual ~searchablePlane() = default;
116 
117 
118  // Member Functions
119 
120  //- Names of regions
121  virtual const wordList& regions() const;
122 
123  //- Whether supports volume type below
124  virtual bool hasVolumeType() const
125  {
126  return false;
127  }
128 
129  //- What is type of points outside bounds
130  virtual volumeType outsideVolumeType() const
131  {
132  return volumeType::UNKNOWN;
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  }
147 
148  //- Get bounding spheres (centre and radius squared), one per element.
149  // Any point on element is guaranteed to be inside.
150  // Note: radius limited to sqr(GREAT)
151  virtual void boundingSpheres
152  (
153  pointField& centres,
154  scalarField& radiusSqr
155  ) const;
156 
157  //- Get the points that define the surface.
158  virtual tmp<pointField> points() const
159  {
160  return coordinates();
161  }
162 
163  //- Does any part of the surface overlap the supplied bound box?
164  virtual bool overlaps(const boundBox& bb) const
165  {
167  return false;
168  }
169 
170 
171  // Multiple point queries.
172 
173  virtual void findNearest
174  (
175  const pointField& sample,
176  const scalarField& nearestDistSqr,
178  ) const;
179 
180  virtual void findLine
181  (
182  const pointField& start,
183  const pointField& end,
185  ) const;
186 
187  virtual void findLineAny
188  (
189  const pointField& start,
190  const pointField& end,
192  ) const;
193 
194  //- Get all intersections in order from start to end.
195  virtual void findLineAll
196  (
197  const pointField& start,
198  const pointField& end,
200  ) const;
201 
202  //- From a set of points and indices get the region
203  virtual void getRegion
204  (
205  const List<pointIndexHit>&,
206  labelList& region
207  ) const;
208 
209  //- From a set of points and indices get the normal
210  virtual void getNormal
211  (
212  const List<pointIndexHit>&,
214  ) const;
215 
216  //- Determine type (inside/outside/mixed) for point.
217  // Unknown if cannot be determined (e.g. non-manifold surface)
218  virtual void getVolumeType
219  (
220  const pointField&,
222  ) const;
223 
224 
225  // regIOobject implementation
226 
227  bool writeData(Ostream&) const
228  {
230  return false;
231  }
232 
233 };
234 
235 
236 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237 
238 } // End namespace Foam
239 
240 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 
242 #endif
243 
244 // ************************************************************************* //
Foam::pointField
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:44
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:52
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:104
Foam::searchablePlane::~searchablePlane
virtual ~searchablePlane()=default
Destructor.
Foam::plane::normal
const vector & normal() const
The plane unit normal.
Definition: planeI.H:39
Foam::searchablePlane::getVolumeType
virtual void getVolumeType(const pointField &, List< volumeType > &) const
Determine type (inside/outside/mixed) for point.
Definition: searchablePlane.C:260
Foam::searchablePlane::overlaps
virtual bool overlaps(const boundBox &bb) const
Does any part of the surface overlap the supplied bound box?
Definition: searchablePlane.H:173
searchableSurface.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:59
Foam::searchablePlane::size
virtual label size() const
Range of local indices that can be returned.
Definition: searchablePlane.H:145
Foam::searchablePlane::boundingSpheres
virtual void boundingSpheres(pointField &centres, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared), one per element.
Definition: searchablePlane.C:144
Foam::plane
Geometric class that creates a 3D plane and can return the intersection point between a line and the ...
Definition: plane.H:89
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:419
Foam::PointIndexHit
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
Definition: PointIndexHit.H:55
Foam::searchablePlane::outsideVolumeType
virtual volumeType outsideVolumeType() const
What is type of points outside bounds.
Definition: searchablePlane.H:139
Foam::label
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:62
Foam::volumeType
An enumeration wrapper for classification of a location as being inside/outside of a volume.
Definition: volumeType.H:60
Foam::Field< vector >
plane.H
Foam::volumeType::UNKNOWN
Unknown state.
Definition: volumeType.H:67
Foam::searchableSurface
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
Definition: searchableSurface.H:69
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
stdFoam::end
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
Definition: stdFoam.H:115
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::searchablePlane::findNearest
virtual void findNearest(const pointField &sample, const scalarField &nearestDistSqr, List< pointIndexHit > &) const
Definition: searchablePlane.C:158
Foam::plane::origin
const point & origin() const
The plane base point.
Definition: planeI.H:45
Foam::searchablePlane::points
virtual tmp< pointField > points() const
Get the points that define the surface.
Definition: searchablePlane.H:167
Foam::searchablePlane::writeData
bool writeData(Ostream &) const
Pure virtual writeData function.
Definition: searchablePlane.H:236
Foam::Vector< scalar >
Foam::List< word >
Foam::searchablePlane::regions
virtual const wordList & regions() const
Names of regions.
Definition: searchablePlane.C:132
Foam::start
label ListType::const_reference const label start
Definition: ListOps.H:408
Foam::tmp::New
static tmp< T > New(Args &&... args)
Construct tmp of T with forwarding arguments.
Foam::searchablePlane::getRegion
virtual void getRegion(const List< pointIndexHit > &, labelList &region) const
From a set of points and indices get the region.
Definition: searchablePlane.C:238
Foam::boundBox
A bounding box defined in terms of min/max extrema points.
Definition: boundBox.H:63
Foam::searchablePlane::TypeName
TypeName("searchablePlane")
Runtime type information.
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::searchablePlane::hasVolumeType
virtual bool hasVolumeType() const
Whether supports volume type below.
Definition: searchablePlane.H:133
Foam::searchablePlane
Searching on (infinite) plane. The dictionary specifications are identical to the Foam::plane require...
Definition: searchablePlane.H:69
Foam::searchablePlane::findLineAny
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Return any intersection on segment from start to end.
Definition: searchablePlane.C:201
Foam::searchablePlane::getNormal
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
Definition: searchablePlane.C:249
Foam::searchablePlane::findLineAll
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit >> &) const
Get all intersections in order from start to end.
Definition: searchablePlane.C:212
Foam::searchablePlane::coordinates
virtual tmp< pointField > coordinates() const
Get representative set of element coordinates.
Definition: searchablePlane.H:152