searchableSurfaceCollection.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) 2011-2017 OpenFOAM Foundation
9 Copyright (C) 2015-2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::searchableSurfaceCollection
29
30Description
31 Set of transformed searchableSurfaces. Does not do boolean operations
32 so when meshing might find parts 'inside'.
33
34 \heading Dictionary parameters
35 \table
36 Property | Description | Required | Default
37 type | collection | selector |
38 mergeSubRegions | boolean | yes |
39 \endtable
40
41Note
42 Longer type name : \c searchableSurfaceCollection
43
44SourceFiles
45 searchableSurfaceCollection.C
46
47\*---------------------------------------------------------------------------*/
48
49#ifndef searchableSurfaceCollection_H
50#define searchableSurfaceCollection_H
51
52#include "searchableSurface.H"
53#include "treeBoundBox.H"
54#include "cartesianCS.H"
55#include "UPtrList.H"
56
57// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58
59namespace Foam
60{
61
62/*---------------------------------------------------------------------------*\
63 Class searchableSurfaceCollection Declaration
64\*---------------------------------------------------------------------------*/
65
66class searchableSurfaceCollection
67:
68 public searchableSurface
69{
70 // Private Member Data
71
72 // Per instance data
73
74 //- Instance name
75 wordList instance_;
76
77 //- Scaling vector
78 vectorField scale_;
79
80 //- Coordinate transformation
82
84
85 bool mergeSubRegions_;
86
87 //- Offsets for indices coming from different surfaces
88 // (sized with size() of each surface)
89 labelList indexOffset_;
90
91 //- Names of regions
92 mutable wordList regions_;
93
94 //- From individual regions to collection regions
95 mutable labelList regionOffset_;
96
97
98 // Private Member Functions
99
100 //- Inherit findNearest from searchableSurface
102
103 //- Find point nearest to sample. Updates minDistSqr. Sets nearestInfo
104 // and surface index
105 void findNearest
106 (
107 const pointField& samples,
108 scalarField& minDistSqr,
109 List<pointIndexHit>& nearestInfo,
110 labelList& nearestSurf
111 ) const;
112
113 //- Sort hits into per-surface bins. Misses are rejected.
114 // Maintains map back to position
115 void sortHits
116 (
118 List<List<pointIndexHit>>& surfInfo,
119 labelListList& infoMap
120 ) const;
121
122
123 //- No copy construct
125 (
127 ) = delete;
128
129 //- No copy assignment
130 void operator=(const searchableSurfaceCollection&) = delete;
131
132
133public:
134
135 //- Runtime type information
136 TypeName("searchableSurfaceCollection");
137
138
139 // Constructors
140
141 //- Construct from dictionary (used by searchableSurface)
143 (
144 const IOobject& io,
145 const dictionary& dict
146 );
147
148
149 //- Destructor
151
152
153 // Member Functions
154
155 //- Scaling vector per subsurface
156 const vectorField& scale() const
157 {
158 return scale_;
159 }
160
161 //- Scaling vector per subsurface
163 {
164 return scale_;
165 }
166
167 //- Coordinate system per subsurface
168 const PtrList<coordSystem::cartesian>& transform() const
169 {
170 return transform_;
171 }
172
173 //- Coordinate system per subsurface
175 {
176 return transform_;
177 }
178
179 //- Names of regions
180 virtual const wordList& regions() const;
181
182 //- Whether supports volume type (below)
183 virtual bool hasVolumeType() const
184 {
185 return false;
186 }
187
188 //- What is type of points outside bounds
189 virtual volumeType outsideVolumeType() const
190 {
191 return volumeType::UNKNOWN;
192 }
193
194 //- Range of local indices that can be returned.
195 virtual label size() const;
196
197 //- Get representative set of element coordinates
198 // Usually the element centres (should be of length size()).
199 virtual tmp<pointField> coordinates() const;
200
201 //- Get bounding spheres (centre and radius squared), one per element.
202 // Any point on element is guaranteed to be inside.
203 virtual void boundingSpheres
204 (
205 pointField& centres,
206 scalarField& radiusSqr
207 ) const;
208
209 //- Get the points that define the surface.
210 virtual tmp<pointField> points() const;
211
212 //- Does any part of the surface overlap the supplied bound box?
213 virtual bool overlaps(const boundBox& bb) const
214 {
216 return false;
217 }
218
219
220 // Multiple point queries.
221
222 virtual void findNearest
223 (
224 const pointField& sample,
225 const scalarField& nearestDistSqr,
227 ) const;
228
229 virtual void findLine
230 (
231 const pointField& start,
232 const pointField& end,
234 ) const;
235
236 virtual void findLineAny
237 (
238 const pointField& start,
239 const pointField& end,
241 ) const;
242
243 //- Get all intersections in order from start to end.
244 virtual void findLineAll
245 (
246 const pointField& start,
247 const pointField& end,
249 ) const;
250
251 //- From a set of points and indices get the region
252 virtual void getRegion
253 (
254 const List<pointIndexHit>&,
255 labelList& region
256 ) const;
257
258 //- From a set of points and indices get the normal
259 virtual void getNormal
260 (
261 const List<pointIndexHit>&,
262 vectorField& normal
263 ) const;
264
265 //- Determine type (inside/outside/mixed) for point.
266 // Unknown if cannot be determined (e.g. non-manifold surface)
267 virtual void getVolumeType
268 (
269 const pointField& points,
270 List<volumeType>& volType
271 ) const;
272
273 // Other
274
275 //- Set bounds of surface. Bounds currently set as list of
276 // bounding boxes. The bounds are hints to the surface as for
277 // the range of queries it can expect. faceMap/pointMap can be
278 // set if the surface has done any redistribution.
279 virtual void distribute
280 (
281 const List<treeBoundBox>&,
282 const bool keepNonLocal,
284 autoPtr<mapDistribute>& pointMap
285 );
286
287 //- WIP. Store element-wise field.
288 virtual void setField(const labelList& values);
289
290 //- WIP. From a set of hits (points and
291 // indices) get the specified field. Misses do not get set. Return
292 // empty field if not supported.
293 virtual void getField(const List<pointIndexHit>&, labelList&) const;
294
295 // regIOobject implementation
296
297 bool writeData(Ostream&) const
298 {
300 return false;
301 }
302};
303
304
305// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
306
307} // End namespace Foam
308
309// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
310
311#endif
312
313// ************************************************************************* //
Minimal example by using system/controlDict.functions:
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
InfoProxy< IOobject > info() const
Return info proxy, for printing information to a stream.
Definition: IOobject.H:690
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: PtrList.H:73
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Definition: UPtrList.H:71
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A bounding box defined in terms of min/max extrema points.
Definition: boundBox.H:64
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Set of transformed searchableSurfaces. Does not do boolean operations so when meshing might find part...
virtual bool overlaps(const boundBox &bb) const
Does any part of the surface overlap the supplied bound box?
vectorField & scale()
Scaling vector per subsurface.
const PtrList< coordSystem::cartesian > & transform() const
Coordinate system per subsurface.
TypeName("searchableSurfaceCollection")
Runtime type information.
PtrList< coordSystem::cartesian > & transform()
Coordinate system per subsurface.
bool writeData(Ostream &) const
Pure virtual writeData function.
virtual void findLine(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Find first intersection on segment from start to end.
virtual void distribute(const List< treeBoundBox > &, const bool keepNonLocal, autoPtr< mapDistribute > &faceMap, autoPtr< mapDistribute > &pointMap)
Set bounds of surface. Bounds currently set as list of.
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit > > &) const
Get all intersections in order from start to end.
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Return any intersection on segment from start to end.
virtual label size() const
Range of local indices that can be returned.
virtual void boundingSpheres(pointField &centres, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared), one per element.
virtual void getVolumeType(const pointField &points, List< volumeType > &volType) const
Determine type (inside/outside/mixed) for point.
virtual void setField(const labelList &values)
WIP. Store element-wise field.
virtual void getField(const List< pointIndexHit > &, labelList &) const
WIP. From a set of hits (points and.
const vectorField & scale() const
Scaling vector per subsurface.
virtual volumeType outsideVolumeType() const
What is type of points outside bounds.
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 tmp< pointField > coordinates() const
Get representative set of element coordinates.
virtual bool hasVolumeType() const
Whether supports volume type (below)
virtual tmp< pointField > points() const
Get the points that define the surface.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
virtual void findNearest(const pointField &sample, const scalarField &nearestDistSqr, List< pointIndexHit > &) const =0
A class for managing temporary objects.
Definition: tmp.H:65
An enumeration wrapper for classification of a location as being inside/outside of a volume.
Definition: volumeType.H:61
@ UNKNOWN
Unknown state.
Definition: volumeType.H:67
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
Namespace for OpenFOAM.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
List< word > wordList
A List of words.
Definition: fileName.H:63
Field< vector > vectorField
Specialisation of Field<T> for vector.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73
scalarField samples(nIntervals, Zero)