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

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