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

linear.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::linear
00026 
00027 Description
00028     Central-differencing interpolation scheme class
00029 
00030 SourceFiles
00031     linear.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef linear_H
00036 #define linear_H
00037 
00038 #include <finiteVolume/surfaceInterpolationScheme.H>
00039 #include <finiteVolume/volFields.H>
00040 
00041 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00042 
00043 namespace Foam
00044 {
00045 
00046 /*---------------------------------------------------------------------------*\
00047                            Class linear Declaration
00048 \*---------------------------------------------------------------------------*/
00049 
00050 template<class Type>
00051 class linear
00052 :
00053     public surfaceInterpolationScheme<Type>
00054 {
00055     // Private Member Functions
00056 
00057         //- Disallow default bitwise assignment
00058         void operator=(const linear&);
00059 
00060 
00061 public:
00062 
00063     //- Runtime type information
00064     TypeName("linear");
00065 
00066 
00067     // Constructors
00068 
00069         //- Construct from mesh
00070         linear(const fvMesh& mesh)
00071         :
00072             surfaceInterpolationScheme<Type>(mesh)
00073         {}
00074 
00075         //- Construct from Istream
00076         linear(const fvMesh& mesh, Istream&)
00077         :
00078             surfaceInterpolationScheme<Type>(mesh)
00079         {}
00080 
00081         //- Construct from faceFlux and Istream
00082         linear
00083         (
00084             const fvMesh& mesh,
00085             const surfaceScalarField&,
00086             Istream&
00087         )
00088         :
00089             surfaceInterpolationScheme<Type>(mesh)
00090         {}
00091 
00092 
00093     // Member Functions
00094 
00095         //- Return the interpolation weighting factors
00096         tmp<surfaceScalarField> weights
00097         (
00098             const GeometricField<Type, fvPatchField, volMesh>&
00099         ) const
00100         {
00101             return this->mesh().surfaceInterpolation::weights();
00102         }
00103 };
00104 
00105 
00106 template<class Type>
00107 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
00108 linearInterpolate(const GeometricField<Type, fvPatchField, volMesh>& vf)
00109 {
00110     return surfaceInterpolationScheme<Type>::interpolate
00111     (
00112         vf,
00113         vf.mesh().surfaceInterpolation::weights()
00114     );
00115 }
00116 
00117 
00118 template<class Type>
00119 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
00120 linearInterpolate(const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf)
00121 {
00122     tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tinterp = 
00123         linearInterpolate(tvf());
00124     tvf.clear();
00125     return tinterp;
00126 }
00127 
00128 
00129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00130 
00131 } // End namespace Foam
00132 
00133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00134 
00135 #endif
00136 
00137 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines