ENH: autoLayerDriver: better layering information message
[OpenFOAM-2.0.x.git] / src / finiteVolume / interpolation / surfaceInterpolation / multivariateSchemes / multivariateScheme / multivariateScheme.H
blobcb1164c8a7cf25e6a939e8b6fc12febd52c8ad92
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
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
13     the Free Software Foundation, either version 3 of the License, or
14     (at your 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, see <http://www.gnu.org/licenses/>.
24 Class
25     Foam::multivariateScheme
27 Description
28     Generic multi-variate discretisation scheme class which may be instantiated
29     for any of the NVD, CNVD or NVDV schemes.
31 SourceFiles
32     multivariateScheme.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef multivariateScheme_H
37 #define multivariateScheme_H
39 #include "multivariateSurfaceInterpolationScheme.H"
40 #include "surfaceFields.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 namespace Foam
47 /*---------------------------------------------------------------------------*\
48                            Class multivariateScheme Declaration
49 \*---------------------------------------------------------------------------*/
51 template<class Type, class Scheme>
52 class multivariateScheme
54     public multivariateSurfaceInterpolationScheme<Type>,
55     public Scheme::LimiterType
57     // Private data
59         const surfaceScalarField& faceFlux_;
60         surfaceScalarField weights_;
63     // Private Member Functions
65         //- Disallow default bitwise copy construct
66         multivariateScheme(const multivariateScheme&);
68         //- Disallow default bitwise assignment
69         void operator=(const multivariateScheme&);
72 public:
74     //- Runtime type information
75     TypeName("multivariateScheme");
78     // Constructors
80         //- Construct for field, faceFlux and Istream
81         multivariateScheme
82         (
83             const fvMesh& mesh,
84             const typename multivariateSurfaceInterpolationScheme<Type>::
85                 fieldTable& fields,
86             const surfaceScalarField& faceFlux,
87             Istream& schemeData
88         );
91     // Member Operators
93         //- surfaceInterpolationScheme sub-class returned by operator(field)
94         //  which is used as the interpolation scheme for the field
95         class fieldScheme
96         :
97             public multivariateSurfaceInterpolationScheme<Type>::
98                 fieldScheme
99         {
100             // Private data
102                 const surfaceScalarField& weights_;
104         public:
106             // Constructors
108                 fieldScheme
109                 (
110                     const GeometricField<Type, fvPatchField, volMesh>& field,
111                     const surfaceScalarField& weights
112                 )
113                 :
114                     multivariateSurfaceInterpolationScheme<Type>::
115                         fieldScheme(field),
116                     weights_(weights)
117                 {}
120             // Member Functions
122                 //- Return the interpolation weighting factors
123                 tmp<surfaceScalarField> weights
124                 (
125                     const GeometricField<Type, fvPatchField, volMesh>&
126                 ) const
127                 {
128                     return weights_;
129                 }
130         };
132         tmp<surfaceInterpolationScheme<Type> > operator()
133         (
134             const GeometricField<Type, fvPatchField, volMesh>& field
135         ) const
136         {
137             return tmp<surfaceInterpolationScheme<Type> >
138             (
139                 new fieldScheme(field, weights_)
140             );
141         }
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 } // End namespace Foam
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 // Add the patch constructor functions to the hash tables
153 #define makeLimitedMultivariateSurfaceInterpolationScheme(SS, LIMITER)         \
154 typedef multivariateScheme                                                     \
155 <                                                                              \
156     scalar,                                                                    \
157     LimitedScheme<scalar, LIMITER<NVDTVD>, limitFuncs::magSqr>                 \
158 >                                                                              \
159     multivariateScheme##LIMITER_;                                              \
160 defineTemplateTypeNameAndDebugWithName(multivariateScheme##LIMITER_, #SS, 0);  \
161                                                                                \
162 multivariateSurfaceInterpolationScheme<scalar>::addIstreamConstructorToTable   \
163 <                                                                              \
164     multivariateScheme                                                         \
165     <                                                                          \
166         scalar,                                                                \
167         LimitedScheme<scalar, LIMITER<NVDTVD>, limitFuncs::magSqr>             \
168     >                                                                          \
169 >                                                                              \
170     addMultivariate##SS##ConstructorToTable_;
173 #define makeLLimitedMultivariateSurfaceInterpolationScheme\
174 (                                                                              \
175     SS,                                                                        \
176     LLIMITER,                                                                  \
177     LIMITER,                                                                   \
178     NVDTVD,                                                                    \
179     LIMFUNC                                                                    \
180 )                                                                              \
181 typedef multivariateScheme                                                     \
182 <                                                                              \
183     scalar,                                                                    \
184     LimitedScheme<scalar, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC>     \
185 >                                                                              \
186     multivariateScheme##LLIMITER##LIMITER##NVDTVD##LIMFUNC##_;                 \
187 defineTemplateTypeNameAndDebugWithName                                         \
188 (                                                                              \
189     multivariateScheme##LLIMITER##LIMITER##NVDTVD##LIMFUNC##_,                 \
190     #SS,                                                                       \
191     0                                                                          \
192 );                                                                             \
193                                                                                \
194 multivariateSurfaceInterpolationScheme<scalar>::addIstreamConstructorToTable   \
195 <                                                                              \
196     multivariateScheme                                                         \
197     <                                                                          \
198         scalar,                                                                \
199         LimitedScheme<scalar, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> \
200     >                                                                          \
201 >                                                                              \
202     addMultivariate##SS##ConstructorToTable_;
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 #ifdef NoRepository
207 #   include "multivariateScheme.C"
208 #endif
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 #endif
214 // ************************************************************************* //