Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::fv::divScheme
28
29Group
30 grpFvDivSchemes
31
32Description
33 Abstract base class for div schemes.
34
35SourceFiles
36 divScheme.C
37
38\*---------------------------------------------------------------------------*/
39
40#ifndef Foam_divScheme_H
41#define Foam_divScheme_H
42
43#include "tmp.H"
44#include "volFieldsFwd.H"
45#include "surfaceFieldsFwd.H"
46#include "linear.H"
47#include "typeInfo.H"
49
50// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51
52namespace Foam
53{
54
55template<class Type>
56class fvMatrix;
57
58class fvMesh;
59
60// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61
62namespace fv
63{
64
65/*---------------------------------------------------------------------------*\
66 Class divScheme Declaration
67\*---------------------------------------------------------------------------*/
68
69template<class Type>
70class divScheme
71:
72 public refCount
74protected:
76 // Protected data
77
78 const fvMesh& mesh_;
79
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
92public:
93
94 //- Runtime type information
95 virtual const word& type() const = 0;
97
98 // Declare run-time constructor selection tables
99
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),
117 {}
118
119 //- Construct from mesh and Istream
120 divScheme(const fvMesh& mesh, Istream& is)
121 :
122 mesh_(mesh),
123 tinterpScheme_(nullptr)
124 {
125 if (is.eof())
126 {
127 tinterpScheme_.reset
128 (
129 new linear<Type>(mesh)
130 );
131 }
132 else
133 {
134 tinterpScheme_.reset
135 (
136 surfaceInterpolationScheme<Type>::New(mesh, is)
137 );
138 }
139 }
140
141
142 // Selectors
143
144 //- Return a pointer to a new divScheme created on freestore
146 (
147 const fvMesh& mesh,
148 Istream& schemeData
149 );
150
151
152 //- Destructor
153 virtual ~divScheme() = default;
154
155
156 // Member Functions
157
158 //- Return mesh reference
159 const fvMesh& mesh() const
160 {
161 return mesh_;
163
164 virtual tmp
165 <
168 > fvcDiv
169 (
174
175// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176
177} // End namespace fv
178
179// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180
181} // End namespace Foam
182
183// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184
185// Add the patch constructor functions to the hash tables
186
187#define makeFvDivTypeScheme(SS, Type) \
188 defineNamedTemplateTypeNameAndDebug(Foam::fv::SS<Foam::Type>, 0); \
189 \
190 namespace Foam \
191 { \
192 namespace fv \
193 { \
194 divScheme<Type>::addIstreamConstructorToTable<SS<Type>> \
195 add##SS##Type##IstreamConstructorToTable_; \
196 } \
197 }
199#define makeFvDivScheme(SS) \
200 \
201makeFvDivTypeScheme(SS, vector) \
202makeFvDivTypeScheme(SS, sphericalTensor) \
203makeFvDivTypeScheme(SS, symmTensor) \
204makeFvDivTypeScheme(SS, tensor)
205
206
207// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208
209#ifdef NoRepository
210 #include "divScheme.C"
211#endif
212
213// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214
215#endif
216
217// ************************************************************************* //
Generic GeometricField class.
bool eof() const noexcept
True if end of input seen.
Definition IOstream.H:289
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition fvMatrix.H:118
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
const fvMesh & mesh_
Definition divScheme.H:73
divScheme(const divScheme &)=delete
No copy construct.
tmp< surfaceInterpolationScheme< Type > > tinterpScheme_
Definition divScheme.H:75
void operator=(const divScheme &)=delete
No copy assignment.
declareRunTimeSelectionTable(tmp, divScheme, Istream,(const fvMesh &mesh, Istream &schemeData),(mesh, schemeData))
virtual ~divScheme()=default
Destructor.
const fvMesh & mesh() const
Return mesh reference.
Definition divScheme.H:170
divScheme(const fvMesh &mesh, Istream &is)
Construct from mesh and Istream.
Definition divScheme.H:125
static tmp< divScheme< Type > > New(const fvMesh &mesh, Istream &schemeData)
Return a pointer to a new divScheme created on freestore.
Definition divScheme.C:44
virtual tmp< GeometricField< typename innerProduct< vector, Type >::type, fvPatchField, volMesh > > fvcDiv(const GeometricField< Type, fvPatchField, volMesh > &)=0
virtual const word & type() const =0
Runtime type information.
divScheme(const fvMesh &mesh)
Construct from mesh.
Definition divScheme.H:116
typeOfRank< typenamepTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) -2 >::type type
Definition products.H:155
Central-differencing interpolation scheme class.
Definition linear.H:54
constexpr refCount() noexcept
Default construct, initializing count to 0.
Definition refCount.H:63
A class for managing temporary objects.
Definition tmp.H:75
Mesh data needed to do the Finite Volume discretisation.
Definition volMesh.H:47
A class for handling words, derived from Foam::string.
Definition word.H:66
dynamicFvMesh & mesh
Abstract base class for finite volume calculus div schemes.
Namespace for finite-volume.
Namespace for OpenFOAM.
Macros to ease declaration of run-time selection tables.
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes).
Basic run-time type information using word as the type's name. Used to enhance the standard RTTI to c...
Forwards and collection of common volume field types.