transformGeometricField.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
27Description
28 Spatial transformation functions for FieldFields.
29
30\*---------------------------------------------------------------------------*/
31
33#include "transformField.H"
34#include "transformFieldField.H"
35#include "GeometricField.H"
36
37// * * * * * * * * * * * * Transform Global Functions * * * * * * * * * * * //
38
39template<class Type, template<class> class PatchField, class GeoMesh>
41(
43 const dimensionedTensor& rot,
45)
46{
48 (
49 result.primitiveFieldRef(),
50 rot.value(),
51 fld.primitiveField()
52 );
54 (
55 result.boundaryFieldRef(),
56 rot.value(),
57 fld.boundaryField()
58 );
59}
60
61
62template<class Type, template<class> class PatchField, class GeoMesh>
64(
68)
69{
71 (
72 result.primitiveFieldRef(),
73 rot.primitiveField(),
74 fld.primitiveField()
75 );
77 (
78 result.boundaryFieldRef(),
79 rot.boundaryField(),
80 fld.boundaryField()
81 );
82}
83
84
85template<class Type, template<class> class PatchField, class GeoMesh>
88(
89 const GeometricField<tensor, PatchField, GeoMesh>& rot,
90 const GeometricField<Type, PatchField, GeoMesh>& fld
91)
92{
93 auto tresult = tmp<GeometricField<Type, PatchField, GeoMesh>>::New
94 (
95 IOobject
96 (
97 "transform(" + rot.name() + ',' + fld.name() + ')',
98 fld.instance(),
99 fld.db(),
100 IOobject::NO_READ,
101 IOobject::NO_WRITE
102 ),
103 fld.mesh(),
104 fld.dimensions()
105 );
106
107 transform(tresult.ref(), rot, fld);
108
109 return tresult;
110}
111
112
113template<class Type, template<class> class PatchField, class GeoMesh>
116(
117 const GeometricField<tensor, PatchField, GeoMesh>& rot,
118 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tfld
119)
120{
121 auto tresult = transform(rot, tfld());
122 tfld.clear();
123 return tresult;
124}
125
126
127template<class Type, template<class> class PatchField, class GeoMesh>
130(
131 const tmp<GeometricField<tensor, PatchField, GeoMesh>>& trot,
132 const GeometricField<Type, PatchField, GeoMesh>& fld
133)
134{
135 auto tresult = transform(trot(), fld);
136 trot.clear();
137 return tresult;
138}
139
140
141template<class Type, template<class> class PatchField, class GeoMesh>
144(
145 const tmp<GeometricField<tensor, PatchField, GeoMesh>>& trot,
146 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tfld
147)
148{
149 auto tresult = transform(trot(), tfld());
150 tfld.clear();
151 trot.clear();
152 return tresult;
153}
154
155
156template<class Type, template<class> class PatchField, class GeoMesh>
159(
160 const dimensionedTensor& rot,
161 const GeometricField<Type, PatchField, GeoMesh>& fld
162)
163{
164 auto tresult = tmp<GeometricField<Type, PatchField, GeoMesh>>::New
165 (
166 IOobject
167 (
168 "transform(" + rot.name() + ',' + fld.name() + ')',
169 fld.instance(),
170 fld.db(),
171 IOobject::NO_READ,
172 IOobject::NO_WRITE
173 ),
174 fld.mesh(),
175 fld.dimensions()
176 );
177
178 transform(tresult.ref(), rot, fld);
179
180 return tresult;
181}
182
183
184template<class Type, template<class> class PatchField, class GeoMesh>
187(
188 const dimensionedTensor& rot,
189 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tfld
190)
191{
192 auto tresult = transform(rot, tfld());
193 tfld.clear();
194 return tresult;
195}
196
197
198// * * * * * * * * * * * invTransform Global Functions * * * * * * * * * * * //
199
200template<class Type, template<class> class PatchField, class GeoMesh>
202(
204 const dimensionedTensor& rot,
206)
207{
209 (
210 result.primitiveFieldRef(),
211 rot.value(),
212 fld.primitiveField()
213 );
215 (
216 result.boundaryFieldRef(),
217 rot.value(),
218 fld.boundaryField()
219 );
220}
221
222
223template<class Type, template<class> class PatchField, class GeoMesh>
225(
229)
230{
232 (
233 result.primitiveFieldRef(),
234 rot.primitiveField(),
235 fld.primitiveField()
236 );
238 (
239 result.boundaryFieldRef(),
240 rot.boundaryField(),
241 fld.boundaryField()
242 );
243}
244
245
246template<class Type, template<class> class PatchField, class GeoMesh>
249(
250 const GeometricField<tensor, PatchField, GeoMesh>& rot,
251 const GeometricField<Type, PatchField, GeoMesh>& fld
252)
253{
254 auto tresult = tmp<GeometricField<Type, PatchField, GeoMesh>>::New
255 (
256 IOobject
257 (
258 "invTransform(" + rot.name() + ',' + fld.name() + ')',
259 fld.instance(),
260 fld.db(),
261 IOobject::NO_READ,
262 IOobject::NO_WRITE
263 ),
264 fld.mesh(),
265 fld.dimensions()
266 );
267
268 invTransform(tresult.ref(), rot, fld);
269
270 return tresult;
271}
272
273
274template<class Type, template<class> class PatchField, class GeoMesh>
277(
278 const GeometricField<tensor, PatchField, GeoMesh>& rot,
279 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tfld
280)
281{
282 auto tresult = invTransform(rot, tfld());
283 tfld.clear();
284 return tresult;
285}
286
287
288template<class Type, template<class> class PatchField, class GeoMesh>
291(
292 const tmp<GeometricField<tensor, PatchField, GeoMesh>>& trot,
293 const GeometricField<Type, PatchField, GeoMesh>& fld
294)
295{
296 auto tresult = invTransform(trot(), fld);
297 trot.clear();
298 return tresult;
299}
300
301
302template<class Type, template<class> class PatchField, class GeoMesh>
305(
306 const tmp<GeometricField<tensor, PatchField, GeoMesh>>& trot,
307 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tfld
308)
309{
310 auto tresult = invTransform(trot(), tfld());
311 tfld.clear();
312 trot.clear();
313 return tresult;
314}
315
316
317template<class Type, template<class> class PatchField, class GeoMesh>
320(
321 const dimensionedTensor& rot,
322 const GeometricField<Type, PatchField, GeoMesh>& fld
323)
324{
325 auto tresult = tmp<GeometricField<Type, PatchField, GeoMesh>>::New
326 (
327 IOobject
328 (
329 "invTransform(" + rot.name() + ',' + fld.name() + ')',
330 fld.instance(),
331 fld.db(),
332 IOobject::NO_READ,
333 IOobject::NO_WRITE
334 ),
335 fld.mesh(),
336 fld.dimensions()
337 );
338
339 invTransform(tresult.ref(), rot, fld);
340
341 return tresult;
342}
343
344
345template<class Type, template<class> class PatchField, class GeoMesh>
348(
349 const dimensionedTensor& rot,
350 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tfld
351)
352{
353 auto tresult = invTransform(rot, tfld());
354 tfld.clear();
355 return tresult;
356}
357
358
359// ************************************************************************* //
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))
Generic GeometricField class.
const Internal::FieldType & primitiveField() const
Return a const-reference to the internal field.
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field.
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
Generic dimensioned Type class.
const Type & value() const
Return const reference to value.
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
transformFieldField Spatial transformation functions for FieldField.
Spatial transformation functions for primitive fields.
Spatial transformation functions for GeometricField.