searchablePlate.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 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 Member Data
65 
66  const point origin_;
67 
68  const vector span_;
69 
70  //- Coordinate direction which is normal
71  const direction normalDir_;
72 
73  mutable wordList regions_;
74 
75 
76  // Private Member Functions
77 
78  //- Calculate normal direction from span
79  static direction calcNormal(const point&);
80 
81  //- Inherit findNearest from searchableSurface
83 
84  pointIndexHit findNearest
85  (
86  const point& sample,
87  const scalar nearestDistSqr
88  ) const;
89 
90  pointIndexHit findLine
91  (
92  const point& start,
93  const point& end
94  ) const;
95 
96  //- Disallow default bitwise copy construction
97  searchablePlate(const searchablePlate&) = delete;
98 
99  //- Disallow default bitwise assignment
100  void operator=(const searchablePlate&) = delete;
101 
102 
103 public:
104 
105  //- Runtime type information
106  TypeName("searchablePlate");
107 
108 
109  // Constructors
110 
111  //- Construct from components
113  (
114  const IOobject& io,
115  const point& origin,
116  const vector& span
117  );
118 
119  //- Construct from dictionary (used by searchableSurface)
121  (
122  const IOobject& io,
123  const dictionary& dict
124  );
125 
126 
127  //- Destructor
128  virtual ~searchablePlate();
129 
130 
131  // Member Functions
132 
133  virtual const wordList& regions() const;
134 
135  //- Whether supports volume type below
136  virtual bool hasVolumeType() const
137  {
138  return false;
139  }
140 
141  //- Range of local indices that can be returned.
142  virtual label size() const
143  {
144  return 1;
145  }
146 
147  //- Get representative set of element coordinates
148  // Usually the element centres (should be of length size()).
149  virtual tmp<pointField> coordinates() const;
150 
151  //- Get bounding spheres (centre and radius squared), one per element.
152  // Any point on element is guaranteed to be inside.
153  virtual void boundingSpheres
154  (
155  pointField& centres,
156  scalarField& radiusSqr
157  ) const;
158 
159  //- Get the points that define the surface.
160  virtual tmp<pointField> points() const;
161 
162  //- Does any part of the surface overlap the supplied bound box?
163  virtual bool overlaps(const boundBox& bb) const;
164 
165 
166  // Multiple point queries.
167 
168  virtual void findNearest
169  (
170  const pointField& sample,
171  const scalarField& nearestDistSqr,
173  ) const;
174 
175  virtual void findLine
176  (
177  const pointField& start,
178  const pointField& end,
180  ) const;
181 
182  virtual void findLineAny
183  (
184  const pointField& start,
185  const pointField& end,
187  ) const;
188 
189  //- Get all intersections in order from start to end.
190  virtual void findLineAll
191  (
192  const pointField& start,
193  const pointField& end,
195  ) const;
196 
197  //- From a set of points and indices get the region
198  virtual void getRegion
199  (
200  const List<pointIndexHit>&,
201  labelList& region
202  ) const;
203 
204  //- From a set of points and indices get the normal
205  virtual void getNormal
206  (
207  const List<pointIndexHit>&,
208  vectorField& normal
209  ) const;
210 
211  //- Determine type (inside/outside/mixed) for point. unknown if
212  // cannot be determined (e.g. non-manifold surface)
213  virtual void getVolumeType
214  (
215  const pointField&,
217  ) const;
218 
219 
220  // regIOobject implementation
222  bool writeData(Ostream&) const
223  {
225  return false;
226  }
227 };
228 
229 
230 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231 
232 } // End namespace Foam
233 
234 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235 
236 #endif
237 
238 // ************************************************************************* //
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:158
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.
Templated 3D Vector derived from VectorSpace adding construction from 3 components, element access using x(), y() and z() member functions and the inner-product (dot-product) and cross product operators.
Definition: Vector.H:57
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.
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.