Fix tutorials: coupled/conjugateHeatFoam/conjugateCavity: fix Allrun file
[OpenFOAM-1.6-ext.git] / src / meshTools / indexedOctree / treeDataPoint.H
blob9c3cb68f321855b463802ecc8d3c23810bf01276
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright held by original author
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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
25 Class
26     Foam::treeDataPoint
28 Description
29     Holds (reference to) pointField. Encapsulation of data needed for
30     octree searches.
31     Used for searching for nearest point. No bounding boxes around points.
32     Only overlaps and calcNearest are implemented, rest makes little sense.
34 SourceFiles
35     treeDataPoint.C
37 \*---------------------------------------------------------------------------*/
39 #ifndef treeDataPoint_H
40 #define treeDataPoint_H
42 #include "pointField.H"
43 #include "treeBoundBox.H"
44 #include "linePointRef.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 namespace Foam
51 // Forward declaration of classes
52 template<class Type> class indexedOctree;
54 /*---------------------------------------------------------------------------*\
55                            Class treeDataPoint Declaration
56 \*---------------------------------------------------------------------------*/
58 class treeDataPoint
60     // Private data
62         const pointField& points_;
64 public:
66     // Declare name of the class and its debug switch
67     ClassName("treeDataPoint");
70     // Constructors
72         //- Construct from components. Holds reference to points!
73         treeDataPoint(const pointField& points);
76     // Member Functions
78         // Access
80             label size() const
81             {
82                 return points_.size();
83             }
85             //- Get representative point cloud for all shapes inside
86             //  (one point per shape)
87             pointField points() const;
90         // Search
92             //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
93             //  Only makes sense for closed surfaces.
94             label getVolumeType
95             (
96                 const indexedOctree<treeDataPoint>&,
97                 const point&
98             ) const;
100             //- Does (bb of) shape at index overlap bb
101             bool overlaps
102             (
103                 const label index,
104                 const treeBoundBox& sampleBb
105             ) const;
107             //- Calculates nearest (to sample) point in shape.
108             //  Returns actual point and distance (squared)
109             void findNearest
110             (
111                 const labelList& indices,
112                 const point& sample,
114                 scalar& nearestDistSqr,
115                 label& nearestIndex,
116                 point& nearestPoint
117             ) const;
119             //- Calculates nearest (to line) point in shape.
120             //  Returns point and distance (squared)
121             void findNearest
122             (
123                 const labelList& indices,
124                 const linePointRef& ln,
126                 treeBoundBox& tightest,
127                 label& minIndex,
128                 point& linePoint,
129                 point& nearestPoint
130             ) const;
132             //- Calculate intersection of shape with ray. Sets result
133             //  accordingly
134             bool intersects
135             (
136                 const label index,
137                 const point& start,
138                 const point& end,
139                 point& result
140             ) const
141             {
142                 notImplemented
143                 (
144                     "treeDataPoint::intersects(const label, const point&,"
145                     "const point&, point&)"
146                 );
147                 return false;
148             }
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 } // End namespace Foam
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 #endif
162 // ************************************************************************* //