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