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-2022 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),
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 
139  (
140  const VolField<Type>&
141  ) = 0;
142 
143 
144  // Member Operators
145 
146  //- Disallow default bitwise assignment
147  void operator=(const divScheme&) = delete;
148 };
149 
150 
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 
153 } // End namespace fv
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 } // End namespace Foam
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 // Add the patch constructor functions to the hash tables
162 
163 #define makeFvDivTypeScheme(SS, Type) \
164  defineNamedTemplateTypeNameAndDebug(Foam::fv::SS<Foam::Type>, 0); \
165  \
166  namespace Foam \
167  { \
168  namespace fv \
169  { \
170  divScheme<Type>::addIstreamConstructorToTable<SS<Type>> \
171  add##SS##Type##IstreamConstructorToTable_; \
172  } \
173  }
174 
175 #define makeFvDivScheme(SS) \
176  \
177 makeFvDivTypeScheme(SS, vector) \
178 makeFvDivTypeScheme(SS, sphericalTensor) \
179 makeFvDivTypeScheme(SS, symmTensor) \
180 makeFvDivTypeScheme(SS, tensor)
181 
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 #ifdef NoRepository
186  #include "divScheme.C"
187 #endif
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 #endif
192 
193 // ************************************************************************* //
Generic GeometricField class.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:60
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:101
Abstract base class for div schemes.
Definition: divScheme.H:67
virtual const word & type() const =0
Runtime type information.
const fvMesh & mesh_
Definition: divScheme.H:73
const fvMesh & mesh() const
Return mesh reference.
Definition: divScheme.H:132
tmp< surfaceInterpolationScheme< Type > > tinterpScheme_
Definition: divScheme.H:74
void operator=(const divScheme &)=delete
Disallow default bitwise assignment.
declareRunTimeSelectionTable(tmp, divScheme, Istream,(const fvMesh &mesh, Istream &schemeData),(mesh, schemeData))
virtual tmp< VolField< typename innerProduct< vector, Type >::type > > fvcDiv(const VolField< Type > &)=0
virtual ~divScheme()
Destructor.
Definition: divScheme.C:92
static tmp< divScheme< Type > > New(const fvMesh &mesh, Istream &schemeData)
Return a pointer to a new divScheme created on freestore.
Definition: divScheme.C:47
divScheme(const fvMesh &mesh)
Construct from mesh.
Definition: divScheme.H:98
Centred interpolation interpolation scheme class.
Definition: linear.H:53
Reference counter for various OpenFOAM components.
Definition: refCount.H:50
Abstract base class for surface interpolation schemes.
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:62
Abstract base class for finite volume calculus div schemes.
Namespace for OpenFOAM.
labelList fv(nPoints)
Macros to ease declaration of run-time selection tables.