searchablePlate.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::searchablePlate
26 
27 Description
28  Searching on finite plate. Plate has to be aligned with coordinate
29  axes.
30  Plate defined as origin and span. One of the components of span has
31  to be 0 which defines the normal direction. E.g.
32 
33  span = (Sx Sy 0) // plate in x-y plane
34  origin = (Ox Oy Oz)
35 
36  now plane is from (Ox Oy Oz) to (Ox+Sx Oy+Sy Oz)
37 
38 SourceFiles
39  searchablePlate.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef searchablePlate_H
44 #define searchablePlate_H
45 
46 #include "searchableSurface.H"
47 #include "treeBoundBox.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 // Forward declaration of classes
55 
56 /*---------------------------------------------------------------------------*\
57  Class searchablePlate Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 class searchablePlate
61 :
62  public searchableSurface
63 {
64 private:
65 
66  // Private Member Data
67 
68  const point origin_;
69 
70  const vector span_;
71 
72  //- Coordinate direction which is normal
73  const direction normalDir_;
74 
75  mutable wordList regions_;
76 
77 
78  // Private Member Functions
79 
80  //- Calculate normal direction from span
81  static direction calcNormal(const point&);
82 
83  //- Inherit findNearest from searchableSurface
85 
87  (
88  const point& sample,
89  const scalar nearestDistSqr
90  ) const;
91 
93  (
94  const point& start,
95  const point& end
96  ) const;
97 
98  //- Disallow default bitwise copy construct
100 
101  //- Disallow default bitwise assignment
102  void operator=(const searchablePlate&);
103 
104 
105 public:
106 
107  //- Runtime type information
108  TypeName("searchablePlate");
109 
110 
111  // Constructors
112 
113  //- Construct from components
115  (
116  const IOobject& io,
117  const point& origin,
118  const vector& span
119  );
120 
121  //- Construct from dictionary (used by searchableSurface)
123  (
124  const IOobject& io,
125  const dictionary& dict
126  );
127 
128 
129  //- Destructor
130  virtual ~searchablePlate();
131 
132 
133  // Member Functions
134 
135  virtual const wordList& regions() const;
136 
137  //- Whether supports volume type below
138  virtual bool hasVolumeType() const
139  {
140  return false;
141  }
142 
143  //- Range of local indices that can be returned.
144  virtual label size() const
145  {
146  return 1;
147  }
148 
149  //- Get representative set of element coordinates
150  // Usually the element centres (should be of length size()).
151  virtual tmp<pointField> coordinates() const;
152 
153  //- Get bounding spheres (centre and radius squared), one per element.
154  // Any point on element is guaranteed to be inside.
155  virtual void boundingSpheres
156  (
157  pointField& centres,
158  scalarField& radiusSqr
159  ) const;
160 
161  //- Get the points that define the surface.
162  virtual tmp<pointField> points() const;
163 
164  //- Does any part of the surface overlap the supplied bound box?
165  virtual bool overlaps(const boundBox& bb) const;
166 
167 
168  // Multiple point queries.
169 
170  virtual void findNearest
171  (
172  const pointField& sample,
173  const scalarField& nearestDistSqr,
175  ) const;
176 
177  virtual void findLine
178  (
179  const pointField& start,
180  const pointField& end,
182  ) const;
183 
184  virtual void findLineAny
185  (
186  const pointField& start,
187  const pointField& end,
189  ) const;
190 
191  //- Get all intersections in order from start to end.
192  virtual void findLineAll
193  (
194  const pointField& start,
195  const pointField& end,
197  ) const;
198 
199  //- From a set of points and indices get the region
200  virtual void getRegion
201  (
202  const List<pointIndexHit>&,
203  labelList& region
204  ) const;
205 
206  //- From a set of points and indices get the normal
207  virtual void getNormal
208  (
209  const List<pointIndexHit>&,
211  ) const;
212 
213  //- Determine type (inside/outside/mixed) for point. unknown if
214  // cannot be determined (e.g. non-manifold surface)
215  virtual void getVolumeType
216  (
217  const pointField&,
219  ) const;
220 
221 
222  // regIOobject implementation
223 
224  bool writeData(Ostream&) const
225  {
227  return false;
228  }
229 };
230 
231 
232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233 
234 } // End namespace Foam
235 
236 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237 
238 #endif
239 
240 // ************************************************************************* //
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
searchableSurface.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::searchablePlate::writeData
bool writeData(Ostream &) const
Pure virtual writaData function.
Definition: searchablePlate.H:223
Foam::searchablePlate::overlaps
virtual bool overlaps(const boundBox &bb) const
Does any part of the surface overlap the supplied bound box?
Definition: searchablePlate.C:328
Foam::searchablePlate
Searching on finite plate. Plate has to be aligned with coordinate axes. Plate defined as origin and ...
Definition: searchablePlate.H:59
Foam::searchablePlate::points
virtual tmp< pointField > points() const
Get the points that define the surface.
Definition: searchablePlate.C:300
Foam::searchablePlate::findLineAll
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit > > &) const
Get all intersections in order from start to end.
Definition: searchablePlate.C:386
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:365
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
Foam::searchablePlate::searchablePlate
searchablePlate(const searchablePlate &)
Disallow default bitwise copy construct.
treeBoundBox.H
Foam::searchableSurface
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
Definition: searchableSurface.H:66
Foam::searchablePlate::normalDir_
const direction normalDir_
Coordinate direction which is normal.
Definition: searchablePlate.H:72
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::searchablePlate::size
virtual label size() const
Range of local indices that can be returned.
Definition: searchablePlate.H:143
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::searchableSurface::findNearest
virtual void findNearest(const pointField &sample, const scalarField &nearestDistSqr, List< pointIndexHit > &) const =0
Foam::searchablePlate::origin_
const point origin_
Definition: searchablePlate.H:67
Foam::searchablePlate::regions_
wordList regions_
Definition: searchablePlate.H:74
Foam::searchablePlate::calcNormal
static direction calcNormal(const point &)
Calculate normal direction from span.
Definition: searchablePlate.C:43
Foam::searchablePlate::~searchablePlate
virtual ~searchablePlate()
Destructor.
Definition: searchablePlate.C:260
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::searchablePlate::coordinates
virtual tmp< pointField > coordinates() const
Get representative set of element coordinates.
Definition: searchablePlate.C:277
Foam::searchablePlate::findLineAny
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Return any intersection on segment from start to end.
Definition: searchablePlate.C:375
Foam::searchablePlate::findLine
pointIndexHit findLine(const point &start, const point &end) const
Definition: searchablePlate.C:129
Foam::searchablePlate::operator=
void operator=(const searchablePlate &)
Disallow default bitwise assignment.
Foam::direction
unsigned char direction
Definition: direction.H:43
Foam::boundBox
A bounding box defined in terms of the points at its extremities.
Definition: boundBox.H:55
Foam::searchablePlate::regions
virtual const wordList & regions() const
Names of regions.
Definition: searchablePlate.C:266
Foam::searchablePlate::span_
const vector span_
Definition: searchablePlate.H:69
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::searchablePlate::getNormal
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
Definition: searchablePlate.C:423
Foam::searchablePlate::boundingSpheres
virtual void boundingSpheres(pointField &centres, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared), one per element.
Definition: searchablePlate.C:284
Foam::searchablePlate::hasVolumeType
virtual bool hasVolumeType() const
Whether supports volume type below.
Definition: searchablePlate.H:137
Foam::searchablePlate::findNearest
pointIndexHit findNearest(const point &sample, const scalar nearestDistSqr) const
Definition: searchablePlate.C:83
Foam::searchablePlate::TypeName
TypeName("searchablePlate")
Runtime type information.
Foam::searchablePlate::getVolumeType
virtual void getVolumeType(const pointField &, List< volumeType > &) const
Determine type (inside/outside/mixed) for point. unknown if.
Definition: searchablePlate.C:438
Foam::searchablePlate::getRegion
virtual void getRegion(const List< pointIndexHit > &, labelList &region) const
From a set of points and indices get the region.
Definition: searchablePlate.C:412
normal
A normal distribution model.