edgeInterpolate.C
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-------------------------------------------------------------------------------
10License
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\*---------------------------------------------------------------------------*/
27
28#include "edgeInterpolate.H"
29
30// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31
32template<class Type>
34(
35 const edgeScalarField& faceFlux,
36 Istream& streamData
37)
38{
39 return edgeInterpolationScheme<Type>::New
40 (
41 faceFlux.mesh(),
42 faceFlux,
43 streamData
44 );
45}
46
47
48template<class Type>
50(
51 const edgeScalarField& faceFlux,
52 const word& name
53)
54{
55 return edgeInterpolationScheme<Type>::New
56 (
57 faceFlux.mesh(),
58 faceFlux,
59 faceFlux.mesh().interpolationScheme(name)
60 );
61}
62
63
64template<class Type>
66(
67 const faMesh& mesh,
68 Istream& streamData
69)
70{
71 return edgeInterpolationScheme<Type>::New
72 (
73 mesh,
74 streamData
75 );
76}
77
78
79template<class Type>
81(
82 const faMesh& mesh,
83 const word& name
84)
85{
86 return edgeInterpolationScheme<Type>::New
87 (
88 mesh,
89 mesh.interpolationScheme(name)
90 );
91}
92
93
94template<class Type>
97(
98 const GeometricField<Type, faPatchField, areaMesh>& vf,
99 const edgeScalarField& faceFlux,
100 Istream& schemeData
101)
102{
103# ifdef DEBUGInterpolations
104 if (edgeInterpolation::debug)
105 {
107 << "interpolating GeometricField<Type, faPatchField, areaMesh> "
108 << endl;
109 }
110# endif
111
112 return scheme<Type>(faceFlux, schemeData)().interpolate(vf);
113}
114
115
116template<class Type>
119(
120 const GeometricField<Type, faPatchField, areaMesh>& vf,
121 const edgeScalarField& faceFlux,
122 const word& name
123)
124{
125# ifdef DEBUGInterpolations
126 if (edgeInterpolation::debug)
127 {
129 << "interpolating GeometricField<Type, faPatchField, areaMesh> "
130 << "using " << name
131 << endl;
132 }
133# endif
134
135 return scheme<Type>(faceFlux, name)().interpolate(vf);
136}
137
138
139template<class Type>
142(
143 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tvf,
144 const edgeScalarField& faceFlux,
145 const word& name
146)
147{
148 tmp<GeometricField<Type, faePatchField, edgeMesh>> tsf =
149 interpolate(tvf(), faceFlux, name);
150
151 tvf.clear();
152
153 return tsf;
154}
155
156
157template<class Type>
160(
161 const GeometricField<Type, faPatchField, areaMesh>& vf,
162 const tmp<edgeScalarField>& tFaceFlux,
163 const word& name
164)
165{
166 tmp<GeometricField<Type, faePatchField, edgeMesh>> tsf =
167 interpolate(vf, tFaceFlux(), name);
168
169 tFaceFlux.clear();
170
171 return tsf;
172}
173
174
175template<class Type>
178(
179 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tvf,
180 const tmp<edgeScalarField>& tFaceFlux,
181 const word& name
182)
183{
184 tmp<GeometricField<Type, faePatchField, edgeMesh>> tsf =
185 interpolate(tvf(), tFaceFlux(), name);
186
187 tvf.clear();
188 tFaceFlux.clear();
189
190 return tsf;
191}
192
193
194template<class Type>
197(
198 const GeometricField<Type, faPatchField, areaMesh>& vf,
199 Istream& schemeData
200)
201{
202# ifdef DEBUGInterpolations
203 if (edgeInterpolation::debug)
204 {
206 << "interpolating GeometricField<Type, faPatchField, areaMesh> "
207 << endl;
208 }
209# endif
210
211 return scheme<Type>(vf.mesh(), schemeData)().interpolate(vf);
212}
213
214
215template<class Type>
218(
219 const GeometricField<Type, faPatchField, areaMesh>& vf,
220 const word& name
221)
222{
223# ifdef DEBUGInterpolations
224 if (edgeInterpolation::debug)
225 {
227 << "interpolating GeometricField<Type, faPatchField, areaMesh> "
228 << "using " << name
229 << endl;
230 }
231# endif
232
233 return scheme<Type>(vf.mesh(), name)().interpolate(vf);
234}
235
236template<class Type>
239(
240 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tvf,
241 const word& name
242)
243{
244 tmp<GeometricField<Type, faePatchField, edgeMesh>> tsf =
245 interpolate(tvf(), name);
246
247 tvf.clear();
248
249 return tsf;
250}
251
252
253template<class Type>
256(
257 const GeometricField<Type, faPatchField, areaMesh>& vf
258)
259{
260# ifdef DEBUGInterpolations
261 if (edgeInterpolation::debug)
262 {
264 << "interpolating GeometricField<Type, faPatchField, areaMesh> "
265 << "using run-time selected scheme"
266 << endl;
267 }
268# endif
269
270 return interpolate(vf, "interpolate(" + vf.name() + ')');
271}
272
273
274template<class Type>
277(
278 const tmp<GeometricField<Type, faPatchField, areaMesh>>& tvf
279)
280{
281 tmp<GeometricField<Type, faePatchField, edgeMesh>> tsf =
282 interpolate(tvf());
283 tvf.clear();
284
285 return tsf;
286}
287
288
289// ************************************************************************* //
A class for managing temporary objects.
Definition: tmp.H:65
mesh interpolate(rAU)
dynamicFvMesh & mesh
#define InfoInFunction
Report an information message using Foam::Info.
static tmp< edgeInterpolationScheme< Type > > scheme(const edgeScalarField &faceFlux, Istream &schemeData)
Return weighting factors for scheme given from Istream.
static tmp< GeometricField< Type, faePatchField, edgeMesh > > interpolate(const GeometricField< Type, faPatchField, areaMesh > &tvf, const edgeScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59