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::searchableSurfaceWithGaps
29 searchableSurface using multiple slightly shifted underlying surfaces
30 to make sure pierces don't go through gaps:
31 - shift test vector with two small vectors (of size gap_) perpendicular
33 Test with + and - this vector. Only if both register a hit is it seen
35 - extend the test vector slightly (with SMALL) to account for numerical
39 searchableSurfaceWithGaps.C
41 \*---------------------------------------------------------------------------*/
43 #ifndef searchableSurfaceWithGaps_H
44 #define searchableSurfaceWithGaps_H
46 #include "searchableSurface.H"
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 // Forward declaration of classes
57 /*---------------------------------------------------------------------------*\
58 Class searchableSurfaceWithGaps Declaration
59 \*---------------------------------------------------------------------------*/
61 class searchableSurfaceWithGaps
63 public searchableSurface
67 // Private Member Data
72 //- Underlying geometry (size 1)
73 UPtrList<searchableSurface> subGeom_;
76 // Private Member Functions
78 Pair<vector> offsetVecs(const point&, const point&) const;
82 const pointField& start,
83 const pointField& end,
88 static label countMisses
90 const List<pointIndexHit>& info,
94 static label countMisses
96 const List<pointIndexHit>& plusInfo,
97 const List<pointIndexHit>& minInfo,
102 //- Disallow default bitwise copy construct
103 searchableSurfaceWithGaps(const searchableSurfaceWithGaps&);
105 //- Disallow default bitwise assignment
106 void operator=(const searchableSurfaceWithGaps&);
111 //- Runtime type information
112 TypeName("searchableSurfaceWithGaps");
117 //- Construct from dictionary (used by searchableSurface)
118 searchableSurfaceWithGaps
121 const dictionary& dict
126 virtual ~searchableSurfaceWithGaps();
131 const searchableSurface& surface() const
137 virtual const wordList& regions() const
139 return surface().regions();
142 //- Whether supports volume type below
143 virtual bool hasVolumeType() const
145 return surface().hasVolumeType();
148 //- Range of local indices that can be returned.
149 virtual label size() const
151 return surface().size();
154 //- Get representative set of element coordinates
155 // Usually the element centres (should be of length size()).
156 virtual pointField coordinates() const
158 return surface().coordinates();
162 // Multiple point queries.
164 //- Find nearest on original surface. Note:does not use perturbation
165 // and hence might be inconsistent with intersections.
166 virtual void findNearest
168 const pointField& sample,
169 const scalarField& nearestDistSqr,
170 List<pointIndexHit>& info
173 surface().findNearest
181 virtual void findLine
183 const pointField& start,
184 const pointField& end,
188 virtual void findLineAny
190 const pointField& start,
191 const pointField& end,
195 //- Get all intersections in order from start to end.
196 virtual void findLineAll
198 const pointField& start,
199 const pointField& end,
200 List<List<pointIndexHit> >&
203 //- From a set of points and indices get the region
204 virtual void getRegion
206 const List<pointIndexHit>& info,
210 surface().getRegion(info, region);
213 //- From a set of points and indices get the normal
214 virtual void getNormal
216 const List<pointIndexHit>& info,
220 surface().getNormal(info, normal);
223 //- Determine type (inside/outside/mixed) for point. unknown if
224 // cannot be determined (e.g. non-manifold surface)
225 virtual void getVolumeType
227 const pointField& samples,
228 List<volumeType>& info
231 surface().getVolumeType(samples, info);
237 //- Set bounds of surface. Bounds currently set as list of
238 // bounding boxes. The bounds are hints to the surface as for
239 // the range of queries it can expect. faceMap/pointMap can be
240 // set if the surface has done any redistribution.
241 virtual void distribute
243 const List<treeBoundBox>& bbs,
244 const bool keepNonLocal,
245 autoPtr<mapDistribute>& faceMap,
246 autoPtr<mapDistribute>& pointMap
249 subGeom_[0].distribute(bbs, keepNonLocal, faceMap, pointMap);
252 //- WIP. Store element-wise field.
253 virtual void setField(const labelList& values)
255 subGeom_[0].setField(values);
258 //- WIP. From a set of hits (points and
259 // indices) get the specified field. Misses do not get set. Return
260 // empty field if not supported.
261 virtual void getField
263 const List<pointIndexHit>& info,
267 surface().getField(info, values);
270 // regIOobject implementation
272 bool writeData(Ostream& os) const
274 return surface().writeData(os);
280 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
282 } // End namespace Foam
284 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
288 // ************************************************************************* //