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

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