initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / finiteVolume / interpolation / surfaceInterpolation / multivariateSchemes / multivariateScheme / multivariateScheme.H
blob0baee6fd5ab0d8531f8fec1a9d345baff0ed5224
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::multivariateScheme
28 Description
29     Generic multi-variate discretisation scheme class which may be instantiated
30     for any of the NVD, CNVD or NVDV schemes.
32 SourceFiles
33     multivariateScheme.C
35 \*---------------------------------------------------------------------------*/
37 #ifndef multivariateScheme_H
38 #define multivariateScheme_H
40 #include "multivariateSurfaceInterpolationScheme.H"
41 #include "surfaceFields.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 namespace Foam
48 /*---------------------------------------------------------------------------*\
49                            Class multivariateScheme Declaration
50 \*---------------------------------------------------------------------------*/
52 template<class Type, class Scheme>
53 class multivariateScheme
55     public multivariateSurfaceInterpolationScheme<Type>,
56     public Scheme::LimiterType
58     // Private data
60         const surfaceScalarField& faceFlux_;
61         surfaceScalarField weights_;
64     // Private Member Functions
66         //- Disallow default bitwise copy construct
67         multivariateScheme(const multivariateScheme&);
69         //- Disallow default bitwise assignment
70         void operator=(const multivariateScheme&);
73 public:
75     //- Runtime type information
76     TypeName("multivariateScheme");
79     // Constructors
81         //- Construct for field, faceFlux and Istream
82         multivariateScheme
83         (
84             const fvMesh& mesh,
85             const typename multivariateSurfaceInterpolationScheme<Type>::
86                 fieldTable& fields,
87             const surfaceScalarField& faceFlux,
88             Istream& schemeData
89         );
92     // Member Operators
94         //- surfaceInterpolationScheme sub-class returned by operator(field)
95         //  which is used as the interpolation scheme for the field
96         class fieldScheme
97         :
98             public multivariateSurfaceInterpolationScheme<Type>::
99                 fieldScheme
100         {
101             // Private data
103                 const surfaceScalarField& weights_;
105         public:
107             // Constructors
108             
109                 fieldScheme
110                 (
111                     const GeometricField<Type, fvPatchField, volMesh>& field,
112                     const surfaceScalarField& weights
113                 )
114                 :
115                     multivariateSurfaceInterpolationScheme<Type>::
116                         fieldScheme(field),
117                     weights_(weights)
118                 {}
121             // Member Functions
123                 //- Return the interpolation weighting factors
124                 tmp<surfaceScalarField> weights
125                 (
126                     const GeometricField<Type, fvPatchField, volMesh>&
127                 ) const
128                 {
129                     return weights_;
130                 }
131         };
133         tmp<surfaceInterpolationScheme<Type> > operator()
134         (
135             const GeometricField<Type, fvPatchField, volMesh>& field
136         ) const
137         {
138             return tmp<surfaceInterpolationScheme<Type> >
139             (
140                 new fieldScheme(field, weights_)
141             );
142         }
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 } // End namespace Foam
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 // Add the patch constructor functions to the hash tables
154 #define makeLimitedMultivariateSurfaceInterpolationScheme(SS, LIMITER)               \
155 typedef multivariateScheme<scalar, LimitedScheme<scalar, LIMITER<NVDTVD>, limitFuncs::magSqr> > \
156     multivariateScheme##LIMITER_;                                              \
157 defineTemplateTypeNameAndDebugWithName(multivariateScheme##LIMITER_, #SS, 0);  \
158                                                                                \
159 multivariateSurfaceInterpolationScheme<scalar>::addIstreamConstructorToTable   \
160 <multivariateScheme<scalar, LimitedScheme<scalar, LIMITER<NVDTVD>, limitFuncs::magSqr> > > \
161     addMultivariate##SS##ConstructorToTable_;
164 #define makeLLimitedMultivariateSurfaceInterpolationScheme(SS, LLIMITER, LIMITER, NVDTVD, LIMFUNC) \
165 typedef multivariateScheme<scalar, LimitedScheme<scalar, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> > \
166     multivariateScheme##LLIMITER##LIMITER##NVDTVD##LIMFUNC##_;                 \
167 defineTemplateTypeNameAndDebugWithName(multivariateScheme##LLIMITER##LIMITER##NVDTVD##LIMFUNC##_, #SS, 0);  \
168                                                                                \
169 multivariateSurfaceInterpolationScheme<scalar>::addIstreamConstructorToTable   \
170 <multivariateScheme<scalar, LimitedScheme<scalar, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> > > \
171     addMultivariate##SS##ConstructorToTable_;
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 #ifdef NoRepository
176 #   include "multivariateScheme.C"
177 #endif
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 #endif
183 // ************************************************************************* //