initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / finiteVolume / finiteVolume / snGradSchemes / snGradScheme / snGradScheme.H
blob63cc2c88cf2d9e7506d2ae333012c59da0b2ac21
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::snGradScheme
28 Description
29     Abstract base class for snGrad schemes.
31 SourceFiles
32     snGradScheme.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef snGradScheme_H
37 #define snGradScheme_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 snGradScheme Declaration
59 \*---------------------------------------------------------------------------*/
61 template<class Type>
62 class snGradScheme
64     public refCount
66     // Private data
68         //- Hold reference to mesh
69         const fvMesh& mesh_;
72     // Private Member Functions
74         //- Disallow default bitwise assignment
75         void operator=(const snGradScheme&);
78 public:
80     //- Runtime type information
81     virtual const word& type() const = 0;
84     // Declare run-time constructor selection tables
86         declareRunTimeSelectionTable
87         (
88             tmp,
89             snGradScheme,
90             Mesh,
91             (const fvMesh& mesh, Istream& schemeData),
92             (mesh, schemeData)
93         );
96     // Constructors
98         //- Construct from mesh
99         snGradScheme(const fvMesh& mesh)
100         :
101             mesh_(mesh)
102         {}
105     // Selectors
107         //- Return new tmp interpolation scheme
108         static tmp<snGradScheme<Type> > New
109         (
110             const fvMesh& mesh,
111             Istream& schemeData
112         );
115     // Destructor
117         virtual ~snGradScheme();
120     // Member Functions
122         //- Return mesh reference
123         const fvMesh& mesh() const
124         {
125             return mesh_;
126         }
129         //- Return the snGrad of the given cell field with the given deltaCoeffs
130         static tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
131         snGrad
132         (
133             const GeometricField<Type, fvPatchField, volMesh>&,
134             const tmp<surfaceScalarField>&,
135             const word& snGradName = "snGrad"
136         );
138         //- Return the interpolation weighting factors for the given field
139         virtual tmp<surfaceScalarField> deltaCoeffs
140         (
141             const GeometricField<Type, fvPatchField, volMesh>&
142         ) const = 0;
144         //- Return true if this scheme uses an explicit correction
145         virtual bool corrected() const
146         {
147             return false;
148         }
150         //- Return the explicit correction to the snGrad
151         //  for the given field
152         virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
153         correction(const GeometricField<Type, fvPatchField, volMesh>&) const
154         {
155             return tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >(NULL);
156         }
158         //- Return the snGrad of the given cell field
159         //  with explicit correction
160         virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
161         snGrad(const GeometricField<Type, fvPatchField, volMesh>&) const;
163         //- Return the snGrad of the given tmp cell field
164         //  with explicit correction
165         tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
166         snGrad
167         (
168             const tmp<GeometricField<Type, fvPatchField, volMesh> >&
169         ) const;
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 } // End namespace fv
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 } // End namespace Foam
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 // Add the patch constructor functions to the hash tables
185 #define makeSnGradTypeScheme(SS, Type)                                         \
186                                                                                \
187 defineNamedTemplateTypeNameAndDebug(SS<Type>, 0);                              \
188                                                                                \
189 snGradScheme<Type>::addMeshConstructorToTable<SS<Type> >                       \
190     add##SS##Type##MeshConstructorToTable_;
192 #define makeSnGradScheme(SS)                                                   \
193                                                                                \
194 makeSnGradTypeScheme(SS, scalar)                                               \
195 makeSnGradTypeScheme(SS, vector)                                               \
196 makeSnGradTypeScheme(SS, sphericalTensor)                                      \
197 makeSnGradTypeScheme(SS, symmTensor)                                           \
198 makeSnGradTypeScheme(SS, tensor)
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 #ifdef NoRepository
204 #   include "snGradScheme.C"
205 #endif
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 #endif
211 // ************************************************************************* //