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