|
|
|
treeDataFace.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::treeDataFace 00027 00028 Description 00029 Encapsulation of data needed to search for faces. 00030 00031 SourceFiles 00032 treeDataFace.C 00033 00034 \*---------------------------------------------------------------------------*/ 00035 00036 #ifndef treeDataFace_H 00037 #define treeDataFace_H 00038 00039 #include "face.H" 00040 #include "indexedOctree.H" 00041 #include "treeBoundBoxList.H" 00042 #include "PackedBoolList.H" 00043 00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00045 00046 namespace Foam 00047 { 00048 00049 // Forward declaration of classes 00050 class primitiveMesh; 00051 //template<class Type> class indexedOctree; 00052 class polyPatch; 00053 00054 /*---------------------------------------------------------------------------*\ 00055 Class treeDataFace Declaration 00056 \*---------------------------------------------------------------------------*/ 00057 00058 class treeDataFace 00059 { 00060 // Static data 00061 00062 //- tolerance on linear dimensions 00063 static scalar tolSqr; 00064 00065 00066 00067 // Private data 00068 00069 const primitiveMesh& mesh_; 00070 00071 //- Subset of faces to work on 00072 const labelList faceLabels_; 00073 00074 //- Inverse of faceLabels. For every mesh whether face is in faceLabels. 00075 PackedBoolList isTreeFace_; 00076 00077 //- Whether to precalculate and store face bounding box 00078 const bool cacheBb_; 00079 00080 //- face bounding boxes (valid only if cacheBb_) 00081 treeBoundBoxList bbs_; 00082 00083 00084 // Private Member Functions 00085 00086 //- Calculate face bounding box 00087 treeBoundBox calcBb(const label cellI) const; 00088 00089 //- Initialise all member data 00090 void update(); 00091 00092 public: 00093 00094 // Declare name of the class and its debug switch 00095 ClassName("treeDataFace"); 00096 00097 00098 // Constructors 00099 00100 //- Construct from mesh and subset of faces. 00101 treeDataFace 00102 ( 00103 const bool cacheBb, 00104 const primitiveMesh&, 00105 const labelList& 00106 ); 00107 00108 //- Construct from mesh. Uses all faces in mesh. 00109 treeDataFace(const bool cacheBb, const primitiveMesh&); 00110 00111 //- Construct from mesh. Uses all faces in patch. 00112 treeDataFace(const bool cacheBb, const polyPatch&); 00113 00114 00115 // Member Functions 00116 00117 // Access 00118 00119 const labelList& faceLabels() const 00120 { 00121 return faceLabels_; 00122 } 00123 00124 const primitiveMesh& mesh() const 00125 { 00126 return mesh_; 00127 } 00128 00129 label size() const 00130 { 00131 return faceLabels_.size(); 00132 } 00133 00134 //- Get representative point cloud for all shapes inside 00135 // (one point per shape) 00136 pointField points() const; 00137 00138 00139 // Search 00140 00141 //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface. 00142 // Only makes sense for closed surfaces. 00143 label getVolumeType 00144 ( 00145 const indexedOctree<treeDataFace>&, 00146 const point& 00147 ) const; 00148 00149 //- Does (bb of) shape at index overlap bb 00150 bool overlaps 00151 ( 00152 const label index, 00153 const treeBoundBox& sampleBb 00154 ) const; 00155 00156 //- Calculates nearest (to sample) point in shape. 00157 // Returns actual point and distance (squared) 00158 void findNearest 00159 ( 00160 const labelList& indices, 00161 const point& sample, 00162 00163 scalar& nearestDistSqr, 00164 label& nearestIndex, 00165 point& nearestPoint 00166 ) const; 00167 00168 //- Calculates nearest (to line) point in shape. 00169 // Returns point and distance (squared) 00170 void findNearest 00171 ( 00172 const labelList& indices, 00173 const linePointRef& ln, 00174 00175 treeBoundBox& tightest, 00176 label& minIndex, 00177 point& linePoint, 00178 point& nearestPoint 00179 ) const 00180 { 00181 notImplemented 00182 ( 00183 "treeDataFace::findNearest" 00184 "(const labelList&, const linePointRef&, ..)" 00185 ); 00186 } 00187 00188 //- Calculate intersection of shape with ray. Sets result 00189 // accordingly 00190 bool intersects 00191 ( 00192 const label index, 00193 const point& start, 00194 const point& end, 00195 point& result 00196 ) const; 00197 00198 }; 00199 00200 00201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00202 00203 } // End namespace Foam 00204 00205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00206 00207 00208 #endif 00209 00210 // ************************************************************************* // |