lnGradScheme.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2016-2017 Wikki Ltd
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::fa::lnGradScheme
28 
29 Description
30  Abstract base class for lnGrad schemes.
31 
32 SourceFiles
33  lnGradScheme.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef lnGradScheme_H
38 #define lnGradScheme_H
39 
40 #include "areaFieldsFwd.H"
41 #include "edgeFieldsFwd.H"
42 #include "runTimeSelectionTables.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 // Forward Declarations
50 class faMesh;
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace fa
55 {
56 
57 /*---------------------------------------------------------------------------*\
58  Class lnGradScheme Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 template<class Type>
62 class lnGradScheme
63 :
64  public refCount
65 {
66  // Private Data
67 
68  //- Hold reference to mesh
69  const faMesh& mesh_;
70 
71 
72 public:
73 
74  // Declare run-time constructor selection tables
75 
77  (
78  tmp,
80  Mesh,
81  (const faMesh& mesh, Istream& schemeData),
82  (mesh, schemeData)
83  );
84 
85 
86  // Generated Methods
87 
88  //- No copy construct
89  lnGradScheme(const lnGradScheme&) = delete;
90 
91  //- No copy assignment
92  void operator=(const lnGradScheme&) = delete;
93 
94 
95  // Constructors
96 
97  //- Construct from mesh
98  lnGradScheme(const faMesh& mesh)
99  :
100  mesh_(mesh)
101  {}
102 
103 
104  // Selectors
105 
106  //- Return new tmp interpolation scheme
108  (
109  const faMesh& mesh,
110  Istream& schemeData
111  );
112 
113 
114  //- Destructor
115  virtual ~lnGradScheme();
116 
117 
118  // Member Functions
119 
120  //- Return mesh reference
121  const faMesh& mesh() const noexcept { return mesh_; }
122 
123  //- Return the lnGrad of the given cell field
124  // with the given weighting factors
126  lnGrad
127  (
129  const tmp<edgeScalarField>&,
130  const word& snGradName = "lnGrad"
131  );
132 
133  //- Return the interpolation weighting factors for the given field
135  (
137  ) const = 0;
138 
139  //- Return true if this scheme uses an explicit correction
140  virtual bool corrected() const { return false; }
141 
142  //- Return the explicit correction to the lnGrad
143  // for the given field
146  {
147  return nullptr;
148  }
149 
150  //- Return the lnGrad of the given cell field
151  // with explicit correction
154 
155  //- Return the lnGrad of the given tmp cell field
156  // with explicit correction
158  lnGrad
159  (
161  ) const;
162 };
163 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 } // End namespace fa
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 } // End namespace Foam
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 // Add the patch constructor functions to the hash tables
176 
177 #define makeLnGradTypeScheme(SS, Type) \
178  \
179  defineNamedTemplateTypeNameAndDebug(Foam::fa::SS<Foam::Type>, 0); \
180  \
181  namespace Foam \
182  { \
183  namespace fa \
184  { \
185  lnGradScheme<Type>::addMeshConstructorToTable<SS<Type>> \
186  add##SS##Type##MeshConstructorToTable_; \
187  } \
188  }
189 
190 #define makeLnGradScheme(SS) \
191  \
192 makeLnGradTypeScheme(SS, scalar) \
193 makeLnGradTypeScheme(SS, vector) \
194 makeLnGradTypeScheme(SS, tensor)
195 
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 #ifdef NoRepository
200  #include "lnGradScheme.C"
201 #endif
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 #endif
206 
207 // ************************************************************************* //
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition: faMesh.H:133
Reference counter for various OpenFOAM components.
Definition: refCount.H:44
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
Generic GeometricField class.
virtual bool corrected() const
Return true if this scheme uses an explicit correction.
Definition: lnGradScheme.H:156
const faMesh & mesh() const noexcept
Return mesh reference.
Definition: lnGradScheme.H:130
virtual ~lnGradScheme()
Destructor.
Definition: lnGradScheme.C:84
Abstract base class for lnGrad schemes.
Definition: lnGradScheme.H:57
void operator=(const lnGradScheme &)=delete
No copy assignment.
declareRunTimeSelectionTable(tmp, lnGradScheme, Mesh,(const faMesh &mesh, Istream &schemeData),(mesh, schemeData))
Forwards for edge field types.
A class for handling words, derived from Foam::string.
Definition: word.H:63
lnGradScheme(const lnGradScheme &)=delete
No copy construct.
static tmp< lnGradScheme< Type > > New(const faMesh &mesh, Istream &schemeData)
Return new tmp interpolation scheme.
Definition: lnGradScheme.C:41
static tmp< GeometricField< Type, faePatchField, edgeMesh > > lnGrad(const GeometricField< Type, faPatchField, areaMesh > &, const tmp< edgeScalarField > &, const word &snGradName="lnGrad")
Return the lnGrad of the given cell field.
Definition: lnGradScheme.C:93
virtual tmp< GeometricField< Type, faePatchField, edgeMesh > > correction(const GeometricField< Type, faPatchField, areaMesh > &) const
Return the explicit correction to the lnGrad.
Definition: lnGradScheme.H:164
const direction noexcept
Definition: scalarImpl.H:255
Macros to ease declaration of run-time selection tables.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
virtual tmp< edgeScalarField > deltaCoeffs(const GeometricField< Type, faPatchField, areaMesh > &) const =0
Return the interpolation weighting factors for the given field.
Forwards and collection of common area field types.
Namespace for OpenFOAM.