1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
25 Foam::searchableSurfaceCollection
28 Set of transformed searchableSurfaces. Does not do boolean operations.
29 So when meshing might find parts 'inside'.
32 searchableSurfaceCollection.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef searchableSurfaceCollection_H
37 #define searchableSurfaceCollection_H
39 #include "searchableSurface.H"
40 #include "treeBoundBox.H"
41 #include "coordinateSystem.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 // Forward declaration of classes
52 /*---------------------------------------------------------------------------*\
53 Class searchableSurfaceCollection Declaration
54 \*---------------------------------------------------------------------------*/
56 class searchableSurfaceCollection
58 public searchableSurface
62 // Private Member Data
73 PtrList<coordinateSystem> transform_;
75 UPtrList<searchableSurface> subGeom_;
77 Switch mergeSubRegions_;
79 //- offsets for indices coming from different surfaces
80 // (sized with size() of each surface)
81 labelList indexOffset_;
84 mutable wordList regions_;
85 //- From individual regions to collection regions
86 mutable labelList regionOffset_;
89 // Private Member Functions
91 //- Find point nearest to sample. Updates minDistSqr. Sets nearestInfo
95 const pointField& samples,
96 scalarField& minDistSqr,
97 List<pointIndexHit>& nearestInfo,
98 labelList& nearestSurf
101 //- Sort hits into per-surface bins. Misses are rejected.
102 // Maintains map back to position
105 const List<pointIndexHit>& info,
106 List<List<pointIndexHit> >& surfInfo,
107 labelListList& infoMap
111 //- Disallow default bitwise copy construct
112 searchableSurfaceCollection(const searchableSurfaceCollection&);
114 //- Disallow default bitwise assignment
115 void operator=(const searchableSurfaceCollection&);
120 //- Runtime type information
121 TypeName("searchableSurfaceCollection");
126 //- Construct from dictionary (used by searchableSurface)
127 searchableSurfaceCollection
130 const dictionary& dict
134 virtual ~searchableSurfaceCollection();
139 //- scaling vector per subsurface
140 const vectorField& scale() const
145 //- scaling vector per subsurface
151 //- coordinate system per subsurface
152 const PtrList<coordinateSystem>& transform() const
157 //- coordinate system per subsurface
158 PtrList<coordinateSystem>& transform()
164 virtual const wordList& regions() const;
166 //- Whether supports volume type below
167 virtual bool hasVolumeType() const
172 //- Range of local indices that can be returned.
173 virtual label size() const;
175 //- Get representative set of element coordinates
176 // Usually the element centres (should be of length size()).
177 virtual pointField coordinates() const;
180 // Multiple point queries.
182 virtual void findNearest
184 const pointField& sample,
185 const scalarField& nearestDistSqr,
189 virtual void findLine
191 const pointField& start,
192 const pointField& end,
196 virtual void findLineAny
198 const pointField& start,
199 const pointField& end,
203 //- Get all intersections in order from start to end.
204 virtual void findLineAll
206 const pointField& start,
207 const pointField& end,
208 List<List<pointIndexHit> >&
211 //- From a set of points and indices get the region
212 virtual void getRegion
214 const List<pointIndexHit>&,
218 //- From a set of points and indices get the normal
219 virtual void getNormal
221 const List<pointIndexHit>&,
225 //- Determine type (inside/outside/mixed) for point. unknown if
226 // cannot be determined (e.g. non-manifold surface)
227 virtual void getVolumeType
235 //- Set bounds of surface. Bounds currently set as list of
236 // bounding boxes. The bounds are hints to the surface as for
237 // the range of queries it can expect. faceMap/pointMap can be
238 // set if the surface has done any redistribution.
239 virtual void distribute
241 const List<treeBoundBox>&,
242 const bool keepNonLocal,
243 autoPtr<mapDistribute>& faceMap,
244 autoPtr<mapDistribute>& pointMap
247 //- WIP. Store element-wise field.
248 virtual void setField(const labelList& values);
250 //- WIP. From a set of hits (points and
251 // indices) get the specified field. Misses do not get set. Return
252 // empty field if not supported.
253 virtual void getField(const List<pointIndexHit>&, labelList&) const;
255 // regIOobject implementation
257 bool writeData(Ostream&) const
261 "searchableSurfaceCollection::writeData(Ostream&) const"
269 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
271 } // End namespace Foam
273 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
277 // ************************************************************************* //