00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 2010-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::sampledTriSurfaceMesh 00026 00027 Description 00028 A sampledSurface from a triSurfaceMesh. It samples on the points/triangles 00029 of the triSurface. 00030 00031 It samples using the cell nearest to the triangle centre so does 00032 not check the cell the centre is actually in ... 00033 00034 In parallel every processor just operates on the part of the surface 00035 where the face centres are inside the mesh. It is then up to the 00036 caller to stitch the partial surfaces together. 00037 00038 SourceFiles 00039 sampledTriSurfaceMesh.C 00040 00041 \*---------------------------------------------------------------------------*/ 00042 00043 #ifndef sampledTriSurfaceMesh_H 00044 #define sampledTriSurfaceMesh_H 00045 00046 #include <sampling/sampledSurface.H> 00047 #include <meshTools/triSurfaceMesh.H> 00048 #include <surfMesh/MeshedSurface.H> 00049 00050 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00051 00052 namespace Foam 00053 { 00054 00055 /*---------------------------------------------------------------------------*\ 00056 Class sampledTriSurfaceMesh Declaration 00057 \*---------------------------------------------------------------------------*/ 00058 00059 class sampledTriSurfaceMesh 00060 : 00061 public sampledSurface, 00062 public MeshedSurface<face> 00063 { 00064 //- Private typedefs for convenience 00065 typedef MeshedSurface<face> MeshStorage; 00066 00067 // Private data 00068 00069 //- Surface to sample on 00070 const triSurfaceMesh surface_; 00071 00072 //- Track if the surface needs an update 00073 mutable bool needsUpdate_; 00074 00075 //- From local surface triangle to mesh cell. 00076 labelList cellLabels_; 00077 00078 //- From local surface back to surface_ 00079 labelList pointToFace_; 00080 00081 00082 // Private Member Functions 00083 00084 //- sample field on faces 00085 template <class Type> 00086 tmp<Field<Type> > sampleField 00087 ( 00088 const GeometricField<Type, fvPatchField, volMesh>& vField 00089 ) const; 00090 00091 00092 template <class Type> 00093 tmp<Field<Type> > 00094 interpolateField(const interpolation<Type>&) const; 00095 00096 public: 00097 00098 //- Runtime type information 00099 TypeName("sampledTriSurfaceMesh"); 00100 00101 00102 // Constructors 00103 00104 //- Construct from components 00105 sampledTriSurfaceMesh 00106 ( 00107 const word& name, 00108 const polyMesh& mesh, 00109 const word& surfaceName 00110 ); 00111 00112 //- Construct from dictionary 00113 sampledTriSurfaceMesh 00114 ( 00115 const word& name, 00116 const polyMesh& mesh, 00117 const dictionary& dict 00118 ); 00119 00120 00121 // Destructor 00122 00123 virtual ~sampledTriSurfaceMesh(); 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 00154 //- sample field on surface 00155 virtual tmp<scalarField> sample 00156 ( 00157 const volScalarField& 00158 ) const; 00159 00160 //- sample field on surface 00161 virtual tmp<vectorField> sample 00162 ( 00163 const volVectorField& 00164 ) const; 00165 00166 //- sample field on surface 00167 virtual tmp<sphericalTensorField> sample 00168 ( 00169 const volSphericalTensorField& 00170 ) const; 00171 00172 //- sample field on surface 00173 virtual tmp<symmTensorField> sample 00174 ( 00175 const volSymmTensorField& 00176 ) const; 00177 00178 //- sample field on surface 00179 virtual tmp<tensorField> sample 00180 ( 00181 const volTensorField& 00182 ) const; 00183 00184 00185 //- interpolate field on surface 00186 virtual tmp<scalarField> interpolate 00187 ( 00188 const interpolation<scalar>& 00189 ) const; 00190 00191 00192 //- interpolate field on surface 00193 virtual tmp<vectorField> interpolate 00194 ( 00195 const interpolation<vector>& 00196 ) const; 00197 00198 //- interpolate field on surface 00199 virtual tmp<sphericalTensorField> interpolate 00200 ( 00201 const interpolation<sphericalTensor>& 00202 ) const; 00203 00204 //- interpolate field on surface 00205 virtual tmp<symmTensorField> interpolate 00206 ( 00207 const interpolation<symmTensor>& 00208 ) const; 00209 00210 //- interpolate field on surface 00211 virtual tmp<tensorField> interpolate 00212 ( 00213 const interpolation<tensor>& 00214 ) const; 00215 00216 //- Write 00217 virtual void print(Ostream&) const; 00218 }; 00219 00220 00221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00222 00223 } // End namespace Foam 00224 00225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00226 00227 #ifdef NoRepository 00228 # include "sampledTriSurfaceMeshTemplates.C" 00229 #endif 00230 00231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00232 00233 #endif 00234 00235 // ************************ vim: set sw=4 sts=4 et: ************************ //