snGradScheme.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 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 public:
72 
73  //- Runtime type information
74  virtual const word& type() const = 0;
75 
76 
77  // Declare run-time constructor selection tables
78 
80  (
81  tmp,
83  Mesh,
84  (const fvMesh& mesh, Istream& schemeData),
85  (mesh, schemeData)
86  );
87 
88 
89  // Constructors
90 
91  //- Construct from mesh
92  snGradScheme(const fvMesh& mesh)
93  :
94  mesh_(mesh)
95  {}
96 
97  //- Disallow default bitwise copy construction
98  snGradScheme(const snGradScheme&);
99 
100 
101  // Selectors
102 
103  //- Return new tmp interpolation scheme
105  (
106  const fvMesh& mesh,
107  Istream& schemeData
108  );
109 
110 
111  //- Destructor
112  virtual ~snGradScheme();
113 
114 
115  // Member Functions
116 
117  //- Return mesh reference
118  const fvMesh& mesh() const
119  {
120  return mesh_;
121  }
122 
123 
124  //- Return the snGrad of the given cell field with the given deltaCoeffs
126  snGrad
127  (
130  const word& snGradName = "snGrad"
131  );
132 
133  //- Return the sndGrad of the given cell field
135  sndGrad
136  (
138  const word& snGradName = "sndGrad"
139  );
140 
141  //- Return the interpolation weighting factors for the given field
143  (
145  ) const = 0;
146 
147  //- Return true if this scheme uses an explicit correction
148  virtual bool corrected() const
149  {
150  return false;
151  }
152 
153  //- Return the explicit correction to the snGrad
154  // for the given field
157  {
159  (
160  nullptr
161  );
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  // Member Operators
179 
180  //- Disallow default bitwise assignment
181  void operator=(const snGradScheme&) = delete;
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:155
void operator=(const snGradScheme &)=delete
Disallow default bitwise assignment.
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:158
virtual bool corrected() const
Return true if this scheme uses an explicit correction.
Definition: snGradScheme.H:147
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))
snGradScheme(const fvMesh &mesh)
Construct from mesh.
Definition: snGradScheme.H:91
Abstract base class for snGrad schemes.
Definition: snGradScheme.H:60
const fvMesh & mesh() const
Return mesh reference.
Definition: snGradScheme.H:117
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.