1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 Foam::searchableSurfaceCollection
29 Set of transformed searchableSurfaces. Does not do boolean operations.
30 So when meshing might find parts 'inside'.
33 searchableSurfaceCollection.C
35 \*---------------------------------------------------------------------------*/
37 #ifndef searchableSurfaceCollection_H
38 #define searchableSurfaceCollection_H
40 #include "searchableSurface.H"
41 #include "treeBoundBox.H"
42 #include "coordinateSystem.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 // Forward declaration of classes
53 /*---------------------------------------------------------------------------*\
54 Class searchableSurfaceCollection Declaration
55 \*---------------------------------------------------------------------------*/
57 class searchableSurfaceCollection
59 public searchableSurface
63 // Private Member Data
74 PtrList<coordinateSystem> transform_;
76 UPtrList<searchableSurface> subGeom_;
78 Switch mergeSubRegions_;
80 //- offsets for indices coming from different surfaces
81 // (sized with size() of each surface)
82 labelList indexOffset_;
85 mutable wordList regions_;
86 //- From individual regions to collection regions
87 mutable labelList regionOffset_;
90 // Private Member Functions
92 //- Find point nearest to sample. Updates minDistSqr. Sets nearestInfo
96 const pointField& samples,
97 scalarField& minDistSqr,
98 List<pointIndexHit>& nearestInfo,
99 labelList& nearestSurf
102 //- Sort hits into per-surface bins. Misses are rejected.
103 // Maintains map back to position
106 const List<pointIndexHit>& info,
107 List<List<pointIndexHit> >& surfInfo,
108 labelListList& infoMap
112 //- Disallow default bitwise copy construct
113 searchableSurfaceCollection(const searchableSurfaceCollection&);
115 //- Disallow default bitwise assignment
116 void operator=(const searchableSurfaceCollection&);
121 //- Runtime type information
122 TypeName("searchableSurfaceCollection");
127 //- Construct from dictionary (used by searchableSurface)
128 searchableSurfaceCollection
131 const dictionary& dict
136 virtual ~searchableSurfaceCollection();
141 virtual const wordList& regions() const;
143 //- Whether supports volume type below
144 virtual bool hasVolumeType() const
149 //- Range of local indices that can be returned.
150 virtual label size() const;
152 //- Get representative set of element coordinates
153 // Usually the element centres (should be of length size()).
154 virtual pointField coordinates() const;
157 // Multiple point queries.
159 virtual void findNearest
161 const pointField& sample,
162 const scalarField& nearestDistSqr,
166 virtual void findLine
168 const pointField& start,
169 const pointField& end,
173 virtual void findLineAny
175 const pointField& start,
176 const pointField& end,
180 //- Get all intersections in order from start to end.
181 virtual void findLineAll
183 const pointField& start,
184 const pointField& end,
185 List<List<pointIndexHit> >&
188 //- From a set of points and indices get the region
189 virtual void getRegion
191 const List<pointIndexHit>&,
195 //- From a set of points and indices get the normal
196 virtual void getNormal
198 const List<pointIndexHit>&,
202 //- Determine type (inside/outside/mixed) for point. unknown if
203 // cannot be determined (e.g. non-manifold surface)
204 virtual void getVolumeType
212 //- Set bounds of surface. Bounds currently set as list of
213 // bounding boxes. The bounds are hints to the surface as for
214 // the range of queries it can expect. faceMap/pointMap can be
215 // set if the surface has done any redistribution.
216 virtual void distribute
218 const List<treeBoundBox>&,
219 const bool keepNonLocal,
220 autoPtr<mapDistribute>& faceMap,
221 autoPtr<mapDistribute>& pointMap
224 //- WIP. Store element-wise field.
225 virtual void setField(const labelList& values);
227 //- WIP. From a set of hits (points and
228 // indices) get the specified field. Misses do not get set. Return
229 // empty field if not supported.
230 virtual void getField(const List<pointIndexHit>&, labelList&) const;
232 // regIOobject implementation
234 bool writeData(Ostream&) const
238 "searchableSurfaceCollection::writeData(Ostream&) const"
246 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
248 } // End namespace Foam
250 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
254 // ************************************************************************* //