OpenFOAM logo
Open Source CFD Toolkit

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