OpenFOAM logo
Open Source CFD Toolkit

gradScheme.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     gradScheme
00027 
00028 Description
00029     Abstract base class for gradient schemes.
00030 
00031 SourceFiles
00032     gradScheme.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef gradScheme_H
00037 #define gradScheme_H
00038 
00039 #include "tmp.H"
00040 #include "volFieldsFwd.H"
00041 #include "surfaceFieldsFwd.H"
00042 #include "typeInfo.H"
00043 #include "runTimeSelectionTables.H"
00044 
00045 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00046 
00047 namespace Foam
00048 {
00049 
00050 class fvMesh;
00051 
00052 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00053 
00054 namespace fv
00055 {
00056 
00057 /*---------------------------------------------------------------------------*\
00058                            Class gradScheme Declaration
00059 \*---------------------------------------------------------------------------*/
00060 
00061 template<class Type>
00062 class gradScheme
00063 :
00064     public refCount
00065 {
00066     // Private data
00067 
00068         const fvMesh& mesh_;
00069 
00070 
00071     // Private Member Functions
00072 
00073         //- Disallow copy construct
00074         gradScheme(const gradScheme&);
00075 
00076         //- Disallow default bitwise assignment
00077         void operator=(const gradScheme&);
00078 
00079 
00080 public:
00081 
00082     //- Runtime type information
00083     virtual const word& type() const = 0;
00084 
00085 
00086     // Declare run-time constructor selection tables
00087 
00088         declareRunTimeSelectionTable
00089         (
00090             tmp,
00091             gradScheme,
00092             Istream,
00093             (const fvMesh& mesh, Istream& schemeData),
00094             (mesh, schemeData)
00095         );
00096 
00097 
00098     // Constructors
00099 
00100         //- Construct from mesh
00101         gradScheme(const fvMesh& mesh)
00102         :
00103             mesh_(mesh)
00104         {}
00105 
00106 
00107     // Selectors
00108 
00109         //- Return a pointer to a new gradScheme created on freestore
00110         static tmp<gradScheme<Type> > New
00111         (
00112             const fvMesh& mesh,
00113             Istream& schemeData
00114         );
00115 
00116 
00117     // Destructor
00118 
00119         virtual ~gradScheme();
00120 
00121 
00122     // Member Functions
00123 
00124         //- Return mesh reference
00125         const fvMesh& mesh() const
00126         {
00127             return mesh_;
00128         }
00129 
00130         //- Calculate and return the grad of the given field
00131         virtual tmp
00132         <
00133             GeometricField
00134             <typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
00135         > grad
00136         (
00137             const GeometricField<Type, fvPatchField, volMesh>&
00138         ) const = 0;
00139 };
00140 
00141 
00142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00143 
00144 } // End namespace fv
00145 
00146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00147 
00148 } // End namespace Foam
00149 
00150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00151 
00152 // Add the patch constructor functions to the hash tables
00153 
00154 #define makeFvGradTypeScheme(SS, Type)                                         \
00155                                                                                \
00156 defineNamedTemplateTypeNameAndDebug(SS<Type>, 0);                              \
00157                                                                                \
00158 gradScheme<Type>::addIstreamConstructorToTable<SS<Type> >                      \
00159     add##SS##Type##IstreamConstructorToTable_;
00160 
00161 
00162 #define makeFvGradScheme(SS)                                                   \
00163                                                                                \
00164 makeFvGradTypeScheme(SS, scalar)                                               \
00165 makeFvGradTypeScheme(SS, vector)
00166 
00167 
00168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00169 
00170 #ifdef NoRepository
00171 #   include "gradScheme.C"
00172 #endif
00173 
00174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00175 
00176 #endif
00177 
00178 // ************************************************************************* //
For further information go to www.openfoam.org