edgeInterpolationScheme.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::edgeInterpolationScheme
28 
29 Description
30  Abstract base class for edge interpolation schemes.
31 
32 SourceFiles
33  edgeInterpolationScheme.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef edgeInterpolationScheme_H
38 #define edgeInterpolationScheme_H
39 
40 #include "areaFieldsFwd.H"
41 #include "edgeFieldsFwd.H"
42 #include "runTimeSelectionTables.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 class faMesh;
50 
51 /*---------------------------------------------------------------------------*\
52  Class edgeInterpolationScheme Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 template<class Type>
57 :
58  public refCount
59 {
60  // Private Data
61 
62  //- Reference to mesh
63  const faMesh& mesh_;
64 
65 
66 public:
67 
68  // Declare run-time constructor selection tables
69 
71  (
72  tmp,
74  Mesh,
75  (
76  const faMesh& mesh,
77  Istream& schemeData
78  ),
79  (mesh, schemeData)
80  );
81 
83  (
84  tmp,
86  MeshFlux,
87  (
88  const faMesh& mesh,
89  const edgeScalarField& faceFlux,
90  Istream& schemeData
91  ),
92  (mesh, faceFlux, schemeData)
93  );
94 
95 
96  // Private Member Functions
97 
98  //- No copy construct
100 
101  //- No copy assignment
102  void operator=(const edgeInterpolationScheme&) = delete;
103 
104 
105  // Constructors
106 
107  //- Construct from mesh
109  :
110  mesh_(mesh)
111  {}
112 
113 
114  // Selectors
115 
116  //- Return new tmp interpolation scheme
118  (
119  const faMesh& mesh,
120  Istream& schemeData
121  );
122 
123  //- Return new tmp interpolation scheme
125  (
126  const faMesh& mesh,
127  const edgeScalarField& faceFlux,
128  Istream& schemeData
129  );
130 
131 
132  // Destructor
133 
134  virtual ~edgeInterpolationScheme();
135 
136 
137  // Member Functions
138 
139  //- Return mesh reference
140  const faMesh& mesh() const
141  {
142  return mesh_;
143  }
144 
145 
146  //- Return the face-interpolate of the given cell field
147  // with the given owner and neighbour weighting factors
148  static tmp<GeometricField<Type, faePatchField, edgeMesh>>
150  (
152  const tmp<edgeScalarField>&,
153  const tmp<edgeScalarField>&
154  );
155 
156  //- Return the face-interpolate of the given cell field
157  // with the given weighting factors
160  (
162  const tmp<edgeScalarField>&
163  );
164 
165 
166  //- Return the euclidian edge-interpolate of the given area field
167  // with the given weighting factors
170  (
172  const tmp<edgeScalarField>&
173  );
174 
175 
176  //- Return the interpolation weighting factors for the given field
178  (
180  ) const = 0;
181 
182  //- Return true if this scheme uses an explicit correction
183  virtual bool corrected() const { return false; }
184 
185  //- Return the explicit correction to the face-interpolate
186  // for the given field
189  {
190  return nullptr;
191  }
192 
193  //- Return the face-interpolate of the given cell field
194  // with explicit correction
195  virtual tmp<GeometricField<Type, faePatchField, edgeMesh>>
196  interpolate(const GeometricField<Type, faPatchField, areaMesh>&) const;
197 
198  //- Return the euclidian edge-interpolate of the given area field
199  // without explicit correction
200  virtual tmp<GeometricField<Type, faePatchField, edgeMesh>>
202  (
203  const GeometricField<Type, faPatchField, areaMesh>&
204  ) const;
206  //- Return the face-interpolate of the given tmp cell field
207  // with explicit correction
210  (
212  ) const;
213 };
214 
215 
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 
218 } // End namespace Foam
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 // Add the patch constructor functions to the hash tables
223 
224 #define makeEdgeInterpolationTypeScheme(SS, Type) \
225  \
226 defineNamedTemplateTypeNameAndDebug(SS<Type>, 0); \
227  \
228 edgeInterpolationScheme<Type>::addMeshConstructorToTable<SS<Type>> \
229  add##SS##Type##MeshConstructorToTable_; \
230  \
231 edgeInterpolationScheme<Type>::addMeshFluxConstructorToTable<SS<Type>> \
232  add##SS##Type##MeshFluxConstructorToTable_;
233 
234 #define makeEdgeInterpolationScheme(SS) \
235  \
236 makeEdgeInterpolationTypeScheme(SS, scalar) \
237 makeEdgeInterpolationTypeScheme(SS, vector) \
238 makeEdgeInterpolationTypeScheme(SS, tensor)
239 
240 
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 
243 #ifdef NoRepository
244  #include "edgeInterpolationScheme.C"
245 #endif
246 
247 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
248 
249 #endif
250 
251 // ************************************************************************* //
virtual tmp< edgeScalarField > weights(const GeometricField< Type, faPatchField, areaMesh > &) const =0
Return the interpolation weighting factors for the given field.
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition: faMesh.H:133
static tmp< GeometricField< Type, faePatchField, edgeMesh > > euclidianInterpolate(const GeometricField< Type, faPatchField, areaMesh > &, const tmp< edgeScalarField > &)
Return the euclidian edge-interpolate of the given area field.
Reference counter for various OpenFOAM components.
Definition: refCount.H:44
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, edgeInterpolationScheme, Mesh,(const faMesh &mesh, Istream &schemeData),(mesh, schemeData))
static tmp< edgeInterpolationScheme< Type > > New(const faMesh &mesh, Istream &schemeData)
Return new tmp interpolation scheme.
edgeInterpolationScheme(const edgeInterpolationScheme &)=delete
No copy construct.
Forwards for edge field types.
static tmp< GeometricField< Type, faePatchField, edgeMesh > > interpolate(const GeometricField< Type, faPatchField, areaMesh > &, const tmp< edgeScalarField > &, const tmp< edgeScalarField > &)
Return the face-interpolate of the given cell field.
const faMesh & mesh() const
Return mesh reference.
virtual tmp< GeometricField< Type, faePatchField, edgeMesh > > correction(const GeometricField< Type, faPatchField, areaMesh > &) const
Return the explicit correction to the face-interpolate.
Macros to ease declaration of run-time selection tables.
void operator=(const edgeInterpolationScheme &)=delete
No copy assignment.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Forwards and collection of common area field types.
Namespace for OpenFOAM.
virtual bool corrected() const
Return true if this scheme uses an explicit correction.