faDivScheme.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) 2016-2017 Wikki Ltd
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::fa::divScheme
28 
29 Description
30  Abstract base class for finite area calculus div schemes.
31 
32 SourceFiles
33  faDivScheme.C
34  faDivSchemes.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef Foam_faDivScheme_H
39 #define Foam_faDivScheme_H
40 
41 #include "areaFieldsFwd.H"
42 #include "edgeFieldsFwd.H"
44 #include "runTimeSelectionTables.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 // Forward Declarations
52 template<class Type> class faMatrix;
53 class faMesh;
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 namespace fa
58 {
59 
60 /*---------------------------------------------------------------------------*\
61  Class divScheme Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 template<class Type>
65 class divScheme
66 :
67  public refCount
68 {
69 protected:
70 
71  // Protected Data
72 
73  //- Reference to mesh
74  const faMesh& mesh_;
75 
76  //- Edge interpolation scheme
78 
79 
80 public:
81 
82  // Declare run-time constructor selection tables
83 
85  (
86  tmp,
87  divScheme,
88  Istream,
89  (const faMesh& mesh, Istream& schemeData),
90  (mesh, schemeData)
91  );
92 
93 
94  // Generated Methods
95 
96  //- No copy construct
97  divScheme(const divScheme&) = delete;
98 
99  //- No copy assignment
100  void operator=(const divScheme&) = delete;
101 
102 
103  // Constructors
104 
105  //- Construct from mesh
106  divScheme(const faMesh& mesh)
107  :
108  mesh_(mesh),
110  {}
112  //- Construct from mesh and Istream
113  divScheme(const faMesh& mesh, Istream& is)
114  :
115  mesh_(mesh)
116  {
117  if (is.eof())
118  {
119  tinterpScheme_.reset
120  (
122  );
123  }
124  else
125  {
126  tinterpScheme_.reset
127  (
129  );
130  }
131  }
132 
133 
134  // Selectors
135 
136  //- Return a pointer to a new divScheme created on freestore
137  static tmp<divScheme<Type>> New
138  (
139  const faMesh& mesh,
140  Istream& schemeData
141  );
142 
143 
144  //- Destructor
145  virtual ~divScheme() = default;
146 
147 
148  // Member Functions
149 
150  //- Return mesh reference
151  const faMesh& mesh() const noexcept { return mesh_; }
152 
153  virtual tmp
154  <
155  GeometricField
156  <typename innerProduct<vector, Type>::type, faPatchField, areaMesh>
157  > facDiv
158  (
159  const GeometricField<Type, faPatchField, areaMesh>&
160  ) = 0;
161 };
162 
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 } // End namespace fa
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 } // End namespace Foam
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 // Add the patch constructor functions to the hash tables
175 
176 #define makeFaDivTypeScheme(SS, Type) \
177  \
178  defineNamedTemplateTypeNameAndDebug(Foam::fa::SS<Foam::Type>, 0); \
179  \
180  namespace Foam \
181  { \
182  namespace fa \
183  { \
184  divScheme<Type>::addIstreamConstructorToTable<SS<Type>> \
185  add##SS##Type##IstreamConstructorToTable_; \
186  } \
187  }
188 
189 #define makeFaDivScheme(SS) \
190  \
191 makeFaDivTypeScheme(SS, vector) \
192 makeFaDivTypeScheme(SS, tensor)
193 
194 
195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 
197 #ifdef NoRepository
198  #include "faDivScheme.C"
199 #endif
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 #endif
204 
205 // ************************************************************************* //
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition: faMesh.H:133
tmp< edgeInterpolationScheme< Type > > tinterpScheme_
Edge interpolation scheme.
Definition: faDivScheme.H:76
Abstract base class for finite area calculus div schemes.
Definition: faDivScheme.H:60
Reference counter for various OpenFOAM components.
Definition: refCount.H:44
virtual tmp< GeometricField< typename innerProduct< vector, Type >::type, faPatchField, areaMesh > > facDiv(const GeometricField< Type, faPatchField, areaMesh > &)=0
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
Abstract base class for edge interpolation schemes.
declareRunTimeSelectionTable(tmp, divScheme, Istream,(const faMesh &mesh, Istream &schemeData),(mesh, schemeData))
divScheme(const divScheme &)=delete
No copy construct.
Forwards for edge field types.
virtual ~divScheme()=default
Destructor.
const direction noexcept
Definition: Scalar.H:258
static tmp< divScheme< Type > > New(const faMesh &mesh, Istream &schemeData)
Return a pointer to a new divScheme created on freestore.
Definition: faDivScheme.C:35
Central-differencing interpolation scheme class.
const faMesh & mesh() const noexcept
Return mesh reference.
Definition: faDivScheme.H:164
Macros to ease declaration of run-time selection tables.
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
bool eof() const noexcept
True if end of input seen.
Definition: IOstream.H:289
const faMesh & mesh_
Reference to mesh.
Definition: faDivScheme.H:71
Forwards and collection of common area field types.
Namespace for OpenFOAM.
void operator=(const divScheme &)=delete
No copy assignment.