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) 2011-2016 OpenFOAM Foundation
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 "tmp.H"
39 #include "volFieldsFwd.H"
40 #include "surfaceFieldsFwd.H"
41 #include "typeInfo.H"
42 #include "runTimeSelectionTables.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>
61 class snGradScheme
62 :
63  public tmp<snGradScheme<Type>>::refCount
64 {
65  // Private data
66 
67  //- Hold reference to mesh
68  const fvMesh& mesh_;
69 
70 
71  // Private Member Functions
72 
73  //- Disallow copy construct
74  snGradScheme(const snGradScheme&);
75 
76  //- Disallow default bitwise assignment
77  void operator=(const snGradScheme&);
78 
79 
80 public:
81 
82  //- Runtime type information
83  virtual const word& type() const = 0;
84 
85 
86  // Declare run-time constructor selection tables
87 
89  (
90  tmp,
92  Mesh,
93  (const fvMesh& mesh, Istream& schemeData),
94  (mesh, schemeData)
95  );
96 
97 
98  // Constructors
99 
100  //- Construct from mesh
101  snGradScheme(const fvMesh& mesh)
102  :
103  mesh_(mesh)
104  {}
105 
106 
107  // Selectors
108 
109  //- Return new tmp interpolation scheme
111  (
112  const fvMesh& mesh,
113  Istream& schemeData
114  );
115 
116 
117  //- Destructor
118  virtual ~snGradScheme();
119 
120 
121  // Member Functions
122 
123  //- Return mesh reference
124  const fvMesh& mesh() const
125  {
126  return mesh_;
127  }
128 
129 
130  //- Return the snGrad of the given cell field with the given deltaCoeffs
132  snGrad
133  (
136  const word& snGradName = "snGrad"
137  );
138 
139  //- Return the sndGrad of the given cell field
141  sndGrad
142  (
144  const word& snGradName = "sndGrad"
145  );
146 
147  //- Return the interpolation weighting factors for the given field
149  (
151  ) const = 0;
152 
153  //- Return true if this scheme uses an explicit correction
154  virtual bool corrected() const
155  {
156  return false;
157  }
158 
159  //- Return the explicit correction to the snGrad
160  // for the given field
163  {
165  (
166  nullptr
167  );
168  }
169 
170  //- Return the snGrad of the given cell field
171  // with explicit correction
174 
175  //- Return the snGrad of the given tmp cell field
176  // with explicit correction
178  snGrad
179  (
181  ) const;
182 };
183 
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 } // End namespace fv
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 } // End namespace Foam
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 // Add the patch constructor functions to the hash tables
197 #define makeSnGradTypeScheme(SS, Type) \
198  defineNamedTemplateTypeNameAndDebug(Foam::fv::SS<Foam::Type>, 0); \
199  \
200  namespace Foam \
201  { \
202  namespace fv \
203  { \
204  snGradScheme<Type>::addMeshConstructorToTable<SS<Type>> \
205  add##SS##Type##MeshConstructorToTable_; \
206  } \
207  }
209 #define makeSnGradScheme(SS) \
210  \
211 makeSnGradTypeScheme(SS, scalar) \
212 makeSnGradTypeScheme(SS, vector) \
213 makeSnGradTypeScheme(SS, sphericalTensor) \
214 makeSnGradTypeScheme(SS, symmTensor) \
215 makeSnGradTypeScheme(SS, tensor)
216 
217 
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 #ifdef NoRepository
221  #include "snGradScheme.C"
222 #endif
223 
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 
226 #endif
227 
228 // ************************************************************************* //
virtual tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > correction(const GeometricField< Type, fvPatchField, volMesh > &) const
Return the explicit correction to the snGrad.
Definition: snGradScheme.H:161
static tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &, const tmp< surfaceScalarField > &, const word &snGradName="snGrad")
Return the snGrad of the given cell field with the given deltaCoeffs.
Definition: snGradScheme.C:101
Reference counter for various OpenFOAM components.
Definition: refCount.H:49
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
static tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > sndGrad(const GeometricField< Type, fvPatchField, volMesh > &, const word &snGradName="sndGrad")
Return the sndGrad of the given cell field.
Definition: snGradScheme.C:165
virtual bool corrected() const
Return true if this scheme uses an explicit correction.
Definition: snGradScheme.H:153
Generic GeometricField class.
static tmp< snGradScheme< Type > > New(const fvMesh &mesh, Istream &schemeData)
Return new tmp interpolation scheme.
Definition: snGradScheme.C:46
virtual tmp< surfaceScalarField > deltaCoeffs(const GeometricField< Type, fvPatchField, volMesh > &) const =0
Return the interpolation weighting factors for the given field.
A class for handling words, derived from string.
Definition: word.H:59
labelList fv(nPoints)
virtual const word & type() const =0
Runtime type information.
declareRunTimeSelectionTable(tmp, snGradScheme, Mesh,(const fvMesh &mesh, Istream &schemeData),(mesh, schemeData))
Abstract base class for snGrad schemes.
Definition: snGradScheme.H:60
const fvMesh & mesh() const
Return mesh reference.
Definition: snGradScheme.H:123
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Macros to ease declaration of run-time selection tables.
A class for managing temporary objects.
Definition: PtrList.H:53
virtual ~snGradScheme()
Destructor.
Definition: snGradScheme.C:92
Namespace for OpenFOAM.