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