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 "tmp.H"
41 #include "areaFieldsFwd.H"
42 #include "edgeFieldsFwd.H"
43 #include "typeInfo.H"
44 #include "runTimeSelectionTables.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 class faMesh;
52 
53 /*---------------------------------------------------------------------------*\
54  Class edgeInterpolationScheme Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 template<class Type>
59 :
60  public refCount
61 {
62  // Private data
63 
64  //- Hold reference to mesh
65  const faMesh& mesh_;
66 
67 
68  // Private Member Functions
69 
70  //- No copy assignment
71  void operator=(const edgeInterpolationScheme&) = delete;
72 
73 
74 public:
75 
76  // Declare run-time constructor selection tables
77 
79  (
80  tmp,
82  Mesh,
83  (
84  const faMesh& mesh,
85  Istream& schemeData
86  ),
87  (mesh, schemeData)
88  );
89 
91  (
92  tmp,
94  MeshFlux,
95  (
96  const faMesh& mesh,
97  const edgeScalarField& faceFlux,
98  Istream& schemeData
99  ),
100  (mesh, faceFlux, schemeData)
101  );
102 
103 
104  // Constructors
105 
106  //- Construct from mesh
108  :
109  mesh_(mesh)
110  {}
111 
112 
113  // Selectors
114 
115  //- Return new tmp interpolation scheme
117  (
118  const faMesh& mesh,
119  Istream& schemeData
120  );
121 
122  //- Return new tmp interpolation scheme
124  (
125  const faMesh& mesh,
126  const edgeScalarField& faceFlux,
127  Istream& schemeData
128  );
129 
130 
131  // Destructor
132 
133  virtual ~edgeInterpolationScheme();
134 
135 
136  // Member Functions
137 
138  //- Return mesh reference
139  const faMesh& mesh() const
140  {
141  return mesh_;
142  }
143 
144 
145  //- Return the face-interpolate of the given cell field
146  // with the given owner and neighbour weighting factors
149  (
151  const tmp<edgeScalarField>&,
152  const tmp<edgeScalarField>&
153  );
154 
155  //- Return the face-interpolate of the given cell field
156  // with the given weighting factors
159  (
161  const tmp<edgeScalarField>&
162  );
163 
164 
165  //- Return the euclidian edge-interpolate of the given area field
166  // with the given weighting factors
169  (
171  const tmp<edgeScalarField>&
172  );
173 
174 
175  //- Return the interpolation weighting factors for the given field
177  (
179  ) const = 0;
180 
181  //- Return true if this scheme uses an explicit correction
182  virtual bool corrected() const
183  {
184  return false;
185  }
186 
187  //- Return the explicit correction to the face-interpolate
188  // for the given field
191  {
192  return nullptr;
193  }
194 
195  //- Return the face-interpolate of the given cell field
196  // with explicit correction
199 
200  //- Return the euclidian edge-interpolate of the given area field
201  // without explicit correction
204  (
206  ) const;
207 
208  //- Return the face-interpolate of the given tmp cell field
209  // with explicit correction
212  (
214  ) const;
215 };
216 
217 
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 } // End namespace Foam
221 
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 
224 // Add the patch constructor functions to the hash tables
225 
226 #define makeEdgeInterpolationTypeScheme(SS, Type) \
227  \
228 defineNamedTemplateTypeNameAndDebug(SS<Type>, 0); \
229  \
230 edgeInterpolationScheme<Type>::addMeshConstructorToTable<SS<Type>> \
231  add##SS##Type##MeshConstructorToTable_; \
232  \
233 edgeInterpolationScheme<Type>::addMeshFluxConstructorToTable<SS<Type>> \
234  add##SS##Type##MeshFluxConstructorToTable_;
235 
236 #define makeEdgeInterpolationScheme(SS) \
237  \
238 makeEdgeInterpolationTypeScheme(SS, scalar) \
239 makeEdgeInterpolationTypeScheme(SS, vector) \
240 makeEdgeInterpolationTypeScheme(SS, tensor)
241 
242 
243 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
244 
245 #ifdef NoRepository
246  #include "edgeInterpolationScheme.C"
247 #endif
248 
249 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
250 
251 #endif
252 
253 // ************************************************************************* //
Foam::edgeInterpolationScheme::corrected
virtual bool corrected() const
Return true if this scheme uses an explicit correction.
Definition: edgeInterpolationScheme.H:181
Foam::edgeInterpolationScheme::weights
virtual tmp< edgeScalarField > weights(const GeometricField< Type, faPatchField, areaMesh > &) const =0
Return the interpolation weighting factors for the given field.
Foam::edgeInterpolationScheme::correction
virtual tmp< GeometricField< Type, faePatchField, edgeMesh > > correction(const GeometricField< Type, faPatchField, areaMesh > &) const
Return the explicit correction to the face-interpolate.
Definition: edgeInterpolationScheme.H:189
Foam::edgeInterpolationScheme
Abstract base class for edge interpolation schemes.
Definition: edgeInterpolationScheme.H:57
Foam::edgeInterpolationScheme::euclidianInterpolate
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.
Definition: edgeInterpolationScheme.C:374
typeInfo.H
edgeInterpolationScheme.C
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::edgeInterpolationScheme::edgeInterpolationScheme
edgeInterpolationScheme(const faMesh &mesh)
Construct from mesh.
Definition: edgeInterpolationScheme.H:106
Foam::edgeInterpolationScheme::mesh
const faMesh & mesh() const
Return mesh reference.
Definition: edgeInterpolationScheme.H:138
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
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::edgeInterpolationScheme::interpolate
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.
Definition: edgeInterpolationScheme.C:138
tmp.H
Foam::edgeInterpolationScheme::declareRunTimeSelectionTable
declareRunTimeSelectionTable(tmp, edgeInterpolationScheme, Mesh,(const faMesh &mesh, Istream &schemeData),(mesh, schemeData))
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::faMesh
Finite area mesh. Used for 2-D non-Euclidian finite area method.
Definition: faMesh.H:82
Foam::GeometricField< scalar, faePatchField, edgeMesh >
edgeFieldsFwd.H
Forwards for edge field types.
Foam::edgeInterpolationScheme::New
static tmp< edgeInterpolationScheme< Type > > New(const faMesh &mesh, Istream &schemeData)
Return new tmp interpolation scheme.
Definition: edgeInterpolationScheme.C:41
Foam::edgeInterpolationScheme::~edgeInterpolationScheme
virtual ~edgeInterpolationScheme()
Definition: edgeInterpolationScheme.C:129