OpenFOAM logo
Open Source CFD Toolkit

multivariateScheme.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-2005 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 the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     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, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     multivariateScheme
00027 
00028 Description
00029     Generic multi-variate discretisation scheme class which may be instantiated
00030     for any of the NVD, CNVD or NVDV schemes.
00031 
00032 SourceFiles
00033     multivariateScheme.C
00034 
00035 \*---------------------------------------------------------------------------*/
00036 
00037 #ifndef multivariateScheme_H
00038 #define multivariateScheme_H
00039 
00040 #include "multivariateSurfaceInterpolationScheme.H"
00041 #include "surfaceFields.H"
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 namespace Foam
00046 {
00047 
00048 /*---------------------------------------------------------------------------*\
00049                            Class multivariateScheme Declaration
00050 \*---------------------------------------------------------------------------*/
00051 
00052 template<class Type, class Scheme>
00053 class multivariateScheme
00054 :
00055     public multivariateSurfaceInterpolationScheme<Type>,
00056     public Scheme::LimiterType
00057 {
00058     // Private data
00059 
00060         const surfaceScalarField& faceFlux_;
00061         surfaceScalarField weights_;
00062 
00063 
00064     // Private Member Functions
00065 
00066         //- Disallow default bitwise copy construct
00067         multivariateScheme(const multivariateScheme&);
00068 
00069         //- Disallow default bitwise assignment
00070         void operator=(const multivariateScheme&);
00071 
00072 
00073 public:
00074 
00075     //- Runtime type information
00076     TypeName("multivariateScheme");
00077 
00078 
00079     // Constructors
00080 
00081         //- Construct for field, faceFlux and Istream
00082         multivariateScheme
00083         (
00084             const fvMesh& mesh,
00085             const typename multivariateSurfaceInterpolationScheme<Type>::
00086                 fieldTable& fields,
00087             const surfaceScalarField& faceFlux,
00088             Istream& schemeData
00089         );
00090 
00091 
00092     // Member Operators
00093 
00094         //- surfaceInterpolationScheme sub-class returned by operator(field)
00095         //  which is used as the interpolation scheme for the field
00096         class fieldScheme
00097         :
00098             public multivariateSurfaceInterpolationScheme<Type>::
00099                 fieldScheme
00100         {
00101             // Private data
00102 
00103                 const surfaceScalarField& weights_;
00104 
00105         public:
00106 
00107             // Constructors
00108             
00109                 fieldScheme
00110                 (
00111                     const GeometricField<Type, fvPatchField, volMesh>& field,
00112                     const surfaceScalarField& weights
00113                 )
00114                 :
00115                     multivariateSurfaceInterpolationScheme<Type>::
00116                         fieldScheme(field),
00117                     weights_(weights)
00118                 {}
00119 
00120 
00121             // Member Functions
00122 
00123                 //- Return the interpolation weighting factors
00124                 tmp<surfaceScalarField> weights
00125                 (
00126                     const GeometricField<Type, fvPatchField, volMesh>&
00127                 ) const
00128                 {
00129                     return weights_;
00130                 }
00131         };
00132 
00133         tmp<surfaceInterpolationScheme<Type> > operator()
00134         (
00135             const GeometricField<Type, fvPatchField, volMesh>& field
00136         ) const
00137         {
00138             return tmp<surfaceInterpolationScheme<Type> >
00139             (
00140                 new fieldScheme(field, weights_)
00141             );
00142         }
00143 };
00144 
00145 
00146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00147 
00148 } // End namespace Foam
00149 
00150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00151 
00152 // Add the patch constructor functions to the hash tables
00153 
00154 #define makeLimitedMultivariateSurfaceInterpolationScheme(SS, LIMITER)               \
00155 typedef multivariateScheme<scalar, LimitedScheme<scalar, LIMITER<NVDTVD>, limitFuncs::magSqr> > \
00156     multivariateScheme##LIMITER_;                                              \
00157 defineTemplateTypeNameAndDebugWithName(multivariateScheme##LIMITER_, #SS, 0);  \
00158                                                                                \
00159 multivariateSurfaceInterpolationScheme<scalar>::addIstreamConstructorToTable   \
00160 <multivariateScheme<scalar, LimitedScheme<scalar, LIMITER<NVDTVD>, limitFuncs::magSqr> > > \
00161     addMultivariate##SS##ConstructorToTable_;
00162 
00163 
00164 #define makeLLimitedMultivariateSurfaceInterpolationScheme(SS, LLIMITER, LIMITER, NVDTVD, LIMFUNC) \
00165 typedef multivariateScheme<scalar, LimitedScheme<scalar, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> > \
00166     multivariateScheme##LLIMITER##LIMITER##NVDTVD##LIMFUNC##_;                 \
00167 defineTemplateTypeNameAndDebugWithName(multivariateScheme##LLIMITER##LIMITER##NVDTVD##LIMFUNC##_, #SS, 0);  \
00168                                                                                \
00169 multivariateSurfaceInterpolationScheme<scalar>::addIstreamConstructorToTable   \
00170 <multivariateScheme<scalar, LimitedScheme<scalar, LLIMITER<LIMITER<NVDTVD> >, limitFuncs::LIMFUNC> > > \
00171     addMultivariate##SS##ConstructorToTable_;
00172 
00173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00174 
00175 #ifdef NoRepository
00176 #   include "multivariateScheme.C"
00177 #endif
00178 
00179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00180 
00181 #endif
00182 
00183 // ************************************************************************* //
For further information go to www.openfoam.org