OpenFOAM logo
Open Source CFD Toolkit

faLaplacianScheme.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     faLaplacianScheme
00027 
00028 Description
00029     Abstract base class for laplacian schemes.
00030 
00031 SourceFiles
00032     faLaplacianScheme.C
00033     faLaplacianSchemes.C
00034 
00035 \*---------------------------------------------------------------------------*/
00036 
00037 #ifndef faLaplacianScheme_H
00038 #define faLaplacianScheme_H
00039 
00040 #include "tmp.H"
00041 #include "areaFieldsFwd.H"
00042 #include "edgeFieldsFwd.H"
00043 #include "linearEdgeInterpolation.H"
00044 #include "correctedLnGrad.H"
00045 #include "typeInfo.H"
00046 #include "runTimeSelectionTables.H"
00047 
00048 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00049 
00050 namespace Foam
00051 {
00052 
00053 template<class Type>
00054 class faMatrix;
00055 
00056 class faMesh;
00057 
00058 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00059 
00060 namespace fa
00061 {
00062 
00063 /*---------------------------------------------------------------------------*\
00064                            Class laplacianScheme Declaration
00065 \*---------------------------------------------------------------------------*/
00066 
00067 template<class Type>
00068 class laplacianScheme
00069 :
00070     public refCount
00071 {
00072 
00073 protected:
00074 
00075     // Protected data
00076 
00077         const faMesh& mesh_;
00078         tmp<edgeInterpolationScheme<scalar> > tinterpGammaScheme_;
00079         tmp<lnGradScheme<Type> > tlnGradScheme_;
00080 
00081 
00082     // Private Member Functions
00083 
00084         //- Disallow copy construct
00085         laplacianScheme(const laplacianScheme&);
00086 
00087         //- Disallow default bitwise assignment
00088         void operator=(const laplacianScheme&);
00089 
00090 
00091 public:
00092 
00093     // Declare run-time constructor selection tables
00094 
00095         declareRunTimeSelectionTable
00096         (
00097             tmp,
00098             laplacianScheme,
00099             Istream,
00100             (const faMesh& mesh, Istream& schemeData),
00101             (mesh, schemeData)
00102         );
00103 
00104 
00105     // Constructors
00106 
00107         //- Construct from mesh
00108         laplacianScheme(const faMesh& mesh)
00109         :
00110             mesh_(mesh),
00111             tinterpGammaScheme_(new linearEdgeInterpolation<scalar>(mesh)),
00112             tlnGradScheme_(new correctedLnGrad<Type>(mesh))
00113         {}
00114 
00115         //- Construct from mesh and Istream
00116         laplacianScheme(const faMesh& mesh, Istream& is)
00117         :
00118             mesh_(mesh),
00119             tinterpGammaScheme_(NULL),
00120             tlnGradScheme_(NULL)
00121         {
00122             if (is.eof())
00123             {
00124                 tinterpGammaScheme_ = tmp<edgeInterpolationScheme<scalar> >
00125                 (
00126                     new linearEdgeInterpolation<scalar>(mesh)
00127                 );
00128 
00129                 tlnGradScheme_ = tmp<lnGradScheme<Type> >
00130                 (
00131                     new correctedLnGrad<Type>(mesh)
00132                 );
00133             }
00134             else
00135             {
00136                 tinterpGammaScheme_ = tmp<edgeInterpolationScheme<scalar> >
00137                 (
00138                     edgeInterpolationScheme<scalar>::New(mesh, is)
00139                 );
00140 
00141                 tlnGradScheme_ = tmp<lnGradScheme<Type> >
00142                 (
00143                     lnGradScheme<Type>::New(mesh, is)
00144                 );
00145             }
00146         }
00147 
00148 
00149     // Selectors
00150 
00151         //- Return a pointer to a new laplacianScheme created on freestore
00152         static tmp<laplacianScheme<Type> > New
00153         (
00154             const faMesh& mesh,
00155             Istream& schemeData
00156         );
00157 
00158 
00159     // Destructor
00160 
00161         virtual ~laplacianScheme();
00162 
00163 
00164     // Member Functions
00165 
00166         //- Return mesh reference
00167         const faMesh& mesh() const
00168         {
00169             return mesh_;
00170         }
00171 
00172         virtual tmp<faMatrix<Type> > famLaplacian
00173         (
00174             const edgeScalarField&,
00175             GeometricField<Type, faPatchField, areaMesh>&
00176         ) = 0;
00177 
00178         virtual tmp<faMatrix<Type> > famLaplacian
00179         (
00180             const areaScalarField&,
00181             GeometricField<Type, faPatchField, areaMesh>&
00182         );
00183 
00184         virtual tmp<GeometricField<Type, faPatchField, areaMesh> > facLaplacian
00185         (
00186             const GeometricField<Type, faPatchField, areaMesh>&
00187         ) = 0;
00188 
00189         virtual tmp<GeometricField<Type, faPatchField, areaMesh> > facLaplacian
00190         (
00191             const edgeScalarField&,
00192             const GeometricField<Type, faPatchField, areaMesh>&
00193         ) = 0;
00194 
00195         virtual tmp<GeometricField<Type, faPatchField, areaMesh> > facLaplacian
00196         (
00197             const areaScalarField&,
00198             const GeometricField<Type, faPatchField, areaMesh>&
00199         );
00200 };
00201 
00202 
00203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00204 
00205 } // End namespace fa
00206 
00207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00208 
00209 } // End namespace Foam
00210 
00211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00212 
00213 // Add the patch constructor functions to the hash tables
00214 
00215 #define makeFaLaplacianTypeScheme(SS, Type)                                    \
00216                                                                                \
00217 defineNamedTemplateTypeNameAndDebug(SS<Type>, 0);                              \
00218                                                                                \
00219 laplacianScheme<Type>::addIstreamConstructorToTable<SS<Type> >                 \
00220     add##SS##Type##IstreamConstructorToTable_;
00221 
00222 
00223 #define makeFaLaplacianScheme(SS)                                              \
00224                                                                                \
00225 makeFaLaplacianTypeScheme(SS, scalar)                                          \
00226 makeFaLaplacianTypeScheme(SS, vector)                                          \
00227 makeFaLaplacianTypeScheme(SS, tensor)
00228 
00229 
00230 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00231 
00232 #ifdef NoRepository
00233 #   include "faLaplacianScheme.C"
00234 #endif
00235 
00236 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00237 
00238 #endif
00239 
00240 // ************************************************************************* //
For further information go to www.openfoam.org