FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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