searchableExtrudedCircle.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) 2016-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::searchableExtrudedCircle
28 
29 Description
30  Searching on edgeMesh with constant radius
31 
32  \heading Dictionary parameters
33  \table
34  Property | Description | Required | Default
35  type | extrudedCircle / searchableExtrudedCircle | selector |
36  file | The name of the edge mesh | yes |
37  radius | Search radius around the edges | yes |
38  \endtable
39 
40 Note
41  - The edge mesh file is to be located in the constant/geometry directory.
42  - Can not be used with snappyHexMesh since only implements nearest
43  searching.
44 
45 SourceFiles
46  searchableExtrudedCircle.C
47 
48 \*---------------------------------------------------------------------------*/
49 
50 #ifndef searchableExtrudedCircle_H
51 #define searchableExtrudedCircle_H
52 
53 #include "treeBoundBox.H"
54 #include "searchableSurface.H"
55 
56 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 
58 namespace Foam
59 {
60 
61 // Forward declarations
62 class edgeMesh;
63 class treeDataEdge;
64 template<class Type> class indexedOctree;
65 
66 /*---------------------------------------------------------------------------*\
67  Class searchableExtrudedCircle Declaration
68 \*---------------------------------------------------------------------------*/
69 
70 class searchableExtrudedCircle
71 :
72  public searchableSurface
73 {
74  // Private Member Data
75 
76  //- Feature
77  autoPtr<edgeMesh> eMeshPtr_;
78 
79  //- Search structure
80  autoPtr<indexedOctree<treeDataEdge>> edgeTree_;
81 
82  //- Radius
83  const scalar radius_;
84 
85  //- Names of regions
86  mutable wordList regions_;
87 
88 
89  // Private Member Functions
90 
91  //- No copy construct
93 
94  //- No copy assignment
95  void operator=(const searchableExtrudedCircle&) = delete;
96 
97 
98 public:
99 
100  //- Runtime type information
101  TypeName("searchableExtrudedCircle");
102 
103 
104  // Constructors
105 
106  //- Construct from dictionary (used by searchableSurface)
108  (
109  const IOobject& io,
110  const dictionary& dict
111  );
112 
113 
114  //- Destructor
115  virtual ~searchableExtrudedCircle();
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 true;
127  }
128 
129  //- What is type of points outside bounds
130  virtual volumeType outsideVolumeType() const
131  {
132  return volumeType::OUTSIDE;
133  }
134 
135  //- Range of local indices that can be returned.
136  virtual label size() const;
137 
138  //- Get representative set of element coordinates
139  // Usually the element centres (should be of length size()).
140  virtual tmp<pointField> coordinates() const;
141 
142  //- Get bounding spheres (centre and radius squared), one per element.
143  // Any point on element is guaranteed to be inside.
144  virtual void boundingSpheres
145  (
146  pointField& centres,
147  scalarField& radiusSqr
148  ) const;
149 
150  //- Get the points that define the surface.
151  virtual tmp<pointField> points() const
152  {
153  return coordinates();
154  }
155 
156  //- Does any part of the surface overlap the supplied bound box?
157  virtual bool overlaps(const boundBox& bb) const
158  {
160  return false;
161  }
162 
163 
164  // Multiple point queries.
165 
166  virtual void findNearest
167  (
168  const pointField& sample,
169  const scalarField& nearestDistSqr,
171  ) const;
172 
173  //- Unique to parametric geometry: given points find
174  // an interpolated (along the curve) point on the surface.
175  // The lambdas[0] is equivalent for start, lambdas.last()
176  // is equivalent for end.
177  virtual void findParametricNearest
178  (
179  const point& start,
180  const point& end,
181  const scalarField& lambdas,
182  const scalarField& nearestDistSqr,
184  ) const;
185 
186  virtual void findLine
187  (
188  const pointField& start,
189  const pointField& end,
191  ) const
192  {
194  }
195 
196  virtual void findLineAny
197  (
198  const pointField& start,
199  const pointField& end,
201  ) const
202  {
204  }
205 
206  //- Get all intersections in order from start to end.
207  virtual void findLineAll
208  (
209  const pointField& start,
210  const pointField& end,
212  ) const
213  {
215  }
216 
217  //- From a set of points and indices get the region
218  virtual void getRegion
219  (
220  const List<pointIndexHit>&,
221  labelList& region
222  ) const;
223 
224  //- From a set of points and indices get the normal
225  virtual void getNormal
226  (
228  vectorField& normal
229  ) const;
230 
231  //- Determine type (inside/outside/mixed) for point.
232  // Unknown if cannot be determined (e.g. non-manifold surface)
233  virtual void getVolumeType
234  (
235  const pointField&,
237  ) const
238  {
240  }
241 
242  bool writeData(Ostream&) const
243  {
245  return false;
246  }
247 };
248 
249 
250 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
251 
252 } // End namespace Foam
253 
254 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
255 
256 #endif
257 
258 // ************************************************************************* //
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::searchableExtrudedCircle::coordinates
virtual tmp< pointField > coordinates() const
Get representative set of element coordinates.
Definition: searchableExtrudedCircle.C:151
Foam::searchableExtrudedCircle::writeData
bool writeData(Ostream &) const
Pure virtual writeData function.
Definition: searchableExtrudedCircle.H:261
Foam::searchableExtrudedCircle::findParametricNearest
virtual void findParametricNearest(const point &start, const point &end, const scalarField &lambdas, const scalarField &nearestDistSqr, List< pointIndexHit > &) const
Unique to parametric geometry: given points find.
Definition: searchableExtrudedCircle.C:219
Foam::searchableExtrudedCircle::findNearest
virtual void findNearest(const pointField &sample, const scalarField &nearestDistSqr, List< pointIndexHit > &) const
Definition: searchableExtrudedCircle.C:172
searchableSurface.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:59
Foam::searchableExtrudedCircle::getNormal
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
Definition: searchableExtrudedCircle.C:436
Foam::searchableExtrudedCircle
Searching on edgeMesh with constant radius.
Definition: searchableExtrudedCircle.H:89
Foam::searchableExtrudedCircle::findLineAll
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit >> &) const
Get all intersections in order from start to end.
Definition: searchableExtrudedCircle.H:227
Foam::searchableExtrudedCircle::TypeName
TypeName("searchableExtrudedCircle")
Runtime type information.
Foam::searchableExtrudedCircle::regions
virtual const wordList & regions() const
Names of regions.
Definition: searchableExtrudedCircle.C:134
Foam::searchableExtrudedCircle::~searchableExtrudedCircle
virtual ~searchableExtrudedCircle()
Destructor.
Definition: searchableExtrudedCircle.C:128
Foam::wordList
List< word > wordList
A List of words.
Definition: fileName.H:59
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:436
Foam::volumeType
An enumeration wrapper for classification of a location as being inside/outside of a volume.
Definition: volumeType.H:60
Foam::Field< vector >
treeBoundBox.H
Foam::searchableExtrudedCircle::findLine
virtual void findLine(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Find first intersection on segment from start to end.
Definition: searchableExtrudedCircle.H:206
Foam::searchableSurface
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
Definition: searchableSurface.H:69
Foam::searchableExtrudedCircle::overlaps
virtual bool overlaps(const boundBox &bb) const
Does any part of the surface overlap the supplied bound box?
Definition: searchableExtrudedCircle.H:176
Foam::searchableExtrudedCircle::getRegion
virtual void getRegion(const List< pointIndexHit > &, labelList &region) const
From a set of points and indices get the region.
Definition: searchableExtrudedCircle.C:425
Foam::searchableExtrudedCircle::points
virtual tmp< pointField > points() const
Get the points that define the surface.
Definition: searchableExtrudedCircle.H:170
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:121
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::searchableExtrudedCircle::getVolumeType
virtual void getVolumeType(const pointField &, List< volumeType > &) const
Determine type (inside/outside/mixed) for point.
Definition: searchableExtrudedCircle.H:253
Foam::searchableExtrudedCircle::boundingSpheres
virtual void boundingSpheres(pointField &centres, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared), one per element.
Definition: searchableExtrudedCircle.C:158
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::Vector< scalar >
Foam::List< word >
Foam::searchableExtrudedCircle::hasVolumeType
virtual bool hasVolumeType() const
Whether supports volume type below.
Definition: searchableExtrudedCircle.H:143
Foam::boundBox
A bounding box defined in terms of min/max extrema points.
Definition: boundBox.H:63
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::searchableExtrudedCircle::findLineAny
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Return any intersection on segment from start to end.
Definition: searchableExtrudedCircle.H:216
Foam::searchableExtrudedCircle::size
virtual label size() const
Range of local indices that can be returned.
Definition: searchableExtrudedCircle.C:145
Foam::volumeType::OUTSIDE
A location outside the volume.
Definition: volumeType.H:69
Foam::searchableExtrudedCircle::outsideVolumeType
virtual volumeType outsideVolumeType() const
What is type of points outside bounds.
Definition: searchableExtrudedCircle.H:149