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-2015 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 
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>&,
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
212 
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 // ************************************************************************* //
Foam::pointField
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:42
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:48
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Foam::searchablePlane::getVolumeType
virtual void getVolumeType(const pointField &, List< volumeType > &) const
Determine type (inside/outside/mixed) for point. unknown if.
Definition: searchablePlane.C:254
Foam::searchablePlane::overlaps
virtual bool overlaps(const boundBox &bb) const
Does any part of the surface overlap the supplied bound box?
Definition: searchablePlane.H:148
searchableSurface.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
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:206
Foam::searchablePlane::calcBounds
boundBox calcBounds() const
Return the boundBox of the plane.
Definition: searchablePlane.C:69
Foam::searchablePlane::size
virtual label size() const
Range of local indices that can be returned.
Definition: searchablePlane.H:119
Foam::searchablePlane::boundingSpheres
virtual void boundingSpheres(pointField &centres, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared), one per element.
Definition: searchablePlane.C:138
Foam::plane
Geometric class that creates a 2D plane and can return the intersection point between a line and the ...
Definition: plane.H:60
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:365
Foam::searchablePlane::searchablePlane
searchablePlane(const searchablePlane &)
Disallow default bitwise copy construct.
Foam::PointIndexHit
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
Definition: PointIndexHit.H:53
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:59
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
plane.H
Foam::searchablePlane::regions_
wordList regions_
Definition: searchablePlane.H:60
Foam::searchableSurface
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
Definition: searchableSurface.H:66
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::searchablePlane::findNearest
virtual void findNearest(const pointField &sample, const scalarField &nearestDistSqr, List< pointIndexHit > &) const
Definition: searchablePlane.C:152
Foam::searchablePlane::points
virtual tmp< pointField > points() const
Get the points that define the surface.
Definition: searchablePlane.H:142
Foam::searchablePlane::writeData
bool writeData(Ostream &) const
Pure virtual writaData function.
Definition: searchablePlane.H:212
Foam::searchablePlane::findLine
pointIndexHit findLine(const point &start, const point &end) const
Definition: searchablePlane.C:44
Foam::Vector< scalar >
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::searchablePlane::regions
virtual const wordList & regions() const
Names of regions.
Definition: searchablePlane.C:126
Foam::plane::refPoint
const point & refPoint() const
Return or return plane base point.
Definition: plane.C:255
Foam::searchablePlane::~searchablePlane
virtual ~searchablePlane()
Destructor.
Definition: searchablePlane.C:120
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:232
Foam::boundBox
A bounding box defined in terms of the points at its extremities.
Definition: boundBox.H:55
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:53
Foam::searchablePlane::hasVolumeType
virtual bool hasVolumeType() const
Whether supports volume type below.
Definition: searchablePlane.H:113
Foam::searchablePlane
Searching on (infinite) plane. See plane.H.
Definition: searchablePlane.H:51
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:195
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:243
Foam::searchablePlane::operator=
void operator=(const searchablePlane &)
Disallow default bitwise assignment.
normal
A normal distribution model.
Foam::searchablePlane::coordinates
virtual tmp< pointField > coordinates() const
Get representative set of element coordinates.
Definition: searchablePlane.H:126