FreeFOAM The Cross-Platform CFD Toolkit
snGradScheme.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::snGradScheme
26 
27 Description
28  Abstract base class for snGrad schemes.
29 
30 SourceFiles
31  snGradScheme.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef snGradScheme_H
36 #define snGradScheme_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 snGradScheme Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 template<class Type>
62 :
63  public refCount
64 {
65  // Private data
66 
67  //- Hold reference to mesh
68  const fvMesh& mesh_;
69 
70 
71  // Private Member Functions
72 
73  //- Disallow default bitwise assignment
74  void operator=(const snGradScheme&);
75 
76 
77 public:
78 
79  //- Runtime type information
80  virtual const word& type() const = 0;
81 
82 
83  // Declare run-time constructor selection tables
84 
86  (
87  tmp,
89  Mesh,
90  (const fvMesh& mesh, Istream& schemeData),
91  (mesh, schemeData)
92  );
93 
94 
95  // Constructors
96 
97  //- Construct from mesh
98  snGradScheme(const fvMesh& mesh)
99  :
100  mesh_(mesh)
101  {}
102 
103 
104  // Selectors
105 
106  //- Return new tmp interpolation scheme
107  static tmp<snGradScheme<Type> > New
108  (
109  const fvMesh& mesh,
110  Istream& schemeData
111  );
112 
113 
114  // Destructor
115 
116  virtual ~snGradScheme();
117 
118 
119  // Member Functions
120 
121  //- Return mesh reference
122  const fvMesh& mesh() const
123  {
124  return mesh_;
125  }
126 
127 
128  //- Return the snGrad of the given cell field with the given deltaCoeffs
130  snGrad
131  (
134  const word& snGradName = "snGrad"
135  );
136 
137  //- Return the interpolation weighting factors for the given field
139  (
141  ) const = 0;
142 
143  //- Return true if this scheme uses an explicit correction
144  virtual bool corrected() const
145  {
146  return false;
147  }
148 
149  //- Return the explicit correction to the snGrad
150  // for the given field
153  {
155  }
156 
157  //- Return the snGrad of the given cell field
158  // with explicit correction
161 
162  //- Return the snGrad of the given tmp cell field
163  // with explicit correction
165  snGrad
166  (
168  ) const;
169 };
170 
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 } // End namespace fv
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 } // End namespace Foam
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 // Add the patch constructor functions to the hash tables
183 
184 #define makeSnGradTypeScheme(SS, Type) \
185  \
186 defineNamedTemplateTypeNameAndDebug(SS<Type>, 0); \
187  \
188 snGradScheme<Type>::addMeshConstructorToTable<SS<Type> > \
189  add##SS##Type##MeshConstructorToTable_;
190 
191 #define makeSnGradScheme(SS) \
192  \
193 makeSnGradTypeScheme(SS, scalar) \
194 makeSnGradTypeScheme(SS, vector) \
195 makeSnGradTypeScheme(SS, sphericalTensor) \
196 makeSnGradTypeScheme(SS, symmTensor) \
197 makeSnGradTypeScheme(SS, tensor)
198 
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 #ifdef NoRepository
203 # include <finiteVolume/snGradScheme.C>
204 #endif
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 #endif
209 
210 // ************************ vim: set sw=4 sts=4 et: ************************ //