initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / finiteVolume / finiteVolume / gradSchemes / gradScheme / gradScheme.H
blobe338c3dd9e42f1bb751ce80c1aecef8659071a22
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::fv::gradScheme
28 Description
29     Abstract base class for gradient schemes.
31 SourceFiles
32     gradScheme.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef gradScheme_H
37 #define gradScheme_H
39 #include "tmp.H"
40 #include "volFieldsFwd.H"
41 #include "surfaceFieldsFwd.H"
42 #include "typeInfo.H"
43 #include "runTimeSelectionTables.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 namespace Foam
50 class fvMesh;
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 namespace fv
57 /*---------------------------------------------------------------------------*\
58                            Class gradScheme Declaration
59 \*---------------------------------------------------------------------------*/
61 template<class Type>
62 class gradScheme
64     public refCount
66     // Private data
68         const fvMesh& mesh_;
71     // Private Member Functions
73         //- Disallow copy construct
74         gradScheme(const gradScheme&);
76         //- Disallow default bitwise assignment
77         void operator=(const gradScheme&);
80 public:
82     //- Runtime type information
83     virtual const word& type() const = 0;
86     // Declare run-time constructor selection tables
88         declareRunTimeSelectionTable
89         (
90             tmp,
91             gradScheme,
92             Istream,
93             (const fvMesh& mesh, Istream& schemeData),
94             (mesh, schemeData)
95         );
98     // Constructors
100         //- Construct from mesh
101         gradScheme(const fvMesh& mesh)
102         :
103             mesh_(mesh)
104         {}
107     // Selectors
109         //- Return a pointer to a new gradScheme created on freestore
110         static tmp<gradScheme<Type> > New
111         (
112             const fvMesh& mesh,
113             Istream& schemeData
114         );
117     // Destructor
119         virtual ~gradScheme();
122     // Member Functions
124         //- Return mesh reference
125         const fvMesh& mesh() const
126         {
127             return mesh_;
128         }
130         //- Calculate and return the grad of the given field
131         virtual tmp
132         <
133             GeometricField
134             <typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
135         > grad
136         (
137             const GeometricField<Type, fvPatchField, volMesh>&
138         ) const = 0;
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 } // End namespace fv
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 } // End namespace Foam
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 // Add the patch constructor functions to the hash tables
154 #define makeFvGradTypeScheme(SS, Type)                                         \
155                                                                                \
156 defineNamedTemplateTypeNameAndDebug(SS<Type>, 0);                              \
157                                                                                \
158 gradScheme<Type>::addIstreamConstructorToTable<SS<Type> >                      \
159     add##SS##Type##IstreamConstructorToTable_;
162 #define makeFvGradScheme(SS)                                                   \
163                                                                                \
164 makeFvGradTypeScheme(SS, scalar)                                               \
165 makeFvGradTypeScheme(SS, vector)
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 #ifdef NoRepository
171 #   include "gradScheme.C"
172 #endif
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 #endif
178 // ************************************************************************* //