searchableExtrudedCircle.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) 2016-2022 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::searchableExtrudedCircle
26 
27 Description
28  Surface geometry with a tube shape, which can be used with
29  snappyHexMesh. The geometry is formed from a line geometry, described
30  by the edgeMesh (.eMesh) file format, to which a radius is applied
31  to form a tube.
32 
33 Usage
34  \table
35  Property | Description | Required
36  file | File describing the line (.eMesh) | yes
37  radius | Tube radius | yes
38  \endtable
39 
40  Example specification in snappyHexMeshDict/geometry:
41  \verbatim
42  type searchableExtrudedCircle;
43  file "line.eMesh";
44  radius 5;
45  \endverbatim
46 
47 SourceFiles
48  searchableExtrudedCircle.C
49 
50 \*---------------------------------------------------------------------------*/
51 
52 #ifndef searchableExtrudedCircle_H
53 #define searchableExtrudedCircle_H
54 
55 #include "treeBoundBox.H"
56 #include "searchableSurface.H"
57 
58 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59 
60 namespace Foam
61 {
62 
63 // Forward declaration of classes
64 class edgeMesh;
65 class treeDataEdge;
66 template <class Type> class indexedOctree;
67 
68 /*---------------------------------------------------------------------------*\
69  Class searchableExtrudedCircle Declaration
70 \*---------------------------------------------------------------------------*/
71 
72 class searchableExtrudedCircle
73 :
74  public searchableSurface
75 {
76  // Private Member Data
77 
78  //- Feature
79  autoPtr<edgeMesh> eMeshPtr_;
80 
81  //- Search structure
82  autoPtr<indexedOctree<treeDataEdge>> edgeTree_;
83 
84  //- Radius
85  const scalar radius_;
86 
87  //- Names of regions
88  mutable wordList regions_;
89 
90 
91 public:
92 
93  //- Runtime type information
94  TypeName("searchableExtrudedCircle");
95 
96 
97  // Constructors
98 
99  //- Construct from dictionary (used by searchableSurface)
101  (
102  const IOobject& io,
103  const dictionary& dict
104  );
105 
106  //- Disallow default bitwise copy construction
108 
109 
110  //- Destructor
111  virtual ~searchableExtrudedCircle();
112 
113 
114  // Member Functions
115 
116  virtual const wordList& regions() const;
117 
118  //- Whether supports volume type below
119  virtual bool hasVolumeType() const
120  {
121  return true;
122  }
123 
124  //- Range of local indices that can be returned.
125  virtual label size() const;
126 
127  //- Get representative set of element coordinates
128  // Usually the element centres (should be of length size()).
129  virtual tmp<pointField> coordinates() const;
130 
131  //- Get bounding spheres (centre and radius squared), one per element.
132  // Any point on element is guaranteed to be inside.
133  virtual void boundingSpheres
134  (
135  pointField& centres,
136  scalarField& radiusSqr
137  ) const;
138 
139  //- Get the points that define the surface.
140  virtual tmp<pointField> points() const
141  {
142  return coordinates();
143  }
144 
145  //- Does any part of the surface overlap the supplied bound box?
146  virtual bool overlaps(const boundBox& bb) const
147  {
149  return false;
150  }
151 
152 
153  // Multiple point queries.
154 
155  virtual void findNearest
156  (
157  const pointField& sample,
158  const scalarField& nearestDistSqr,
160  ) const;
161 
162  //- Unique to parametric geometry: given points find
163  // an interpolated (along the curve) point on the surface.
164  // The lambdas[0] is equivalent for start, lambdas.last()
165  // is equivalent for end.
166  virtual void findParametricNearest
167  (
168  const point& start,
169  const point& end,
170  const scalarField& lambdas,
171  const scalarField& nearestDistSqr,
173  ) const;
174 
175  virtual void findLine
176  (
177  const pointField& start,
178  const pointField& end,
180  ) const
181  {
183  }
184 
185  virtual void findLineAny
186  (
187  const pointField& start,
188  const pointField& end,
190  ) const
191  {
193  }
194 
195  //- Get all intersections in order from start to end.
196  virtual void findLineAll
197  (
198  const pointField& start,
199  const pointField& end,
201  ) const
202  {
204  }
205 
206  //- From a set of points and indices get the region
207  virtual void getRegion
208  (
209  const List<pointIndexHit>&,
210  labelList& region
211  ) const;
212 
213  //- From a set of points and indices get the normal
214  virtual void getNormal
215  (
216  const List<pointIndexHit>&,
217  vectorField& normal
218  ) const;
219 
220  //- Determine type (inside/outside/mixed) for point. unknown if
221  // cannot be determined (e.g. non-manifold surface)
222  virtual void getVolumeType
223  (
224  const pointField&,
226  ) const
227  {
229  }
230 
231  bool writeData(Ostream&) const
232  {
234  return false;
235  }
236 
237 
238  // Member Operators
239 
240  //- Disallow default bitwise assignment
241  void operator=(const searchableExtrudedCircle&) = delete;
242 };
243 
244 
245 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246 
247 } // End namespace Foam
248 
249 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
250 
251 #endif
252 
253 // ************************************************************************* //
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A bounding box defined in terms of the points at its extremities.
Definition: boundBox.H:59
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Surface geometry with a tube shape, which can be used with snappyHexMesh. The geometry is formed from...
virtual bool overlaps(const boundBox &bb) const
Does any part of the surface overlap the supplied bound box?
bool writeData(Ostream &) const
Pure virtual writaData function.
virtual ~searchableExtrudedCircle()
Destructor.
virtual void getVolumeType(const pointField &, List< volumeType > &) const
Determine type (inside/outside/mixed) for point. unknown if.
virtual void findLine(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Find first intersection on segment from start to end.
virtual label size() const
Range of local indices that can be returned.
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit >> &) const
Get all intersections in order from start to end.
virtual void boundingSpheres(pointField &centres, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared), one per element.
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Return any intersection on segment from start to end.
void operator=(const searchableExtrudedCircle &)=delete
Disallow default bitwise assignment.
virtual tmp< pointField > points() const
Get the points that define the surface.
searchableExtrudedCircle(const IOobject &io, const dictionary &dict)
Construct from dictionary (used by searchableSurface)
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
virtual void getRegion(const List< pointIndexHit > &, labelList &region) const
From a set of points and indices get the region.
virtual const wordList & regions() const
Names of regions.
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.
virtual void findNearest(const pointField &sample, const scalarField &nearestDistSqr, List< pointIndexHit > &) const
virtual tmp< pointField > coordinates() const
Get representative set of element coordinates.
virtual bool hasVolumeType() const
Whether supports volume type below.
TypeName("searchableExtrudedCircle")
Runtime type information.
A class for managing temporary objects.
Definition: tmp.H:55
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:353
Namespace for OpenFOAM.
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
dictionary dict