initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / finiteVolume / interpolation / surfaceInterpolation / multivariateSchemes / upwind / multivariateUpwind.H
blob127f6166eab4c1afeb298b04646fe668bca0eb38
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::multivariateUpwind
28 Description
29     Upwind-difference form of the multivariate surfaceInterpolationScheme.
31 SourceFiles
32     multivariateUpwindmake.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef multivariateUpwind_H
37 #define multivariateUpwind_H
39 #include "multivariateSurfaceInterpolationScheme.H"
40 #include "surfaceFields.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 namespace Foam
47 /*---------------------------------------------------------------------------*\
48                            Class multivariateUpwind Declaration
49 \*---------------------------------------------------------------------------*/
51 template<class Type>
52 class multivariateUpwind
54     public multivariateSurfaceInterpolationScheme<Type>
56     // Private data
58         const surfaceScalarField& faceFlux_;
61     // Private Member Functions
63         //- Disallow default bitwise copy construct
64         multivariateUpwind(const multivariateUpwind&);
66         //- Disallow default bitwise assignment
67         void operator=(const multivariateUpwind&);
70 public:
72     //- Runtime type information
73     TypeName("upwind");
76     // Constructors
78         //- Construct for field, faceFlux and Istream
79         multivariateUpwind
80         (
81             const fvMesh& mesh,
82             const typename multivariateSurfaceInterpolationScheme<Type>::
83                 fieldTable& fields,
84             const surfaceScalarField& faceFlux,
85             Istream& schemeData
86         )
87         :
88             multivariateSurfaceInterpolationScheme<Type>
89             (
90                 mesh,
91                 fields,
92                 faceFlux,
93                 schemeData
94             ),
95             faceFlux_(faceFlux)
96         {}
99     // Member Operators
101         //- surfaceInterpolationScheme sub-class returned by operator(field)
102         //  which is used as the interpolation scheme for the field
103         class fieldScheme
104         :
105             public multivariateSurfaceInterpolationScheme<Type>::fieldScheme
106         {
107             // Private data
109                 const surfaceScalarField& faceFlux_;
111         public:
113             // Constructors
114             
115                 fieldScheme
116                 (
117                     const GeometricField<Type, fvPatchField, volMesh>& field,
118                     const surfaceScalarField& faceFlux
119                 )
120                 :
121                     multivariateSurfaceInterpolationScheme<Type>::
122                         fieldScheme(field),
123                     faceFlux_(faceFlux)
124                 {}
127             // Member Functions
129                 //- Return the interpolation weighting factors
130                 tmp<surfaceScalarField> weights
131                 (
132                     const GeometricField<Type, fvPatchField, volMesh>&
133                 ) const
134                 {
135                     return pos(faceFlux_);
136                 }
137         };
139         tmp<surfaceInterpolationScheme<Type> > operator()
140         (
141             const GeometricField<Type, fvPatchField, volMesh>& field
142         ) const
143         {
144             return tmp<surfaceInterpolationScheme<Type> >
145             (
146                 new fieldScheme(field, faceFlux_)
147             );
148         }
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 } // End namespace Foam
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 #endif
160 // ************************************************************************* //