faGradScheme.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::gradScheme
28 
29 Description
30  Abstract base class for finite area calculus gradient schemes.
31 
32 SourceFiles
33  faGradScheme.C
34  faGradSchemes.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef faGradScheme_H
39 #define faGradScheme_H
40 
41 #include "tmp.H"
42 #include "areaFieldsFwd.H"
43 #include "edgeFieldsFwd.H"
44 #include "typeInfo.H"
45 #include "runTimeSelectionTables.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 class faMesh;
53 
54 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 
56 namespace fa
57 {
58 
59 /*---------------------------------------------------------------------------*\
60  Class gradScheme Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 template<class Type>
64 class gradScheme
65 :
66  public refCount
67 {
68  // Private data
69 
70  const faMesh& mesh_;
71 
72 
73  // Private Member Functions
74 
75  //- No copy construct
76  gradScheme(const gradScheme&) = delete;
77 
78  //- No copy assignment
79  void operator=(const gradScheme&) = delete;
80 
81 
82 public:
83 
84  // Declare run-time constructor selection tables
85 
87  (
88  tmp,
89  gradScheme,
90  Istream,
91  (const faMesh& mesh, Istream& schemeData),
92  (mesh, schemeData)
93  );
94 
95 
96  // Constructors
97 
98  //- Construct from mesh
99  gradScheme(const faMesh& mesh)
100  :
101  mesh_(mesh)
102  {}
103 
104 
105  // Selectors
106 
107  //- Return a pointer to a new gradScheme created on freestore
108  static tmp<gradScheme<Type>> New
109  (
110  const faMesh& mesh,
111  Istream& schemeData
112  );
113 
114 
115  //- Destructor
116  virtual ~gradScheme();
117 
118 
119  // Member Functions
120 
121  //- Return mesh reference
122  const faMesh& mesh() const
123  {
124  return mesh_;
125  }
126 
127  //- Calculate and return the grad of the given field
128  virtual tmp
129  <
132  > grad
133  (
135  ) const = 0;
136 };
137 
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 } // End namespace fa
142 
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 
145 } // End namespace Foam
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 // Add the patch constructor functions to the hash tables
150 
151 #define makeFaGradTypeScheme(SS, Type) \
152  \
153  defineNamedTemplateTypeNameAndDebug(Foam::fa::SS<Foam::Type>, 0); \
154  \
155  namespace Foam \
156  { \
157  namespace fa \
158  { \
159  gradScheme<Type>::addIstreamConstructorToTable<SS<Type>> \
160  add##SS##Type##IstreamConstructorToTable_; \
161  } \
162  }
163 
164 
165 #define makeFaGradScheme(SS) \
166  \
167 makeFaGradTypeScheme(SS, scalar) \
168 makeFaGradTypeScheme(SS, vector)
169 
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 #ifdef NoRepository
174  #include "faGradScheme.C"
175 #endif
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 #endif
180 
181 // ************************************************************************* //
Foam::faPatchField
faPatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cover...
Definition: areaFieldsFwd.H:50
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::outerProduct::type
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) >::type type
Definition: products.H:114
Foam::fa::gradScheme::mesh
const faMesh & mesh() const
Return mesh reference.
Definition: faGradScheme.H:121
faGradScheme.C
Foam::fa::gradScheme::~gradScheme
virtual ~gradScheme()
Destructor.
Definition: faGradScheme.C:89
Foam::fa::gradScheme::New
static tmp< gradScheme< Type > > New(const faMesh &mesh, Istream &schemeData)
Return a pointer to a new gradScheme created on freestore.
Definition: faGradScheme.C:46
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
areaFieldsFwd.H
Forwards and collection of common area field types.
Foam::areaMesh
Mesh data needed to do the Finite Area discretisation.
Definition: areaFaMesh.H:53
Foam::fa::gradScheme
Abstract base class for finite area calculus gradient schemes.
Definition: faGradScheme.H:63
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
tmp.H
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::fa::gradScheme::gradScheme
gradScheme(const faMesh &mesh)
Construct from mesh.
Definition: faGradScheme.H:98
Foam::fa::gradScheme::declareRunTimeSelectionTable
declareRunTimeSelectionTable(tmp, gradScheme, Istream,(const faMesh &mesh, Istream &schemeData),(mesh, schemeData))
Foam::faMesh
Finite area mesh. Used for 2-D non-Euclidian finite area method.
Definition: faMesh.H:82
Foam::fa::gradScheme::grad
virtual tmp< GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh > > grad(const GeometricField< Type, faPatchField, areaMesh > &) const =0
Calculate and return the grad of the given field.
Foam::GeometricField
Generic GeometricField class.
Definition: areaFieldsFwd.H:53
edgeFieldsFwd.H
Forwards for edge field types.