transformFieldField.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) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2018 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
29#include "transformFieldField.H"
30
31// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
32
33template<template<class> class Field, class Type>
35(
37 const tensor& rot,
39)
40{
41 forAll(result, i)
42 {
43 transform(result[i], rot, fld[i]);
44 }
45}
46
47
48template<template<class> class Field, class Type>
50(
54)
55{
56 forAll(result, i)
57 {
58 transform(result[i], rot[i], fld[i]);
59 }
60}
61
62
63template<template<class> class Field, class Type>
66(
67 const FieldField<Field, tensor>& rot,
68 const FieldField<Field, Type>& fld
69)
70{
71 tmp<FieldField<Field, Type>> tranf
72 (
73 FieldField<Field, Type>::NewCalculatedType(fld)
74 );
75 transform(tranf(), rot, fld);
76 return tranf;
77}
78
79
80template<template<class> class Field, class Type>
83(
84 const FieldField<Field, tensor>& rot,
85 const tmp<FieldField<Field, Type>>& tfld
86)
87{
88 tmp<FieldField<Field, Type>> tresult(tfld.ptr());
89 transform(tresult(), rot, tresult());
90 return tresult;
91}
92
93
94template<template<class> class Field, class Type>
97(
98 const tmp<FieldField<Field, tensor>>& trot,
99 const FieldField<Field, Type>& fld
100)
101{
102 tmp<FieldField<Field, Type>> tresult
103 (
104 FieldField<Field, Type>::NewCalculatedType(fld)
105 );
106 transform(tresult(), trot(), fld);
107 trot.clear();
108 return tresult;
109}
110
111
112template<template<class> class Field, class Type>
115(
116 const tmp<FieldField<Field, tensor>>& trot,
117 const tmp<FieldField<Field, Type>>& tfld
118)
119{
120 tmp<FieldField<Field, Type>> tresult(tfld.ptr());
121 transform(tresult(), trot(), tresult());
122 trot.clear();
123 return tresult;
124}
125
126
127template<template<class> class Field, class Type>
130(
131 const tensor& rot,
132 const FieldField<Field, Type>& fld
133)
134{
135 tmp<FieldField<Field, Type>> tresult
136 (
137 FieldField<Field, Type>::NewCalculatedType(fld)
138 );
139 transform(tresult(), rot, fld);
140 return tresult;
141}
142
143
144template<template<class> class Field, class Type>
147(
148 const tensor& rot,
149 const tmp<FieldField<Field, Type>>& tfld
150)
151{
152 tmp<FieldField<Field, Type>> tresult(tfld.ptr());
153 transform(tresult(), rot, tresult());
154 return tresult;
155}
156
157
158template<template<class> class Field, class Type>
160(
162 const tensor& rot,
164)
165{
166 forAll(result, i)
167 {
168 invTransform(result[i], rot, fld[i]);
169 }
170}
171
172
173template<template<class> class Field, class Type>
175(
177 const FieldField<Field, tensor>& rot,
179)
180{
181 forAll(result, i)
182 {
183 invTransform(result[i], rot[i], fld[i]);
184 }
185}
186
187
188template<template<class> class Field, class Type>
191(
192 const FieldField<Field, tensor>& rot,
193 const FieldField<Field, Type>& fld
194)
195{
196 tmp<FieldField<Field, Type>> tranf
197 (
198 FieldField<Field, Type>::NewCalculatedType(fld)
199 );
200 invTransform(tranf(), rot, fld);
201 return tranf;
202}
203
204
205template<template<class> class Field, class Type>
208(
209 const FieldField<Field, tensor>& rot,
210 const tmp<FieldField<Field, Type>>& tfld
211)
212{
213 tmp<FieldField<Field, Type>> tresult(tfld.ptr());
214 invTransform(tresult(), rot, tresult());
215 return tresult;
216}
217
218
219template<template<class> class Field, class Type>
222(
223 const tmp<FieldField<Field, tensor>>& trot,
224 const FieldField<Field, Type>& fld
225)
226{
227 tmp<FieldField<Field, Type>> tresult
228 (
229 FieldField<Field, Type>::NewCalculatedType(fld)
230 );
231 invTransform(tresult(), trot(), fld);
232 trot.clear();
233 return tresult;
234}
235
236
237template<template<class> class Field, class Type>
240(
241 const tmp<FieldField<Field, tensor>>& trot,
242 const tmp<FieldField<Field, Type>>& tfld
243)
244{
245 tmp<FieldField<Field, Type>> tresult(tfld.ptr());
246 invTransform(tresult(), trot(), tresult());
247 trot.clear();
248 return tresult;
249}
250
251
252template<template<class> class Field, class Type>
255(
256 const tensor& rot,
257 const FieldField<Field, Type>& fld
258)
259{
260 tmp<FieldField<Field, Type>> tresult
261 (
262 FieldField<Field, Type>::NewCalculatedType(fld)
263 );
264 invTransform(tresult(), rot, fld);
265 return tresult;
266}
267
268
269template<template<class> class Field, class Type>
272(
273 const tensor& rot,
274 const tmp<FieldField<Field, Type>>& tfld
275)
276{
277 tmp<FieldField<Field, Type>> tresult(tfld.ptr());
278 invTransform(tresult(), rot, tresult());
279 return tresult;
280}
281
282
283// ************************************************************************* //
Info<< nl<< "Wrote faMesh in vtk format: "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.mesh().time().globalPath()/"finiteArea-edges"));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
A field of fields is a PtrList of fields with reference counting.
Definition: FieldField.H:80
Tensor of scalars, i.e. Tensor<scalar>.
A class for managing temporary objects.
Definition: tmp.H:65
dimensionSet invTransform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Definition: dimensionSet.C:542
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Definition: dimensionSet.C:536
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333
transformFieldField Spatial transformation functions for FieldField.