dynamicTreeDataPoint.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) 2012-2015 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::dynamicTreeDataPoint
28
29Description
30 Holds (reference to) pointField. Encapsulation of data needed for
31 octree searches.
32 Used for searching for nearest point. No bounding boxes around points.
33 Only overlaps and calcNearest are implemented, rest makes little sense.
34
35 Optionally works on subset of points.
36
37SourceFiles
38 dynamicTreeDataPoint.C
39
40\*---------------------------------------------------------------------------*/
41
42#ifndef dynamicTreeDataPoint_H
43#define dynamicTreeDataPoint_H
44
45#include "pointField.H"
46#include "treeBoundBox.H"
47#include "linePointRef.H"
48#include "volumeType.H"
49
50// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51
52namespace Foam
53{
54
55// Forward declaration of classes
56template<class Type> class dynamicIndexedOctree;
57
58/*---------------------------------------------------------------------------*\
59 Class dynamicTreeDataPoint Declaration
60\*---------------------------------------------------------------------------*/
63{
64 // Private data
65
66 const DynamicList<point>& points_;
67
68public:
69
70 // Declare name of the class and its debug switch
71 ClassName("dynamicTreeDataPoint");
72
73
74 // Constructors
75
76 //- Construct from List. Holds reference!
78
79
80 // Member Functions
81
82 // Access
84 inline label size() const
85 {
86 return points_.size();
87 }
88
89 //- Get representative point cloud for all shapes inside
90 // (one point per shape)
91 const DynamicList<point>& shapePoints() const;
92
93
94 // Search
95
96 //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
97 // Only makes sense for closed surfaces.
99 (
101 const point&
102 ) const;
103
104 //- Does (bb of) shape at index overlap bb
105 bool overlaps
106 (
107 const label index,
108 const treeBoundBox& sampleBb
109 ) const;
110
111 //- Check if any point on shape is inside sphere.
112 bool overlaps
113 (
114 const label index,
115 const point& centre,
116 const scalar radiusSqr
117 ) const;
118
119 //- Calculates nearest (to sample) point in shape.
120 // Returns actual point and distance (squared)
121 void findNearest
122 (
123 const labelUList& indices,
124 const point& sample,
125
126 scalar& nearestDistSqr,
127 label& nearestIndex,
128 point& nearestPoint
129 ) const;
130
131 //- Calculates nearest (to line) point in shape.
132 // Returns point and distance (squared)
133 void findNearest
134 (
135 const labelUList& indices,
136 const linePointRef& ln,
137
138 treeBoundBox& tightest,
139 label& minIndex,
140 point& linePoint,
141 point& nearestPoint
142 ) const;
143
144 //- Calculate intersection of shape with ray. Sets result
145 // accordingly
146 bool intersects
147 (
148 const label index,
149 const point& start,
150 const point& end,
151 point& result
152 ) const
153 {
155 return false;
156 }
157
158};
159
160
161// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162
163} // End namespace Foam
164
165// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166
167
168#endif
169
170// ************************************************************************* //
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:72
Minimal example by using system/controlDict.functions:
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
Non-pointer based hierarchical recursive searching. Storage is dynamic, so elements can be deleted.
Holds (reference to) pointField. Encapsulation of data needed for octree searches....
bool overlaps(const label index, const treeBoundBox &sampleBb) const
Does (bb of) shape at index overlap bb.
ClassName("dynamicTreeDataPoint")
void findNearest(const labelUList &indices, const point &sample, scalar &nearestDistSqr, label &nearestIndex, point &nearestPoint) const
Calculates nearest (to sample) point in shape.
volumeType getVolumeType(const dynamicIndexedOctree< dynamicTreeDataPoint > &, const point &) const
Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
bool intersects(const label index, const point &start, const point &end, point &result) const
Calculate intersection of shape with ray. Sets result.
const DynamicList< point > & shapePoints() const
Get representative point cloud for all shapes inside.
A line primitive.
Definition: line.H:68
Standard boundBox with extra functionality for use in octree.
Definition: treeBoundBox.H:89
An enumeration wrapper for classification of a location as being inside/outside of a volume.
Definition: volumeType.H:61
#define ClassName(TypeNameString)
Add typeName information from argument TypeNameString to a class.
Definition: className.H:67
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
const pointField & points
Namespace for OpenFOAM.
bool ln(const fileName &src, const fileName &dst)
Create a softlink. dst should not exist. Returns true if successful.
Definition: MSwindows.C:933