|
|
|
distanceSurface.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::distanceSurface 00027 00028 Description 00029 A sampledSurface defined by a distance to a surface. 00030 00031 SourceFiles 00032 distanceSurface.C 00033 00034 \*---------------------------------------------------------------------------*/ 00035 00036 #ifndef distanceSurface_H 00037 #define distanceSurface_H 00038 00039 #include "sampledSurface.H" 00040 #include "searchableSurface.H" 00041 //#include "isoSurfaceCell.H" 00042 #include "isoSurface.H" 00043 00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00045 00046 namespace Foam 00047 { 00048 00049 /*---------------------------------------------------------------------------*\ 00050 Class distanceSurface Declaration 00051 \*---------------------------------------------------------------------------*/ 00052 00053 class distanceSurface 00054 : 00055 public sampledSurface 00056 { 00057 // Private data 00058 00059 //- Surface 00060 const autoPtr<searchableSurface> surfPtr_; 00061 00062 //- distance value 00063 const scalar distance_; 00064 00065 //- signed distance 00066 const bool signed_; 00067 00068 //- Whether to coarsen 00069 const Switch regularise_; 00070 00071 //- zone name (if restricted to zones) 00072 word zoneName_; 00073 00074 //- Track if the surface needs an update 00075 mutable bool needsUpdate_; 00076 00077 00078 //- Distance to cell centres 00079 autoPtr<volScalarField> cellDistancePtr_; 00080 00081 //- Distance to points 00082 scalarField pointDistance_; 00083 00084 //- Constructed iso surface 00085 autoPtr<isoSurface> isoSurfPtr_; 00086 00087 //- triangles converted to faceList 00088 mutable autoPtr<faceList> facesPtr_; 00089 00090 00091 // Private Member Functions 00092 00093 //- Create iso surface 00094 void createGeometry(); 00095 00096 //- sample field on faces 00097 template <class Type> 00098 tmp<Field<Type> > sampleField 00099 ( 00100 const GeometricField<Type, fvPatchField, volMesh>& vField 00101 ) const; 00102 00103 00104 template <class Type> 00105 tmp<Field<Type> > 00106 interpolateField(const interpolation<Type>&) const; 00107 00108 00109 public: 00110 00111 //- Runtime type information 00112 TypeName("distanceSurface"); 00113 00114 00115 // Constructors 00116 00117 //- Construct from dictionary 00118 distanceSurface 00119 ( 00120 const word& name, 00121 const polyMesh& mesh, 00122 const dictionary& dict 00123 ); 00124 00125 00126 // Destructor 00127 00128 virtual ~distanceSurface(); 00129 00130 00131 // Member Functions 00132 00133 //- Does the surface need an update? 00134 virtual bool needsUpdate() const; 00135 00136 //- Mark the surface as needing an update. 00137 // May also free up unneeded data. 00138 // Return false if surface was already marked as expired. 00139 virtual bool expire(); 00140 00141 //- Update the surface as required. 00142 // Do nothing (and return false) if no update was needed 00143 virtual bool update(); 00144 00145 //- Points of surface 00146 virtual const pointField& points() const 00147 { 00148 return surface().points(); 00149 } 00150 00151 //- Faces of surface 00152 virtual const faceList& faces() const 00153 { 00154 if (facesPtr_.empty()) 00155 { 00156 const triSurface& s = surface(); 00157 00158 facesPtr_.reset(new faceList(s.size())); 00159 00160 forAll(s, i) 00161 { 00162 facesPtr_()[i] = s[i].triFaceFace(); 00163 } 00164 } 00165 return facesPtr_; 00166 } 00167 00168 00169 const isoSurface& surface() const 00170 { 00171 return isoSurfPtr_(); 00172 } 00173 00174 //- sample field on surface 00175 virtual tmp<scalarField> sample 00176 ( 00177 const volScalarField& 00178 ) const; 00179 00180 //- sample field on surface 00181 virtual tmp<vectorField> sample 00182 ( 00183 const volVectorField& 00184 ) const; 00185 00186 //- sample field on surface 00187 virtual tmp<sphericalTensorField> sample 00188 ( 00189 const volSphericalTensorField& 00190 ) const; 00191 00192 //- sample field on surface 00193 virtual tmp<symmTensorField> sample 00194 ( 00195 const volSymmTensorField& 00196 ) const; 00197 00198 //- sample field on surface 00199 virtual tmp<tensorField> sample 00200 ( 00201 const volTensorField& 00202 ) const; 00203 00204 00205 //- interpolate field on surface 00206 virtual tmp<scalarField> interpolate 00207 ( 00208 const interpolation<scalar>& 00209 ) const; 00210 00211 //- interpolate field on surface 00212 virtual tmp<vectorField> interpolate 00213 ( 00214 const interpolation<vector>& 00215 ) const; 00216 00217 //- interpolate field on surface 00218 virtual tmp<sphericalTensorField> interpolate 00219 ( 00220 const interpolation<sphericalTensor>& 00221 ) const; 00222 00223 //- interpolate field on surface 00224 virtual tmp<symmTensorField> interpolate 00225 ( 00226 const interpolation<symmTensor>& 00227 ) const; 00228 00229 //- interpolate field on surface 00230 virtual tmp<tensorField> interpolate 00231 ( 00232 const interpolation<tensor>& 00233 ) const; 00234 00235 //- Write 00236 virtual void print(Ostream&) const; 00237 }; 00238 00239 00240 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00241 00242 } // End namespace Foam 00243 00244 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00245 00246 #ifdef NoRepository 00247 # include "distanceSurfaceTemplates.C" 00248 #endif 00249 00250 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00251 00252 #endif 00253 00254 // ************************************************************************* // |