|
|
|
treeDataPoint.HGo to the documentation of this file.00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. 00006 \\/ M anipulation | 00007 ------------------------------------------------------------------------------- 00008 License 00009 This file is part of OpenFOAM. 00010 00011 OpenFOAM is free software; you can redistribute it and/or modify it 00012 under the terms of the GNU General Public License as published by the 00013 Free Software Foundation; either version 2 of the License, or (at your 00014 option) any later version. 00015 00016 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00018 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00019 for more details. 00020 00021 You should have received a copy of the GNU General Public License 00022 along with OpenFOAM; if not, write to the Free Software Foundation, 00023 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00024 00025 Class 00026 Foam::treeDataPoint 00027 00028 Description 00029 Holds (reference to) pointField. Encapsulation of data needed for 00030 octree searches. 00031 Used for searching for nearest point. No bounding boxes around points. 00032 Only overlaps and calcNearest are implemented, rest makes little sense. 00033 00034 SourceFiles 00035 treeDataPoint.C 00036 00037 \*---------------------------------------------------------------------------*/ 00038 00039 #ifndef treeDataPoint_H 00040 #define treeDataPoint_H 00041 00042 #include "pointField.H" 00043 #include "treeBoundBox.H" 00044 #include "linePointRef.H" 00045 00046 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00047 00048 namespace Foam 00049 { 00050 00051 // Forward declaration of classes 00052 template<class Type> class indexedOctree; 00053 00054 /*---------------------------------------------------------------------------*\ 00055 Class treeDataPoint Declaration 00056 \*---------------------------------------------------------------------------*/ 00057 00058 class treeDataPoint 00059 { 00060 // Private data 00061 00062 const pointField& points_; 00063 00064 public: 00065 00066 // Declare name of the class and its debug switch 00067 ClassName("treeDataPoint"); 00068 00069 00070 // Constructors 00071 00072 //- Construct from components. Holds reference to points! 00073 treeDataPoint(const pointField& points); 00074 00075 00076 // Member Functions 00077 00078 // Access 00079 00080 label size() const 00081 { 00082 return points_.size(); 00083 } 00084 00085 //- Get representative point cloud for all shapes inside 00086 // (one point per shape) 00087 pointField points() const; 00088 00089 00090 // Search 00091 00092 //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface. 00093 // Only makes sense for closed surfaces. 00094 label getVolumeType 00095 ( 00096 const indexedOctree<treeDataPoint>&, 00097 const point& 00098 ) const; 00099 00100 //- Does (bb of) shape at index overlap bb 00101 bool overlaps 00102 ( 00103 const label index, 00104 const treeBoundBox& sampleBb 00105 ) const; 00106 00107 //- Calculates nearest (to sample) point in shape. 00108 // Returns actual point and distance (squared) 00109 void findNearest 00110 ( 00111 const labelList& indices, 00112 const point& sample, 00113 00114 scalar& nearestDistSqr, 00115 label& nearestIndex, 00116 point& nearestPoint 00117 ) const; 00118 00119 //- Calculates nearest (to line) point in shape. 00120 // Returns point and distance (squared) 00121 void findNearest 00122 ( 00123 const labelList& indices, 00124 const linePointRef& ln, 00125 00126 treeBoundBox& tightest, 00127 label& minIndex, 00128 point& linePoint, 00129 point& nearestPoint 00130 ) const; 00131 00132 //- Calculate intersection of shape with ray. Sets result 00133 // accordingly 00134 bool intersects 00135 ( 00136 const label index, 00137 const point& start, 00138 const point& end, 00139 point& result 00140 ) const 00141 { 00142 notImplemented 00143 ( 00144 "treeDataPoint::intersects(const label, const point&," 00145 "const point&, point&)" 00146 ); 00147 return false; 00148 } 00149 00150 }; 00151 00152 00153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00154 00155 } // End namespace Foam 00156 00157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00158 00159 00160 #endif 00161 00162 // ************************************************************************* // |