OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

sampledThresholdCellFaces.H

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