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 "tmp.H"
41 #include "areaFieldsFwd.H"
42 #include "edgeFieldsFwd.H"
43 #include "typeInfo.H"
44 #include "runTimeSelectionTables.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 class faMesh;
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 namespace fa
56 {
57 
58 /*---------------------------------------------------------------------------*\
59  Class lnGradScheme Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 template<class Type>
63 class lnGradScheme
64 :
65  public refCount
66 {
67  // Private data
68 
69  //- Hold reference to mesh
70  const faMesh& mesh_;
71 
72 
73  // Private Member Functions
74 
75  //- No copy assignment
76  void operator=(const lnGradScheme&) = delete;
77 
78 
79 public:
80 
81  // Declare run-time constructor selection tables
82 
84  (
85  tmp,
87  Mesh,
88  (const faMesh& mesh, Istream& schemeData),
89  (mesh, schemeData)
90  );
91 
92 
93  // Constructors
94 
95  //- Construct from mesh
96  lnGradScheme(const faMesh& mesh)
97  :
98  mesh_(mesh)
99  {}
100 
101 
102  // Selectors
103 
104  //- Return new tmp interpolation scheme
106  (
107  const faMesh& mesh,
108  Istream& schemeData
109  );
110 
111 
112  //- Destructor
113  virtual ~lnGradScheme();
114 
115 
116  // Member Functions
117 
118  //- Return mesh reference
119  const faMesh& mesh() const
120  {
121  return mesh_;
122  }
123 
124  //- Return the lnGrad of the given cell field
125  // with the given weighting factors
127  lnGrad
128  (
130  const tmp<edgeScalarField>&,
131  const word& snGradName = "lnGrad"
132  );
133 
134  //- Return the interpolation weighting factors for the given field
136  (
138  ) const = 0;
139 
140  //- Return true if this scheme uses an explicit correction
141  virtual bool corrected() const
142  {
143  return false;
144  }
145 
146  //- Return the explicit correction to the lnGrad
147  // for the given field
150  {
151  return nullptr;
152  }
153 
154  //- Return the lnGrad of the given cell field
155  // with explicit correction
158 
159  //- Return the lnGrad of the given tmp cell field
160  // with explicit correction
162  lnGrad
163  (
165  ) const;
166 };
167 
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 } // End namespace fa
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 } // End namespace Foam
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 // Add the patch constructor functions to the hash tables
180 
181 #define makeLnGradTypeScheme(SS, Type) \
182  \
183  defineNamedTemplateTypeNameAndDebug(Foam::fa::SS<Foam::Type>, 0); \
184  \
185  namespace Foam \
186  { \
187  namespace fa \
188  { \
189  lnGradScheme<Type>::addMeshConstructorToTable<SS<Type>> \
190  add##SS##Type##MeshConstructorToTable_; \
191  } \
192  }
193 
194 #define makeLnGradScheme(SS) \
195  \
196 makeLnGradTypeScheme(SS, scalar) \
197 makeLnGradTypeScheme(SS, vector) \
198 makeLnGradTypeScheme(SS, tensor)
199 
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 #ifdef NoRepository
204  #include "lnGradScheme.C"
205 #endif
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 #endif
210 
211 // ************************************************************************* //
Foam::fa::lnGradScheme::lnGrad
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:101
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
typeInfo.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::refCount
Reference counter for various OpenFOAM components.
Definition: refCount.H:50
Foam::fa::lnGradScheme::declareRunTimeSelectionTable
declareRunTimeSelectionTable(tmp, lnGradScheme, Mesh,(const faMesh &mesh, Istream &schemeData),(mesh, schemeData))
Foam::fa::lnGradScheme::correction
virtual tmp< GeometricField< Type, faePatchField, edgeMesh > > correction(const GeometricField< Type, faPatchField, areaMesh > &) const
Return the explicit correction to the lnGrad.
Definition: lnGradScheme.H:148
Foam::fa::lnGradScheme::deltaCoeffs
virtual tmp< edgeScalarField > deltaCoeffs(const GeometricField< Type, faPatchField, areaMesh > &) const =0
Return the interpolation weighting factors for the given field.
Foam::fa::lnGradScheme::mesh
const faMesh & mesh() const
Return mesh reference.
Definition: lnGradScheme.H:118
Foam::fa::lnGradScheme::lnGradScheme
lnGradScheme(const faMesh &mesh)
Construct from mesh.
Definition: lnGradScheme.H:95
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
areaFieldsFwd.H
Forwards and collection of common area field types.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fa::lnGradScheme::~lnGradScheme
virtual ~lnGradScheme()
Destructor.
Definition: lnGradScheme.C:92
tmp.H
Foam::fa::lnGradScheme::New
static tmp< lnGradScheme< Type > > New(const faMesh &mesh, Istream &schemeData)
Return new tmp interpolation scheme.
Definition: lnGradScheme.C:49
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::fa::lnGradScheme::corrected
virtual bool corrected() const
Return true if this scheme uses an explicit correction.
Definition: lnGradScheme.H:140
Foam::faMesh
Finite area mesh. Used for 2-D non-Euclidian finite area method.
Definition: faMesh.H:82
Foam::GeometricField
Generic GeometricField class.
Definition: areaFieldsFwd.H:53
edgeFieldsFwd.H
Forwards for edge field types.
Foam::fa::lnGradScheme
Abstract base class for lnGrad schemes.
Definition: lnGradScheme.H:62
lnGradScheme.C