FreeFOAM The Cross-Platform CFD Toolkit
gradScheme.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::fv::gradScheme
26 
27 Description
28  Abstract base class for gradient schemes.
29 
30 SourceFiles
31  gradScheme.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef gradScheme_H
36 #define gradScheme_H
37 
38 #include <OpenFOAM/tmp.H>
41 #include <OpenFOAM/typeInfo.H>
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 class fvMesh;
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace fv
54 {
55 
56 /*---------------------------------------------------------------------------*\
57  Class gradScheme Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 template<class Type>
62 :
63  public refCount
64 {
65  // Private data
66 
67  const fvMesh& mesh_;
68 
69 
70  // Private Member Functions
71 
72  //- Disallow copy construct
73  gradScheme(const gradScheme&);
74 
75  //- Disallow default bitwise assignment
76  void operator=(const gradScheme&);
77 
78 
79 public:
80 
81  //- Runtime type information
82  virtual const word& type() const = 0;
83 
84 
85  // Declare run-time constructor selection tables
86 
88  (
89  tmp,
90  gradScheme,
91  Istream,
92  (const fvMesh& mesh, Istream& schemeData),
93  (mesh, schemeData)
94  );
95 
96 
97  // Constructors
98 
99  //- Construct from mesh
100  gradScheme(const fvMesh& mesh)
101  :
102  mesh_(mesh)
103  {}
104 
105 
106  // Selectors
107 
108  //- Return a pointer to a new gradScheme created on freestore
109  static tmp<gradScheme<Type> > New
110  (
111  const fvMesh& mesh,
112  Istream& schemeData
113  );
114 
115 
116  // Destructor
117 
118  virtual ~gradScheme();
119 
120 
121  // Member Functions
122 
123  //- Return mesh reference
124  const fvMesh& mesh() const
125  {
126  return mesh_;
127  }
128 
129  //- Calculate and return the grad of the given field
130  virtual tmp
131  <
134  > grad
135  (
137  ) const = 0;
138 };
139 
140 
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 
143 } // End namespace fv
144 
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 
147 } // End namespace Foam
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 // Add the patch constructor functions to the hash tables
152 
153 #define makeFvGradTypeScheme(SS, Type) \
154  \
155 defineNamedTemplateTypeNameAndDebug(SS<Type>, 0); \
156  \
157 gradScheme<Type>::addIstreamConstructorToTable<SS<Type> > \
158  add##SS##Type##IstreamConstructorToTable_;
159 
160 
161 #define makeFvGradScheme(SS) \
162  \
163 makeFvGradTypeScheme(SS, scalar) \
164 makeFvGradTypeScheme(SS, vector)
165 
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 #ifdef NoRepository
170 # include <finiteVolume/gradScheme.C>
171 #endif
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 #endif
176 
177 // ************************ vim: set sw=4 sts=4 et: ************************ //