|
|
|
triSurfaceSearch.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::triSurfaceSearch 00027 00028 Description 00029 Helper class to search on triSurface. 00030 00031 SourceFiles 00032 triSurfaceSearch.C 00033 00034 \*---------------------------------------------------------------------------*/ 00035 00036 #ifndef triSurfaceSearch_H 00037 #define triSurfaceSearch_H 00038 00039 #include "pointField.H" 00040 #include "boolList.H" 00041 #include "pointIndexHit.H" 00042 #include "indexedOctree.H" 00043 #include "treeDataTriSurface.H" 00044 00045 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00046 00047 namespace Foam 00048 { 00049 00050 // Forward declaration of classes 00051 class triSurface; 00052 class treeDataTriSurface; 00053 template<class Type> class indexedOctree; 00054 00055 /*---------------------------------------------------------------------------*\ 00056 Class triSurfaceSearch Declaration 00057 \*---------------------------------------------------------------------------*/ 00058 00059 class triSurfaceSearch 00060 { 00061 // Private data 00062 00063 //- Reference to surface to work on 00064 const triSurface& surface_; 00065 00066 //- Octree for searches 00067 autoPtr<indexedOctree<treeDataTriSurface> > treePtr_; 00068 00069 00070 // Private Member Functions 00071 00072 00073 //- Disallow default bitwise copy construct 00074 triSurfaceSearch(const triSurfaceSearch&); 00075 00076 //- Disallow default bitwise assignment 00077 void operator=(const triSurfaceSearch&); 00078 00079 public: 00080 00081 // Static data members 00082 00083 //- Point far away; used for illegal finds 00084 static const point greatPoint; 00085 00086 00087 // Constructors 00088 00089 //- Construct from surface. Holds reference to surface! 00090 triSurfaceSearch(const triSurface&); 00091 00092 00093 00094 // Member Functions 00095 00096 const indexedOctree<treeDataTriSurface>& tree() const 00097 { 00098 return treePtr_(); 00099 } 00100 00101 const triSurface& surface() const 00102 { 00103 return surface_; 00104 } 00105 00106 //- Calculate for each searchPoint inside/outside status. 00107 boolList calcInside(const pointField& searchPoints) const; 00108 00109 //- Calculate index of nearest triangle (or -1) for each sample. 00110 // Looks only in box of size 2*span around sample. 00111 labelList calcNearestTri 00112 ( 00113 const pointField& samples, 00114 const vector& span 00115 ) const; 00116 00117 //- Calculate nearest points (to searchPoints) on surface. 00118 // Looks only in box of size 2*span around sample. Returns greatPoint 00119 // if not found. 00120 tmp<pointField> calcNearest 00121 ( 00122 const pointField& samples, 00123 const vector& span 00124 ) const; 00125 00126 //- Calculate nearest point on surface for single searchPoint. Returns 00127 // in pointIndexHit: 00128 // - hit() : whether nearest point found within bounding box 00129 // - hitPoint() : coordinate of nearest point 00130 // - index() : surface triangle label 00131 pointIndexHit nearest(const point&, const vector& span) const; 00132 }; 00133 00134 00135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00136 00137 } // End namespace Foam 00138 00139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00140 00141 #endif 00142 00143 // ************************************************************************* // |