conformationSurfaces.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) 2012-2016 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::conformationSurfaces
28
29Description
30
31SourceFiles
32 conformationSurfacesI.H
33 conformationSurfaces.C
34
35\*---------------------------------------------------------------------------*/
36
37#ifndef conformationSurfaces_H
38#define conformationSurfaces_H
39
40#include "searchableSurfaces.H"
43#include "boolList.H"
44#include "volumeType.H"
45#include "surfaceZonesInfo.H"
46
47// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48
49namespace Foam
50{
51
52/*---------------------------------------------------------------------------*\
53 Class conformationSurfaces Declaration
54\*---------------------------------------------------------------------------*/
57{
59
60 // Private Data
61
62 const Time& runTime_;
63
64 //- Reference to the searchableSurfaces object holding all geometry data
65 const searchableSurfaces& allGeometry_;
66
67 //- A list of extendedFeatureEdgeMesh
69
70 //- The location in the mesh that specifies which portion of surfaces is
71 // to be meshed.
72 point locationInMesh_;
73
74 //- Indices of surfaces in allGeometry that are to be conformed to
75 labelList surfaces_;
76
77 //- Reverse mapping, which entry in surfaces corresponds to the surface
78 // in allGeometry specified by the list index. -1 for a surface that
79 // isn't used.
80 labelList allGeometryToSurfaces_;
81
82 //- A boolean value for each surface to be conformed to specifying if it
83 // is to be treated as a baffle
84 List<sideVolumeType> normalVolumeTypes_;
85
86 //- A flat list of all of the names of the patches from all of the
87 // surfaces to be reproduced in the meshed geometry
88 List<word> patchNames_;
89
90 //- List of surface zone (face and cell zone) information
92
93 //- The offset between the patch indices of the individual surface and
94 // the entry in the overall patch list
95 labelList regionOffset_;
96
97 //- From global region number to patchType
98 PtrList<dictionary> patchInfo_;
99
100 //- The overall boundBox of all of the surfaces to be conformed to
101 treeBoundBox globalBounds_;
102
103 //- The pattern/signature of volumeTypes representing a point in the
104 // domain to be meshed
105 List<volumeType> referenceVolumeTypes_;
106
107
108 // Private Member Functions
109
110 void hasBoundedVolume(List<volumeType>& referenceVolumeTypes) const;
111
112 //- Read into features_ from a dictionary
113 void readFeatures
114 (
115 const label surfI,
116 const dictionary& featureDict,
117 const word& surfaceName,
118 label& featureIndex
119 );
120
121 void readFeatures
122 (
123 const dictionary& featureDict,
124 const word& surfaceName,
125 label& featureIndex
126 );
127
128 //- No copy construct
130
131 //- No copy assignment
132 void operator=(const conformationSurfaces&) = delete;
133
134
135public:
136
137 //- Runtime type information
138 ClassName("conformationSurfaces");
139
140
141 // Constructors
142
143 //- Construct from dictionary and references to conformalVoronoiMesh and
144 // searchableSurfaces
146 (
147 const Time& runTime,
148 Random& rndGen,
149 const searchableSurfaces& allGeometry,
150 const dictionary& surfaceConformationDict
151 );
152
153 //- Destructor
154 ~conformationSurfaces() = default;
155
156
157 // Member Functions
158
159 // Access
160
161 //- Return reference to the searchableSurfaces object containing all
162 // of the geometry
163 inline const searchableSurfaces& geometry() const;
164
165 //- Return the object holding the feature points and edges
166 inline const PtrList<extendedFeatureEdgeMesh>& features() const;
167
168 //- Return the location to mesh
169 inline const point& locationInMesh() const;
170
171 //- Return the surface indices
172 inline const labelList& surfaces() const;
173
174 //- Return the patch names
175 inline const List<word>& patchNames() const;
176
177 //- Return the surfaceZonesInfo
178 inline const PtrList<surfaceZonesInfo>& surfZones() const;
179
180 //- Return the patch info
181 inline const PtrList<dictionary>& patchInfo() const;
182
183 //- Return the global bounds
184 inline const treeBoundBox& globalBounds() const;
185
186
187 // Query
188
189 //- Check if the supplied bound box overlaps any part of any of
190 // the surfaces
191 bool overlaps(const treeBoundBox& bb) const;
192
193 //- Check if points are inside surfaces to conform to
194 Field<bool> inside(const pointField& samplePts) const;
195
196 //- Check if point is inside surfaces to conform to
197 bool inside(const point& samplePt) const;
198
199 //- Check if points are outside surfaces to conform to
200 Field<bool> outside(const pointField& samplePts) const;
201
202 //- Check if point is outside surfaces to conform to
203 bool outside(const point& samplePt) const;
204
205 //- Check if point is closer to the surfaces to conform to than
206 // testDistSqr, in which case return false, otherwise assess in or
207 // outside and return a result depending on the testForInside flag
209 (
210 const pointField& samplePts,
211 const scalarField& testDistSqr,
212 bool testForInside
213 ) const;
214
215 //- Check if point is inside surfaces to conform to by at least
216 // testDistSqr
218 (
219 const pointField& samplePts,
220 const scalarField& testDistSqr
221 ) const;
223 bool wellInside
224 (
225 const point& samplePt,
226 scalar testDistSqr
227 ) const;
228
229 //- Check if point is outside surfaces to conform to by at least
230 // testDistSqr
232 (
233 const pointField& samplePts,
234 const scalarField& testDistSqr
235 ) const;
237 bool wellOutside
238 (
239 const point& samplePt,
240 scalar testDistSqr
241 ) const;
242
243 // Finding if the line joining start and end intersects the surface
245 (
246 const point& start,
247 const point& end
248 ) const;
249
250 //- Finding if the line joining start and end intersects the surface
251 // and returning the hit and surface information
253 (
254 const point& start,
255 const point& end,
256 pointIndexHit& surfHit,
257 label& hitSurface
258 ) const;
261 (
262 const point& start,
263 const point& end,
264 List<pointIndexHit>& surfHit,
265 labelList& hitSurface
266 ) const;
267
268 //- Finding the nearestIntersection of the surface to start
270 (
271 const point& start,
272 const point& end,
273 pointIndexHit& surfHit,
274 label& hitSurface
275 ) const;
276
277 //- Find the nearest point to the sample and return it to the
278 // pointIndexHit
280 (
281 const point& sample,
282 scalar nearestDistSqr,
283 pointIndexHit& surfHit,
284 label& hitSurface
285 ) const;
288 (
289 const pointField& samples,
290 const scalarField& nearestDistSqr,
291 List<pointIndexHit>& hitInfo,
292 labelList& hitSurfaces
293 ) const;
294
295 //- Find the nearest point on any feature edge
297 (
298 const point& sample,
299 scalar nearestDistSqr,
300 pointIndexHit& fpHit,
301 label& featureHit
302 ) const;
303
304 //- Find the nearest point on any feature edge
305 void findEdgeNearest
306 (
307 const point& sample,
308 scalar nearestDistSqr,
309 pointIndexHit& edgeHit,
310 label& featureHit
311 ) const;
313 void findEdgeNearest
314 (
315 const pointField& samples,
316 const scalarField& nearestDistsSqr,
317 List<pointIndexHit>& edgeHits,
318 labelList& featuresHit
319 ) const;
320
321 //- Find the nearest point on each type of feature edge
323 (
324 const point& sample,
325 scalar nearestDistSqr,
326 List<pointIndexHit>& edgeHit,
327 List<label>& featuresHit
328 ) const;
329
330 //- Find the nearest points on each feature edge that is within
331 // a given distance from the sample point. Will need to check for
332 // a hit or a miss because near edges may not have a nearest point
333 // on them which is perpendicular to the sample point.
335 (
336 const point& sample,
337 const scalar searchRadiusSqr,
338 List<List<pointIndexHit>>& edgeHitsByFeature,
339 List<label>& featuresHit
340 ) const;
341
342 //- Get the region number of a hit surface
343 label getPatchID
344 (
345 const label hitSurface,
346 const pointIndexHit& surfHit
347 ) const;
348
349 //- Find which patch is intersected by the line from one point to
350 // another
351 label findPatch(const point& ptA, const point& ptB) const;
352
353 //- Find which patch is closest to the point
354 label findPatch(const point& pt) const;
355
356 //- Is the surface a baffle.
358 (
359 const label hitSurface,
360 const pointIndexHit& surfHit
361 ) const;
363 void getNormal
364 (
365 const label hitSurface,
366 const List<pointIndexHit>& surfHit,
367 vectorField& normal
368 ) const;
369
370
371 // Write
372
373 //- Write all components of all the extendedFeatureEdgeMeshes as
374 // an obj file
375 void writeFeatureObj(const fileName& prefix) const;
376
377};
378
379
380// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
381
382} // End namespace Foam
383
384// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
385
387
388// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
389
390#endif
391
392// ************************************************************************* //
Generic templated field type.
Definition: Field.H:82
Minimal example by using system/controlDict.functions:
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
Definition: PointIndexHit.H:66
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: PtrList.H:73
Random number generator.
Definition: Random.H:60
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:80
bool wellInside(const point &samplePt, scalar testDistSqr) const
Field< bool > wellInOutSide(const pointField &samplePts, const scalarField &testDistSqr, bool testForInside) const
Check if point is closer to the surfaces to conform to than.
bool wellOutside(const point &samplePt, scalar testDistSqr) const
Field< bool > wellInside(const pointField &samplePts, const scalarField &testDistSqr) const
Check if point is inside surfaces to conform to by at least.
const PtrList< extendedFeatureEdgeMesh > & features() const
Return the object holding the feature points and edges.
void findEdgeNearest(const pointField &samples, const scalarField &nearestDistsSqr, List< pointIndexHit > &edgeHits, labelList &featuresHit) const
extendedFeatureEdgeMesh::sideVolumeType meshableSide(const label hitSurface, const pointIndexHit &surfHit) const
Is the surface a baffle.
void findSurfaceAllIntersections(const point &start, const point &end, List< pointIndexHit > &surfHit, labelList &hitSurface) const
void getNormal(const label hitSurface, const List< pointIndexHit > &surfHit, vectorField &normal) const
void findSurfaceNearest(const point &sample, scalar nearestDistSqr, pointIndexHit &surfHit, label &hitSurface) const
Find the nearest point to the sample and return it to the.
const searchableSurfaces & geometry() const
Return reference to the searchableSurfaces object containing all.
Field< bool > outside(const pointField &samplePts) const
Check if points are outside surfaces to conform to.
bool findSurfaceAnyIntersection(const point &start, const point &end) const
void writeFeatureObj(const fileName &prefix) const
Write all components of all the extendedFeatureEdgeMeshes as.
~conformationSurfaces()=default
Destructor.
bool overlaps(const treeBoundBox &bb) const
Check if the supplied bound box overlaps any part of any of.
const PtrList< dictionary > & patchInfo() const
Return the patch info.
ClassName("conformationSurfaces")
Runtime type information.
label findPatch(const point &pt) const
Find which patch is closest to the point.
const PtrList< surfaceZonesInfo > & surfZones() const
Return the surfaceZonesInfo.
Field< bool > wellOutside(const pointField &samplePts, const scalarField &testDistSqr) const
Check if point is outside surfaces to conform to by at least.
const List< word > & patchNames() const
Return the patch names.
void findEdgeNearest(const point &sample, scalar nearestDistSqr, pointIndexHit &edgeHit, label &featureHit) const
Find the nearest point on any feature edge.
void findFeaturePointNearest(const point &sample, scalar nearestDistSqr, pointIndexHit &fpHit, label &featureHit) const
Find the nearest point on any feature edge.
bool inside(const point &samplePt) const
Check if point is inside surfaces to conform to.
void findAllNearestEdges(const point &sample, const scalar searchRadiusSqr, List< List< pointIndexHit > > &edgeHitsByFeature, List< label > &featuresHit) const
Find the nearest points on each feature edge that is within.
const treeBoundBox & globalBounds() const
Return the global bounds.
bool outside(const point &samplePt) const
Check if point is outside surfaces to conform to.
const labelList & surfaces() const
Return the surface indices.
label getPatchID(const label hitSurface, const pointIndexHit &surfHit) const
Get the region number of a hit surface.
void findSurfaceNearestIntersection(const point &start, const point &end, pointIndexHit &surfHit, label &hitSurface) const
Finding the nearestIntersection of the surface to start.
void findEdgeNearestByType(const point &sample, scalar nearestDistSqr, List< pointIndexHit > &edgeHit, List< label > &featuresHit) const
Find the nearest point on each type of feature edge.
label findPatch(const point &ptA, const point &ptB) const
Find which patch is intersected by the line from one point to.
void findSurfaceNearest(const pointField &samples, const scalarField &nearestDistSqr, List< pointIndexHit > &hitInfo, labelList &hitSurfaces) const
Field< bool > inside(const pointField &samplePts) const
Check if points are inside surfaces to conform to.
const point & locationInMesh() const
Return the location to mesh.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
sideVolumeType
Normals point to the outside.
A class for handling file names.
Definition: fileName.H:76
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
Standard boundBox with extra functionality for use in octree.
Definition: treeBoundBox.H:89
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define ClassName(TypeNameString)
Add typeName information from argument TypeNameString to a class.
Definition: className.H:67
engineTime & runTime
Namespace for OpenFOAM.
scalarField samples(nIntervals, Zero)
Random rndGen
Definition: createFields.H:23