FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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