|
|
|
surfaceToCell.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::surfaceToCell 00027 00028 Description 00029 A topoSetSource to select cells based on relation to surface. 00030 00031 Selects: 00032 - all cells inside/outside/cut by surface 00033 - cells with centre nearer than XXX to surface 00034 - cells with centre nearer than XXX to surface @b and with normal 00035 at nearest point to centre and cell-corners differing by 00036 more than YYY (i.e., point of high curvature) 00037 00038 SourceFiles 00039 surfaceToCell.C 00040 00041 \*---------------------------------------------------------------------------*/ 00042 00043 #ifndef surfaceToCell_H 00044 #define surfaceToCell_H 00045 00046 #include "topoSetSource.H" 00047 #include "Map.H" 00048 00049 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00050 00051 namespace Foam 00052 { 00053 class triSurfaceSearch; 00054 class triSurface; 00055 00056 /*---------------------------------------------------------------------------*\ 00057 Class surfaceToCell Declaration 00058 \*---------------------------------------------------------------------------*/ 00059 00060 class surfaceToCell 00061 : 00062 public topoSetSource 00063 { 00064 00065 // Private data 00066 00067 //- Add usage string 00068 static addToUsageTable usage_; 00069 00070 //- Name of surface file 00071 fileName surfName_; 00072 00073 //- Points which are outside 00074 pointField outsidePoints_; 00075 00076 //- Include cut cells 00077 bool includeCut_; 00078 00079 //- Include inside cells 00080 bool includeInside_; 00081 00082 //- Include outside cells 00083 bool includeOutside_; 00084 00085 //- if > 0 : include cells with distance from cellCentre to surface 00086 // less than nearDist. 00087 scalar nearDist_; 00088 00089 //- if > -1 : include cells with normals at nearest surface points 00090 // varying more than curvature_. 00091 scalar curvature_; 00092 00093 //- triSurface to search on. On pointer since can be external. 00094 const triSurface* surfPtr_; 00095 00096 //- search engine on surface. 00097 const triSurfaceSearch* querySurfPtr_; 00098 00099 //- whether I allocated above surface ptrs or whether they are 00100 // external. 00101 bool IOwnPtrs_; 00102 00103 00104 // Private Member Functions 00105 00106 //- Find index of nearest triangle to point. Returns triangle or -1 if 00107 // not found within search span. 00108 // Cache result under pointI. 00109 static label getNearest 00110 ( 00111 const triSurfaceSearch& querySurf, 00112 const label pointI, 00113 const point& pt, 00114 const vector& searchSpan, 00115 Map<label>& cache 00116 ); 00117 00118 //- Return true if surface normal of nearest points to vertices on 00119 // cell differ from that on cell centre. Points cached in 00120 // pointToNearest. 00121 bool differingPointNormals 00122 ( 00123 const triSurfaceSearch& querySurf, 00124 const vector& span, 00125 const label cellI, 00126 const label cellTriI, 00127 Map<label>& pointToNearest 00128 ) const; 00129 00130 00131 //- Depending on surface add to or delete from cellSet. 00132 void combine(topoSet& set, const bool add) const; 00133 00134 //- Check values at construction time. 00135 void checkSettings() const; 00136 00137 const triSurfaceSearch& querySurf() const 00138 { 00139 return *querySurfPtr_; 00140 } 00141 00142 00143 public: 00144 00145 //- Runtime type information 00146 TypeName("surfaceToCell"); 00147 00148 // Constructors 00149 00150 //- Construct from components 00151 surfaceToCell 00152 ( 00153 const polyMesh& mesh, 00154 const fileName& surfName, 00155 const pointField& outsidePoints, 00156 const bool includeCut, 00157 const bool includeInside, 00158 const bool includeOutside, 00159 const scalar nearDist, 00160 const scalar curvature 00161 ); 00162 00163 //- Construct from components (supplied surface, surfaceSearch) 00164 surfaceToCell 00165 ( 00166 const polyMesh& mesh, 00167 const fileName& surfName, 00168 const triSurface& surf, 00169 const triSurfaceSearch& querySurf, 00170 const pointField& outsidePoints, 00171 const bool includeCut, 00172 const bool includeInside, 00173 const bool includeOutside, 00174 const scalar nearDist, 00175 const scalar curvature 00176 ); 00177 00178 //- Construct from dictionary 00179 surfaceToCell 00180 ( 00181 const polyMesh& mesh, 00182 const dictionary& dict 00183 ); 00184 00185 //- Construct from Istream 00186 surfaceToCell 00187 ( 00188 const polyMesh& mesh, 00189 Istream& 00190 ); 00191 00192 00193 // Destructor 00194 00195 virtual ~surfaceToCell(); 00196 00197 00198 // Member Functions 00199 00200 virtual void applyToSet 00201 ( 00202 const topoSetSource::setAction action, 00203 topoSet& 00204 ) const; 00205 00206 }; 00207 00208 00209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00210 00211 } // End namespace Foam 00212 00213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00214 00215 #endif 00216 00217 // ************************************************************************* // |