initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / finiteVolume / interpolation / surfaceInterpolation / schemes / linear / linear.H
blob75ce549eeb32d3987b7c18d476ca078e408bd87b
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::linear
28 Description
29     Central-differencing interpolation scheme class
31 SourceFiles
32     linear.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef linear_H
37 #define linear_H
39 #include "surfaceInterpolationScheme.H"
40 #include "volFields.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 namespace Foam
47 /*---------------------------------------------------------------------------*\
48                            Class linear Declaration
49 \*---------------------------------------------------------------------------*/
51 template<class Type>
52 class linear
54     public surfaceInterpolationScheme<Type>
56     // Private Member Functions
58         //- Disallow default bitwise assignment
59         void operator=(const linear&);
62 public:
64     //- Runtime type information
65     TypeName("linear");
68     // Constructors
70         //- Construct from mesh
71         linear(const fvMesh& mesh)
72         :
73             surfaceInterpolationScheme<Type>(mesh)
74         {}
76         //- Construct from Istream
77         linear(const fvMesh& mesh, Istream&)
78         :
79             surfaceInterpolationScheme<Type>(mesh)
80         {}
82         //- Construct from faceFlux and Istream
83         linear
84         (
85             const fvMesh& mesh,
86             const surfaceScalarField&,
87             Istream&
88         )
89         :
90             surfaceInterpolationScheme<Type>(mesh)
91         {}
94     // Member Functions
96         //- Return the interpolation weighting factors
97         tmp<surfaceScalarField> weights
98         (
99             const GeometricField<Type, fvPatchField, volMesh>&
100         ) const
101         {
102             return this->mesh().surfaceInterpolation::weights();
103         }
107 template<class Type>
108 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
109 linearInterpolate(const GeometricField<Type, fvPatchField, volMesh>& vf)
111     return surfaceInterpolationScheme<Type>::interpolate
112     (
113         vf,
114         vf.mesh().surfaceInterpolation::weights()
115     );
119 template<class Type>
120 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
121 linearInterpolate(const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf)
123     tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tinterp = 
124         linearInterpolate(tvf());
125     tvf.clear();
126     return tinterp;
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 } // End namespace Foam
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 #endif
138 // ************************************************************************* //