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 | 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 Note
46  Longer type name : \c searchableExtrudedCircle
47 
48 SourceFiles
49  searchableExtrudedCircle.C
50 
51 \*---------------------------------------------------------------------------*/
52 
53 #ifndef searchableExtrudedCircle_H
54 #define searchableExtrudedCircle_H
55 
56 #include "treeBoundBox.H"
57 #include "searchableSurface.H"
58 
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 
61 namespace Foam
62 {
63 
64 // Forward declarations
65 class edgeMesh;
66 class treeDataEdge;
67 template<class Type> class indexedOctree;
68 
69 /*---------------------------------------------------------------------------*\
70  Class searchableExtrudedCircle Declaration
71 \*---------------------------------------------------------------------------*/
72 
73 class searchableExtrudedCircle
74 :
75  public searchableSurface
76 {
77  // Private Member Data
78 
79  //- Feature
80  autoPtr<edgeMesh> eMeshPtr_;
81 
82  //- Search structure
83  autoPtr<indexedOctree<treeDataEdge>> edgeTree_;
84 
85  //- Radius
86  const scalar radius_;
87 
88  //- Names of regions
89  mutable wordList regions_;
90 
91 
92  // Private Member Functions
93 
94  //- No copy construct
96 
97  //- No copy assignment
98  void operator=(const searchableExtrudedCircle&) = delete;
99 
100 
101 public:
102 
103  //- Runtime type information
104  TypeName("searchableExtrudedCircle");
105 
106 
107  // Constructors
108 
109  //- Construct from dictionary (used by searchableSurface)
111  (
112  const IOobject& io,
113  const dictionary& dict
114  );
115 
116 
117  //- Destructor
118  virtual ~searchableExtrudedCircle();
119 
120 
121  // Member Functions
122 
123  //- Names of regions
124  virtual const wordList& regions() const;
125 
126  //- Whether supports volume type below
127  virtual bool hasVolumeType() const
128  {
129  return true;
130  }
131 
132  //- What is type of points outside bounds
133  virtual volumeType outsideVolumeType() const
134  {
135  return volumeType::OUTSIDE;
136  }
137 
138  //- Range of local indices that can be returned.
139  virtual label size() const;
140 
141  //- Get representative set of element coordinates
142  // Usually the element centres (should be of length size()).
143  virtual tmp<pointField> coordinates() const;
144 
145  //- Get bounding spheres (centre and radius squared), one per element.
146  // Any point on element is guaranteed to be inside.
147  virtual void boundingSpheres
148  (
149  pointField& centres,
150  scalarField& radiusSqr
151  ) const;
152 
153  //- Get the points that define the surface.
154  virtual tmp<pointField> points() const
155  {
156  return coordinates();
157  }
158 
159  //- Does any part of the surface overlap the supplied bound box?
160  virtual bool overlaps(const boundBox& bb) const
161  {
163  return false;
164  }
165 
166 
167  // Multiple point queries.
168 
169  virtual void findNearest
170  (
171  const pointField& sample,
172  const scalarField& nearestDistSqr,
174  ) const;
175 
176  //- Unique to parametric geometry: given points find
177  // an interpolated (along the curve) point on the surface.
178  // The lambdas[0] is equivalent for start, lambdas.last()
179  // is equivalent for end.
180  virtual void findParametricNearest
181  (
182  const point& start,
183  const point& end,
184  const scalarField& lambdas,
185  const scalarField& nearestDistSqr,
187  ) const;
188 
189  virtual void findLine
190  (
191  const pointField& start,
192  const pointField& end,
194  ) const
195  {
197  }
198 
199  virtual void findLineAny
200  (
201  const pointField& start,
202  const pointField& end,
204  ) const
205  {
207  }
208 
209  //- Get all intersections in order from start to end.
210  virtual void findLineAll
211  (
212  const pointField& start,
213  const pointField& end,
215  ) const
216  {
218  }
219 
220  //- From a set of points and indices get the region
221  virtual void getRegion
222  (
223  const List<pointIndexHit>&,
224  labelList& region
225  ) const;
226 
227  //- From a set of points and indices get the normal
228  virtual void getNormal
229  (
231  vectorField& normal
232  ) const;
233 
234  //- Determine type (inside/outside/mixed) for point.
235  // Unknown if cannot be determined (e.g. non-manifold surface)
236  virtual void getVolumeType
237  (
238  const pointField&,
240  ) const
241  {
243  }
244 
245  bool writeData(Ostream&) const
246  {
248  return false;
249  }
250 };
251 
252 
253 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
254 
255 } // End namespace Foam
256 
257 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
258 
259 #endif
260 
261 // ************************************************************************* //
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:169
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:264
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:61
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:92
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:230
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:62
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
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:209
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:179
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:173
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:123
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:256
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:146
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:219
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:152
sample
Minimal example by using system/controlDict.functions: