00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2010 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 00013 the Free Software Foundation, either version 3 of the License, or 00014 (at your 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, see <http://www.gnu.org/licenses/>. 00023 00024 Class 00025 Foam::searchableSurfaces 00026 00027 Description 00028 Container for searchableSurfaces. 00029 00030 SourceFiles 00031 searchableSurfaces.C 00032 00033 \*---------------------------------------------------------------------------*/ 00034 00035 #ifndef searchableSurfaces_H 00036 #define searchableSurfaces_H 00037 00038 #include "searchableSurface.H" 00039 #include <OpenFOAM/labelPair.H> 00040 00041 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00042 00043 namespace Foam 00044 { 00045 00046 // Forward declaration of classes 00047 00048 /*---------------------------------------------------------------------------*\ 00049 Class searchableSurfaces Declaration 00050 \*---------------------------------------------------------------------------*/ 00051 00052 class searchableSurfaces 00053 : 00054 public PtrList<searchableSurface> 00055 { 00056 // Private data 00057 00058 //- Surface names 00059 wordList names_; 00060 00061 //- Region names per surface 00062 List<wordList> regionNames_; 00063 00065 //HashTable<labelPair> regionNames_; 00066 00067 //- Indices of all surfaces. Precalculated and stored. 00068 labelList allSurfaces_; 00069 00070 00071 // Private Member Functions 00072 00073 //- Disallow default bitwise copy construct 00074 searchableSurfaces(const searchableSurfaces&); 00075 00076 //- Disallow default bitwise assignment 00077 void operator=(const searchableSurfaces&); 00078 00079 00080 public: 00081 00082 ClassName("searchableSurfaces"); 00083 00084 // Constructors 00085 00086 //- Construct with length specified. Fill later. 00087 explicit searchableSurfaces(const label); 00088 00089 00091 //searchableSurfaces(const IOobject&, const PtrList<dictionary>&); 00092 00093 //- Construct from dictionary 00094 searchableSurfaces(const IOobject&, const dictionary&); 00095 00096 00097 // Member Functions 00098 00099 const wordList& names() const 00100 { 00101 return names_; 00102 } 00103 wordList& names() 00104 { 00105 return names_; 00106 } 00107 00108 const List<wordList>& regionNames() const 00109 { 00110 return regionNames_; 00111 } 00112 List<wordList>& regionNames() 00113 { 00114 return regionNames_; 00115 } 00116 00117 00119 //HashTable<labelPair>& regionNames() 00120 //{ 00121 // return regionNames_; 00122 //} 00124 //const labelPair& surfaceRegion(const word& globalRegion) const 00125 //{ 00126 // return regionNames_[globalRegion]; 00127 //} 00128 00129 //- Find index of surface. Return -1 if not found. 00130 label findSurfaceID(const word& name) const; 00131 00132 00133 // Multiple point queries. 00134 00135 //- Find any intersection. Return hit point information and 00136 // surface number. If multiple surfaces hit the first surface 00137 // is returned, not necessarily the nearest (to start). 00138 void findAnyIntersection 00139 ( 00140 const pointField& start, 00141 const pointField& end, 00142 labelList& surfaces, 00143 List<pointIndexHit>& 00144 ) const; 00145 00146 //- Find all intersections in order from start to end. Returns for 00147 // every hit the surface and the hit info. 00148 void findAllIntersections 00149 ( 00150 const pointField& start, 00151 const pointField& end, 00152 labelListList& surfaces, 00153 List<List<pointIndexHit> >& 00154 ) const; 00155 00156 //- Find nearest. Return -1 (and a miss()) or surface and nearest 00157 // point. 00158 void findNearest 00159 ( 00160 const pointField&, 00161 const scalarField& nearestDistSqr, 00162 labelList& surfaces, 00163 List<pointIndexHit>& 00164 ) const; 00165 00166 00167 // Single point queries 00168 00169 //- Calculate point which is on a set of surfaces. 00170 pointIndexHit facesIntersection 00171 ( 00172 const scalar initialDistSqr, 00173 const scalar convergenceDistSqr, 00174 const point& start 00175 ) const; 00176 00177 }; 00178 00179 00180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00181 00182 } // End namespace Foam 00183 00184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00185 00186 #endif 00187 00188 // ************************ vim: set sw=4 sts=4 et: ************************ //