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-2017 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 
86  pointIndexHit findNearest
87  (
88  const point& sample,
89  const scalar nearestDistSqr
90  ) const;
91 
92  pointIndexHit findLine
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
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 // ************************************************************************* //
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
TypeName("searchablePlate")
Runtime type information.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
uint8_t direction
Definition: direction.H:45
virtual void getRegion(const List< pointIndexHit > &, labelList &region) const
From a set of points and indices get the region.
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 findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit >> &) const
Get all intersections in order from start to end.
bool writeData(Ostream &) const
Pure virtual writaData function.
virtual bool overlaps(const boundBox &bb) const
Does any part of the surface overlap the supplied bound box?
virtual void findNearest(const pointField &sample, const scalarField &nearestDistSqr, List< pointIndexHit > &) const =0
virtual tmp< pointField > points() const
Get the points that define the surface.
virtual ~searchablePlate()
Destructor.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Return any intersection on segment from start to end.
virtual const wordList & regions() const
Names of regions.
A normal distribution model.
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
virtual void boundingSpheres(pointField &centres, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared), one per element.
virtual bool hasVolumeType() const
Whether supports volume type below.
Searching on finite plate. Plate has to be aligned with coordinate axes. Plate defined as origin and ...
virtual void getVolumeType(const pointField &, List< volumeType > &) const
Determine type (inside/outside/mixed) for point. unknown if.
virtual label size() const
Range of local indices that can be returned.
A class for managing temporary objects.
Definition: PtrList.H:53
#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 > coordinates() const
Get representative set of element coordinates.
Namespace for OpenFOAM.