extrudedCircle_searchableSurface.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-2025 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::searchableSurfaces::extrudedCircle
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 extrudedCircle;
43  file "line.eMesh";
44  radius 5;
45  \endverbatim
46 
47 SourceFiles
48  searchableExtrudedCircle.C
49 
50 \*---------------------------------------------------------------------------*/
51 
52 #ifndef extrudedCircle_searchableSurface_H
53 #define extrudedCircle_searchableSurface_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 namespace searchableSurfaces
69 {
70 
71 /*---------------------------------------------------------------------------*\
72  Class extrudedCircle Declaration
73 \*---------------------------------------------------------------------------*/
74 
75 class extrudedCircle
76 :
77  public searchableSurface
78 {
79  // Private Member Data
80 
81  //- Feature
82  autoPtr<edgeMesh> eMeshPtr_;
83 
84  //- Search structure
85  autoPtr<indexedOctree<treeDataEdge>> edgeTree_;
86 
87  //- Radius
88  const scalar radius_;
89 
90  //- Names of regions
91  mutable wordList regions_;
92 
93 
94 public:
95 
96  //- Runtime type information
97  TypeName("extrudedCircle");
98 
99 
100  // Constructors
101 
102  //- Construct from dictionary (used by searchableSurface)
104  (
105  const IOobject& io,
106  const dictionary& dict
107  );
108 
109  //- Disallow default bitwise copy construction
110  extrudedCircle(const extrudedCircle&) = delete;
111 
112 
113  //- Destructor
114  virtual ~extrudedCircle();
115 
116 
117  // Member Functions
118 
119  virtual const wordList& regions() const;
120 
121  //- Whether supports volume type below
122  virtual bool hasVolumeType() const
123  {
124  return true;
125  }
126 
127  //- Range of local indices that can be returned.
128  virtual label size() const;
129 
130  //- Get representative set of element coordinates
131  // Usually the element centres (should be of length size()).
132  virtual tmp<pointField> coordinates() const;
133 
134  //- Get bounding spheres (centre and radius squared), one per element.
135  // Any point on element is guaranteed to be inside.
136  virtual void boundingSpheres
137  (
138  pointField& centres,
139  scalarField& radiusSqr
140  ) const;
141 
142  //- Get the points that define the surface.
143  virtual tmp<pointField> points() const
144  {
145  return coordinates();
146  }
147 
148  //- Does any part of the surface overlap the supplied bound box?
149  virtual bool overlaps(const boundBox& bb) const
150  {
152  return false;
153  }
154 
155 
156  // Multiple point queries.
157 
158  virtual void findNearest
159  (
160  const pointField& sample,
161  const scalarField& nearestDistSqr,
163  ) const;
164 
165  //- Unique to parametric geometry: given points find
166  // an interpolated (along the curve) point on the surface.
167  // The lambdas[0] is equivalent for start, lambdas.last()
168  // is equivalent for end.
169  virtual void findParametricNearest
170  (
171  const point& start,
172  const point& end,
173  const scalarField& lambdas,
174  const scalarField& nearestDistSqr,
176  ) const;
177 
178  virtual void findLine
179  (
180  const pointField& start,
181  const pointField& end,
183  ) const
184  {
186  }
187 
188  virtual void findLineAny
189  (
190  const pointField& start,
191  const pointField& end,
193  ) const
194  {
196  }
197 
198  //- Get all intersections in order from start to end.
199  virtual void findLineAll
200  (
201  const pointField& start,
202  const pointField& end,
204  ) const
205  {
207  }
208 
209  //- From a set of points and indices get the region
210  virtual void getRegion
211  (
212  const List<pointIndexHit>&,
213  labelList& region
214  ) const;
215 
216  //- From a set of points and indices get the normal
217  virtual void getNormal
218  (
219  const List<pointIndexHit>&,
220  vectorField& normal
221  ) const;
222 
223  //- Determine type (inside/outside/mixed) for point. unknown if
224  // cannot be determined (e.g. non-manifold surface)
225  virtual void getVolumeType
226  (
227  const pointField&,
229  ) const
230  {
232  }
233 
234  bool writeData(Ostream&) const
235  {
237  return false;
238  }
239 
240 
241  // Member Operators
242 
243  //- Disallow default bitwise assignment
244  void operator=(const extrudedCircle&) = delete;
245 };
246 
247 
248 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
249 
250 } // End of namespace searchableSurfaces
251 } // End namespace Foam
252 
253 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
254 
255 #endif
256 
257 // ************************************************************************* //
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 keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
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 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.
virtual tmp< pointField > points() const
Get the points that define the surface.
TypeName("extrudedCircle")
Runtime type information.
void operator=(const extrudedCircle &)=delete
Disallow default bitwise assignment.
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
extrudedCircle(const IOobject &io, const dictionary &dict)
Construct from dictionary (used by searchableSurface)
virtual tmp< pointField > coordinates() const
Get representative set of element coordinates.
virtual bool hasVolumeType() const
Whether supports volume type below.
A class for managing temporary objects.
Definition: tmp.H:55
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:381
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