Loading...
Searching...
No Matches
searchableRotatedBox.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2014 OpenFOAM Foundation
9 Copyright (C) 2015-2018 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::searchableRotatedBox
29
30Description
31 Searching on a rotated box
32
33 Box defined as min and max coordinate. Rotation by coordinate system
34 at box middle.
35
36 E.g. box with sides 1 1 1 rotated 45 degrees around z-axis at
37 origin (0.5 0.5 0.5)
38
39 \verbatim
40 span (1 1 1);
41 origin (0.5 0.5 0.5);
42 e1 (1 1 0);
43 e3 (0 0 1);
44 \endverbatim
45
46 \heading Dictionary parameters
47 \table
48 Property | Description | Required | Default
49 type | rotatedBox | selector |
50 span | The box dimensions | yes |
51 origin | The box corner | yes |
52 e1 | Local x-axis of the box | yes |
53 e3 | Local z-axis of the box | yes |
54 \endtable
55
56Note
57 Longer type name : \c searchableRotatedBox
58
59SourceFiles
60 searchableRotatedBox.C
61
62\*---------------------------------------------------------------------------*/
63
64#ifndef searchableRotatedBox_H
65#define searchableRotatedBox_H
66
67#include "searchableSurface.H"
68#include "searchableBox.H"
69#include "cartesianCS.H"
70
71// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
72
73namespace Foam
74{
75
76/*---------------------------------------------------------------------------*\
77 Class searchableRotatedBox Declaration
78\*---------------------------------------------------------------------------*/
79
81:
83{
84 // Private Member Data
85
86 //- Box in local coordinate system
87 searchableBox box_;
88
89 //- Transformation from local to global coordinates
90 coordSystem::cartesian transform_;
91
92 //- The (global) corner points (in treeBoundBox order)
93 pointField points_;
94
95
96 // Private Member Functions
97
98 //- No copy construct
99 searchableRotatedBox(const searchableRotatedBox&) = delete;
100
101 //- No copy assignment
102 void operator=(const searchableRotatedBox&) = delete;
103
104
105public:
106
107 //- Runtime type information
108 TypeName("searchableRotatedBox");
109
110
111 // Constructors
112
113 //- Construct from components
114 searchableRotatedBox
115 (
116 const IOobject& io,
117 const vector& span,
119 );
120
121 //- Construct from dictionary (used by searchableSurface)
123 (
124 const IOobject& io,
125 const dictionary& dict
126 );
127
128
129 //- Destructor
130 virtual ~searchableRotatedBox() = default;
131
132
133 // Member Functions
134
135 //- Names of regions
136 virtual const wordList& regions() const;
137
138 //- Whether supports volume type below
139 virtual bool hasVolumeType() const
140 {
141 return true;
142 }
143
144 //- What is type of points outside bounds
146 {
147 return volumeType::OUTSIDE;
148 }
149
150 //- Range of local indices that can be returned.
151 virtual label size() const
152 {
153 return 6;
154 }
155
156 //- Get representative set of element coordinates
157 // Usually the element centres (should be of length size()).
158 virtual tmp<pointField> coordinates() const;
159
160 //- Get bounding spheres (centre and radius squared), one per element.
161 // Any point on element is guaranteed to be inside.
162 virtual void boundingSpheres
163 (
164 pointField& centres,
165 scalarField& radiusSqr
166 ) const;
167
168 //- Get the points that define the surface.
169 virtual tmp<pointField> points() const;
170
171 // Does any part of the surface overlap the supplied bound box?
172 virtual bool overlaps(const boundBox& bb) const;
174 // Single point queries.
175
176 //- Inherit findNearest from searchableSurface
178
179 //- Calculate nearest point on surface.
180 // Returns
181 // - bool : any point found nearer than nearestDistSqr
182 // - label: relevant index in surface (=face 0..5)
183 // - point: actual nearest point found
185 (
186 const point& sample,
187 const scalar nearestDistSqr
188 ) const;
189
190 //- Find nearest to segment.
191 // Returns
192 // - bool : any point found?
193 // - label: relevant index in shapes (=face 0..5)
194 // - point: actual nearest point found
195 // sets:
196 // - tightest : bounding box
197 // - linePoint : corresponding nearest point on line
199 (
200 const linePointRef& ln,
201 treeBoundBox& tightest,
202 point& linePoint
203 ) const;
204
205 //- Find nearest intersection of line between start and end.
207 (
208 const point& start,
209 const point& end
210 ) const;
211
212 //- Find any intersection of line between start and end.
214 (
215 const point& start,
216 const point& end
217 ) const;
218
219
220 // Multiple point queries.
221
222 virtual void findNearest
223 (
224 const pointField& sample,
225 const scalarField& nearestDistSqr,
227 ) const;
228
229 virtual void findLine
230 (
231 const pointField& start,
232 const pointField& end,
234 ) const;
235
236 virtual void findLineAny
237 (
238 const pointField& start,
239 const pointField& end,
241 ) const;
242
243 //- Get all intersections in order from start to end.
244 virtual void findLineAll
245 (
246 const pointField& start,
247 const pointField& end,
249 ) const;
250
251 //- From a set of points and indices get the region
252 virtual void getRegion
253 (
254 const List<pointIndexHit>&,
255 labelList& region
256 ) const;
257
258 //- From a set of points and indices get the normal
259 virtual void getNormal
260 (
261 const List<pointIndexHit>&,
262 vectorField& normal
263 ) const;
264
265 //- Determine type (inside/outside/mixed) for point. unknown if
266 // cannot be determined (e.g. non-manifold surface)
267 virtual void getVolumeType
268 (
269 const pointField& points,
270 List<volumeType>& volType
271 ) const;
272
273
274 // regIOobject implementation
275
276 bool writeData(Ostream&) const
277 {
279 return false;
280 }
281};
282
283
284// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
285
286} // End namespace Foam
287
288// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
289
290#endif
291
292// ************************************************************************* //
Minimal example by using system/controlDict.functions:
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A bounding box defined in terms of min/max extrema points.
Definition boundBox.H:71
A Cartesian coordinate system.
Definition cartesianCS.H:68
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Searching on bounding box.
Searching on a rotated box.
virtual label size() const
Range of local indices that can be returned.
bool writeData(Ostream &) const
Pure virtual writeData function.
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit > > &) const
Get all intersections in order from start to end.
virtual bool overlaps(const boundBox &bb) const
Does any part of the surface overlap the supplied bound box?
pointIndexHit findNearest(const point &sample, const scalar nearestDistSqr) const
Calculate nearest point on surface.
virtual void boundingSpheres(pointField &centres, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared), one per element.
virtual void getVolumeType(const pointField &points, List< volumeType > &volType) const
Determine type (inside/outside/mixed) for point. unknown if.
virtual ~searchableRotatedBox()=default
Destructor.
virtual volumeType outsideVolumeType() const
What is type of points outside bounds.
TypeName("searchableRotatedBox")
Runtime type information.
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
pointIndexHit findLine(const point &start, const point &end) const
Find nearest intersection of line between start and end.
virtual void getRegion(const List< pointIndexHit > &, labelList &region) const
From a set of points and indices get the region.
virtual const wordList & regions() const
Names of regions.
virtual tmp< pointField > coordinates() const
Get representative set of element coordinates.
virtual bool hasVolumeType() const
Whether supports volume type below.
pointIndexHit findLineAny(const point &start, const point &end) const
Find any intersection of line between start and end.
virtual tmp< pointField > points() const
Get the points that define the surface.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
virtual void findNearest(const pointField &sample, const scalarField &nearestDistSqr, List< pointIndexHit > &) const =0
A class for managing temporary objects.
Definition tmp.H:75
Standard boundBox with extra functionality for use in octree.
An enumeration wrapper for classification of a location as being inside/outside of a volume.
Definition volumeType.H:56
@ OUTSIDE
A location outside the volume.
Definition volumeType.H:66
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition error.H:688
const auto & io
const pointField & points
Namespace for OpenFOAM.
List< word > wordList
List of word.
Definition fileName.H:60
List< label > labelList
A List of labels.
Definition List.H:62
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
line< point, const point & > linePointRef
A line using referred points.
Definition line.H:66
Field< vector > vectorField
Specialisation of Field<T> for vector.
vector point
Point is a vector.
Definition point.H:37
vectorField pointField
pointField is a vectorField.
Vector< scalar > vector
Definition vector.H:57
PointIndexHit< point > pointIndexHit
A PointIndexHit with a 3D point.
bool ln(const fileName &src, const fileName &dst)
Create a softlink. dst should not exist. Returns true if successful.
Definition POSIX.C:1239
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68