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