1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
25 Foam::searchableSurfaceWithGaps
28 searchableSurface using multiple slightly shifted underlying surfaces
29 to make sure pierces don't go through gaps:
30 - shift test vector with two small vectors (of size gap_) perpendicular
32 Test with + and - this vector. Only if both register a hit is it seen
34 - extend the test vector slightly (with SMALL) to account for numerical
38 searchableSurfaceWithGaps.C
40 \*---------------------------------------------------------------------------*/
42 #ifndef searchableSurfaceWithGaps_H
43 #define searchableSurfaceWithGaps_H
45 #include "searchableSurface.H"
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 // Forward declaration of classes
56 /*---------------------------------------------------------------------------*\
57 Class searchableSurfaceWithGaps Declaration
58 \*---------------------------------------------------------------------------*/
60 class searchableSurfaceWithGaps
62 public searchableSurface
66 // Private Member Data
71 //- Underlying geometry (size 1)
72 UPtrList<searchableSurface> subGeom_;
75 // Private Member Functions
77 Pair<vector> offsetVecs(const point&, const point&) const;
81 const pointField& start,
82 const pointField& end,
87 static label countMisses
89 const List<pointIndexHit>& info,
93 static label countMisses
95 const List<pointIndexHit>& plusInfo,
96 const List<pointIndexHit>& minInfo,
101 //- Disallow default bitwise copy construct
102 searchableSurfaceWithGaps(const searchableSurfaceWithGaps&);
104 //- Disallow default bitwise assignment
105 void operator=(const searchableSurfaceWithGaps&);
110 //- Runtime type information
111 TypeName("searchableSurfaceWithGaps");
116 //- Construct from dictionary (used by searchableSurface)
117 searchableSurfaceWithGaps
120 const dictionary& dict
125 virtual ~searchableSurfaceWithGaps();
130 const searchableSurface& surface() const
136 virtual const wordList& regions() const
138 return surface().regions();
141 //- Whether supports volume type below
142 virtual bool hasVolumeType() const
144 return surface().hasVolumeType();
147 //- Range of local indices that can be returned.
148 virtual label size() const
150 return surface().size();
153 //- Get representative set of element coordinates
154 // Usually the element centres (should be of length size()).
155 virtual pointField coordinates() const
157 return surface().coordinates();
161 // Multiple point queries.
163 //- Find nearest on original surface. Note:does not use perturbation
164 // and hence might be inconsistent with intersections.
165 virtual void findNearest
167 const pointField& sample,
168 const scalarField& nearestDistSqr,
169 List<pointIndexHit>& info
172 surface().findNearest
180 virtual void findLine
182 const pointField& start,
183 const pointField& end,
187 virtual void findLineAny
189 const pointField& start,
190 const pointField& end,
194 //- Get all intersections in order from start to end.
195 virtual void findLineAll
197 const pointField& start,
198 const pointField& end,
199 List<List<pointIndexHit> >&
202 //- From a set of points and indices get the region
203 virtual void getRegion
205 const List<pointIndexHit>& info,
209 surface().getRegion(info, region);
212 //- From a set of points and indices get the normal
213 virtual void getNormal
215 const List<pointIndexHit>& info,
219 surface().getNormal(info, normal);
222 //- Determine type (inside/outside/mixed) for point. unknown if
223 // cannot be determined (e.g. non-manifold surface)
224 virtual void getVolumeType
226 const pointField& samples,
227 List<volumeType>& info
230 surface().getVolumeType(samples, info);
236 //- Set bounds of surface. Bounds currently set as list of
237 // bounding boxes. The bounds are hints to the surface as for
238 // the range of queries it can expect. faceMap/pointMap can be
239 // set if the surface has done any redistribution.
240 virtual void distribute
242 const List<treeBoundBox>& bbs,
243 const bool keepNonLocal,
244 autoPtr<mapDistribute>& faceMap,
245 autoPtr<mapDistribute>& pointMap
248 subGeom_[0].distribute(bbs, keepNonLocal, faceMap, pointMap);
251 //- WIP. Store element-wise field.
252 virtual void setField(const labelList& values)
254 subGeom_[0].setField(values);
257 //- WIP. From a set of hits (points and
258 // indices) get the specified field. Misses do not get set. Return
259 // empty field if not supported.
260 virtual void getField
262 const List<pointIndexHit>& info,
266 surface().getField(info, values);
269 // regIOobject implementation
271 bool writeData(Ostream& os) const
273 return surface().writeData(os);
279 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
281 } // End namespace Foam
283 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
287 // ************************************************************************* //