1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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 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();
155 // Multiple point queries.
157 //- Find nearest on original surface. Note:does not use perturbation
158 // and hence might be inconsistent with intersections.
159 virtual void findNearest
161 const pointField& sample,
162 const scalarField& nearestDistSqr,
163 List<pointIndexHit>& info
166 surface().findNearest
174 virtual void findLine
176 const pointField& start,
177 const pointField& end,
181 virtual void findLineAny
183 const pointField& start,
184 const pointField& end,
188 //- Get all intersections in order from start to end.
189 virtual void findLineAll
191 const pointField& start,
192 const pointField& end,
193 List<List<pointIndexHit> >&
196 //- From a set of points and indices get the region
197 virtual void getRegion
199 const List<pointIndexHit>& info,
203 surface().getRegion(info, region);
206 //- From a set of points and indices get the normal
207 virtual void getNormal
209 const List<pointIndexHit>& info,
213 surface().getNormal(info, normal);
216 //- Determine type (inside/outside/mixed) for point. unknown if
217 // cannot be determined (e.g. non-manifold surface)
218 virtual void getVolumeType
220 const pointField& samples,
221 List<volumeType>& info
224 surface().getVolumeType(samples, info);
228 // regIOobject implementation
230 bool writeData(Ostream& os) const
232 return surface().writeData(os);
238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240 } // End namespace Foam
242 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246 // ************************************************************************* //