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 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"
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 protected:
75 
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 
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),
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  (
137  );
138  }
139  }
140 
141 
142  // Selectors
143 
144  //- Return a pointer to a new divScheme created on freestore
145  static tmp<divScheme<Type>> New
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_;
162  }
163 
164  virtual tmp
165  <
166  GeometricField
167  <typename innerProduct<vector, Type>::type, fvPatchField, volMesh>
168  > fvcDiv
169  (
171  ) = 0;
172 };
173 
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  \
201 makeFvDivTypeScheme(SS, vector) \
202 makeFvDivTypeScheme(SS, sphericalTensor) \
203 makeFvDivTypeScheme(SS, symmTensor) \
204 makeFvDivTypeScheme(SS, tensor)
205 
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 #ifdef NoRepository
210  #include "divScheme.C"
211 #endif
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 #endif
216 
217 // ************************************************************************* //
divScheme(const divScheme &)=delete
No copy construct.
Abstract base class for div schemes.
Definition: divScheme.H:65
tmp< surfaceInterpolationScheme< Type > > tinterpScheme_
Definition: divScheme.H:75
Reference counter for various OpenFOAM components.
Definition: refCount.H:44
Forwards and collection of common volume field types.
void operator=(const divScheme &)=delete
No copy assignment.
Central-differencing interpolation scheme class.
Definition: linear.H:51
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
declareRunTimeSelectionTable(tmp, divScheme, Istream,(const fvMesh &mesh, Istream &schemeData),(mesh, schemeData))
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:44
const fvMesh & mesh_
Definition: divScheme.H:73
A class for handling words, derived from Foam::string.
Definition: word.H:63
labelList fv(nPoints)
const fvMesh & mesh() const
Return mesh reference.
Definition: divScheme.H:170
virtual const word & type() const =0
Runtime type information.
Basic run-time type information using word as the type&#39;s name. Used to enhance the standard RTTI to c...
virtual ~divScheme()=default
Destructor.
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: HashPtrTable.H:50
typeOfRank< typename pTraits< vector >::cmptType, direction(pTraits< vector >::rank)+direction(pTraits< Type >::rank) - 2 >::type type
Definition: products.H:155
Abstract base class for surface interpolation schemes.
bool eof() const noexcept
True if end of input seen.
Definition: IOstream.H:289
Namespace for OpenFOAM.