divScheme.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-2020 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::divScheme
26 
27 Description
28  Abstract base class for div schemes.
29 
30 SourceFiles
31  divScheme.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef divScheme_H
36 #define divScheme_H
37 
38 #include "tmp.H"
39 #include "volFieldsFwd.H"
40 #include "surfaceFieldsFwd.H"
41 #include "linear.H"
42 #include "typeInfo.H"
43 #include "runTimeSelectionTables.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 template<class Type>
51 class fvMatrix;
52 
53 class fvMesh;
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 namespace fv
58 {
59 
60 /*---------------------------------------------------------------------------*\
61  Class divScheme Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 template<class Type>
65 class divScheme
66 :
67  public tmp<divScheme<Type>>::refCount
68 {
69 
70 protected:
71 
72  // Protected data
73 
74  const fvMesh& mesh_;
76 
77 
78 public:
79 
80  //- Runtime type information
81  virtual const word& type() const = 0;
82 
83 
84  // Declare run-time constructor selection tables
85 
87  (
88  tmp,
89  divScheme,
90  Istream,
91  (const fvMesh& mesh, Istream& schemeData),
92  (mesh, schemeData)
93  );
94 
95 
96  // Constructors
97 
98  //- Construct from mesh
99  divScheme(const fvMesh& mesh)
100  :
101  mesh_(mesh),
102  tinterpScheme_(new linear<Type>(mesh))
103  {}
104 
105  //- Construct from mesh and Istream
106  divScheme(const fvMesh& mesh, Istream& is)
107  :
108  mesh_(mesh),
109  tinterpScheme_(surfaceInterpolationScheme<Type>::New(mesh, is))
110  {}
111 
112  //- Disallow default bitwise copy construction
113  divScheme(const divScheme&) = delete;
114 
115 
116  // Selectors
117 
118  //- Return a pointer to a new divScheme created on freestore
119  static tmp<divScheme<Type>> New
120  (
121  const fvMesh& mesh,
122  Istream& schemeData
123  );
124 
125 
126  //- Destructor
127  virtual ~divScheme();
128 
129 
130  // Member Functions
131 
132  //- Return mesh reference
133  const fvMesh& mesh() const
134  {
135  return mesh_;
136  }
137 
138  virtual tmp
139  <
142  > fvcDiv
143  (
145  ) = 0;
146 
147 
148  // Member Operators
149 
150  //- Disallow default bitwise assignment
151  void operator=(const divScheme&) = delete;
152 };
153 
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 } // End namespace fv
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 } // End namespace Foam
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 // Add the patch constructor functions to the hash tables
167 #define makeFvDivTypeScheme(SS, Type) \
168  defineNamedTemplateTypeNameAndDebug(Foam::fv::SS<Foam::Type>, 0); \
169  \
170  namespace Foam \
171  { \
172  namespace fv \
173  { \
174  divScheme<Type>::addIstreamConstructorToTable<SS<Type>> \
175  add##SS##Type##IstreamConstructorToTable_; \
176  } \
177  }
179 #define makeFvDivScheme(SS) \
180  \
181 makeFvDivTypeScheme(SS, vector) \
182 makeFvDivTypeScheme(SS, sphericalTensor) \
183 makeFvDivTypeScheme(SS, symmTensor) \
184 makeFvDivTypeScheme(SS, tensor)
185 
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 #ifdef NoRepository
190  #include "divScheme.C"
191 #endif
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 #endif
196 
197 // ************************************************************************* //
Abstract base class for div schemes.
Definition: divScheme.H:64
tmp< surfaceInterpolationScheme< Type > > tinterpScheme_
Definition: divScheme.H:74
Reference counter for various OpenFOAM components.
Definition: refCount.H:49
void operator=(const divScheme &)=delete
Disallow default bitwise assignment.
Central-differencing interpolation scheme class.
Definition: linear.H:50
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
divScheme(const fvMesh &mesh)
Construct from mesh.
Definition: divScheme.H:98
declareRunTimeSelectionTable(tmp, divScheme, Istream,(const fvMesh &mesh, Istream &schemeData),(mesh, schemeData))
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:66
Generic GeometricField class.
static tmp< divScheme< Type > > New(const fvMesh &mesh, Istream &schemeData)
Return a pointer to a new divScheme created on freestore.
Definition: divScheme.C:47
const fvMesh & mesh_
Definition: divScheme.H:73
Mesh data needed to do the Finite Volume discretisation.
Definition: volMesh.H:53
A class for handling words, derived from string.
Definition: word.H:59
labelList fv(nPoints)
const fvMesh & mesh() const
Return mesh reference.
Definition: divScheme.H:132
virtual const word & type() const =0
Runtime type information.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
virtual tmp< GeometricField< typename innerProduct< vector, Type >::type, fvPatchField, volMesh > > fvcDiv(const GeometricField< Type, fvPatchField, volMesh > &)=0
Macros to ease declaration of run-time selection tables.
Abstract base class for finite volume calculus div schemes.
A class for managing temporary objects.
Definition: PtrList.H:53
virtual ~divScheme()
Destructor.
Definition: divScheme.C:92
Abstract base class for surface interpolation schemes.
Namespace for OpenFOAM.