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-2015 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 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  virtual ~snGradScheme();
116 
117 
118  // Member Functions
119 
120  //- Return mesh reference
121  const fvMesh& mesh() const
122  {
123  return mesh_;
124  }
125 
126 
127  //- Return the snGrad of the given cell field with the given deltaCoeffs
129  snGrad
130  (
133  const word& snGradName = "snGrad"
134  );
135 
136  //- Return the sndGrad of the given cell field
138  sndGrad
139  (
141  const word& snGradName = "sndGrad"
142  );
143 
144  //- Return the interpolation weighting factors for the given field
146  (
148  ) const = 0;
149 
150  //- Return true if this scheme uses an explicit correction
151  virtual bool corrected() const
152  {
153  return false;
154  }
155 
156  //- Return the explicit correction to the snGrad
157  // for the given field
160  {
162  }
163 
164  //- Return the snGrad of the given cell field
165  // with explicit correction
168 
169  //- Return the snGrad of the given tmp cell field
170  // with explicit correction
172  snGrad
173  (
175  ) const;
176 };
177 
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 } // End namespace fv
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 } // End namespace Foam
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 // Add the patch constructor functions to the hash tables
190 
191 #define makeSnGradTypeScheme(SS, Type) \
192  defineNamedTemplateTypeNameAndDebug(Foam::fv::SS<Foam::Type>, 0); \
193  \
194  namespace Foam \
195  { \
196  namespace fv \
197  { \
198  snGradScheme<Type>::addMeshConstructorToTable<SS<Type> > \
199  add##SS##Type##MeshConstructorToTable_; \
200  } \
201  }
202 
203 #define makeSnGradScheme(SS) \
204  \
205 makeSnGradTypeScheme(SS, scalar) \
206 makeSnGradTypeScheme(SS, vector) \
207 makeSnGradTypeScheme(SS, sphericalTensor) \
208 makeSnGradTypeScheme(SS, symmTensor) \
209 makeSnGradTypeScheme(SS, tensor)
210 
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 #ifdef NoRepository
215 # include "snGradScheme.C"
216 #endif
217 
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 #endif
221 
222 // ************************************************************************* //
volFieldsFwd.H
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::fv::snGradScheme::snGradScheme
snGradScheme(const fvMesh &mesh)
Construct from mesh.
Definition: snGradScheme.H:97
typeInfo.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::fv::snGradScheme::declareRunTimeSelectionTable
declareRunTimeSelectionTable(tmp, snGradScheme, Mesh,(const fvMesh &mesh, Istream &schemeData),(mesh, schemeData))
Foam::refCount
Reference counter for various OpenFOAM components.
Definition: refCount.H:45
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::fv::snGradScheme::operator=
void operator=(const snGradScheme &)
Disallow default bitwise assignment.
Foam::fv::snGradScheme::~snGradScheme
virtual ~snGradScheme()
Destructor.
Definition: snGradScheme.C:94
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
fv
labelList fv(nPoints)
Foam::fv::snGradScheme::mesh
const fvMesh & mesh() const
Return mesh reference.
Definition: snGradScheme.H:120
tmp.H
Foam::fv::snGradScheme::corrected
virtual bool corrected() const
Return true if this scheme uses an explicit correction.
Definition: snGradScheme.H:150
Foam::fv::snGradScheme::mesh_
const fvMesh & mesh_
Hold reference to mesh.
Definition: snGradScheme.H:67
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::fv::snGradScheme::type
virtual const word & type() const =0
Runtime type information.
surfaceFieldsFwd.H
Foam::fv::snGradScheme
Abstract base class for snGrad schemes.
Definition: snGradScheme.H:60
Foam::fv::snGradScheme::New
static tmp< snGradScheme< Type > > New(const fvMesh &mesh, Istream &schemeData)
Return new tmp interpolation scheme.
Definition: snGradScheme.C:46
Foam::fv::snGradScheme::correction
virtual tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > correction(const GeometricField< Type, fvPatchField, volMesh > &) const
Return the explicit correction to the snGrad.
Definition: snGradScheme.H:158
Foam::fv::snGradScheme::snGrad
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:103
Foam::fv::snGradScheme::deltaCoeffs
virtual tmp< surfaceScalarField > deltaCoeffs(const GeometricField< Type, fvPatchField, volMesh > &) const =0
Return the interpolation weighting factors for the given field.
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
snGradScheme.C
Foam::fv::snGradScheme::sndGrad
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