Forward compatibility: flex
[foam-extend-3.2.git] / src / foam / fields / GeometricFields / transformGeometricField / transformGeometricField.C
blob225aaf06ffcfd55aae4a2951894e5eb02b9fa518
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     | Version:     3.2
5     \\  /    A nd           | Web:         http://www.foam-extend.org
6      \\/     M anipulation  | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
8 License
9     This file is part of foam-extend.
11     foam-extend is free software: you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation, either version 3 of the License, or (at your
14     option) any later version.
16     foam-extend is distributed in the hope that it will be useful, but
17     WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     General Public License for more details.
21     You should have received a copy of the GNU General Public License
22     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 Description
25     Spatial transformation functions for FieldFields.
27 \*---------------------------------------------------------------------------*/
29 #include "transformGeometricField.H"
30 #include "transformField.H"
31 #include "transformFieldField.H"
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 namespace Foam
38 // * * * * * * * * * * * * * * * global functions  * * * * * * * * * * * * * //
40 template<class Type, template<class> class PatchField, class GeoMesh>
41 void transform
43     GeometricField<Type, PatchField, GeoMesh>& rtf,
44     const GeometricField<tensor, PatchField, GeoMesh>& trf,
45     const GeometricField<Type, PatchField, GeoMesh>& tf
48     transform(rtf.internalField(), trf.internalField(), tf.internalField());
49     transform(rtf.boundaryField(), trf.boundaryField(), tf.boundaryField());
53 template<class Type, template<class> class PatchField, class GeoMesh>
54 tmp<GeometricField<Type, PatchField, GeoMesh> > transform
56     const GeometricField<tensor, PatchField, GeoMesh>& trf,
57     const GeometricField<Type, PatchField, GeoMesh>& tf
60     tmp<GeometricField<Type, PatchField, GeoMesh> > tranf
61     (
62         new GeometricField<Type, PatchField, GeoMesh>
63         (
64             IOobject
65             (
66                 "transform(" + trf.name() + ',' + tf.name() + ')',
67                 tf.instance(),
68                 tf.db(),
69                 IOobject::NO_READ,
70                 IOobject::NO_WRITE
71             ),
72             tf.mesh(),
73             tf.dimensions()
74         )
75     );
77     transform(tranf(), trf, tf);
79     return tranf;
83 template<class Type, template<class> class PatchField, class GeoMesh>
84 tmp<GeometricField<Type, PatchField, GeoMesh> > transform
86     const GeometricField<tensor, PatchField, GeoMesh>& trf,
87     const tmp<GeometricField<Type, PatchField, GeoMesh> >& ttf
90     tmp<GeometricField<Type, PatchField, GeoMesh> > tranf =
91         transform(trf, ttf());
92     ttf.clear();
93     return tranf;
97 template<class Type, template<class> class PatchField, class GeoMesh>
98 tmp<GeometricField<Type, PatchField, GeoMesh> > transform
100     const tmp<GeometricField<tensor, PatchField, GeoMesh> >& ttrf,
101     const GeometricField<Type, PatchField, GeoMesh>& tf
104     tmp<GeometricField<Type, PatchField, GeoMesh> > tranf =
105         transform(ttrf(), tf);
106     ttrf.clear();
107     return tranf;
111 template<class Type, template<class> class PatchField, class GeoMesh>
112 tmp<GeometricField<Type, PatchField, GeoMesh> > transform
114     const tmp<GeometricField<tensor, PatchField, GeoMesh> >& ttrf,
115     const tmp<GeometricField<Type, PatchField, GeoMesh> >& ttf
118     tmp<GeometricField<Type, PatchField, GeoMesh> > tranf =
119         transform(ttrf(), ttf());
120     ttf.clear();
121     ttrf.clear();
122     return tranf;
126 template<class Type, template<class> class PatchField, class GeoMesh>
127 void transform
129     GeometricField<Type, PatchField, GeoMesh>& rtf,
130     const dimensionedTensor& t,
131     const GeometricField<Type, PatchField, GeoMesh>& tf
134     transform(rtf.internalField(), t.value(), tf.internalField());
135     transform(rtf.boundaryField(), t.value(), tf.boundaryField());
139 template<class Type, template<class> class PatchField, class GeoMesh>
140 tmp<GeometricField<Type, PatchField, GeoMesh> > transform
142     const dimensionedTensor& t,
143     const GeometricField<Type, PatchField, GeoMesh>& tf
146     tmp<GeometricField<Type, PatchField, GeoMesh> > tranf
147     (
148         new GeometricField<vector, PatchField, GeoMesh>
149         (
150             IOobject
151             (
152                 "transform(" + t.name() + ',' + tf.name() + ')',
153                 tf.instance(),
154                 tf.db(),
155                 IOobject::NO_READ,
156                 IOobject::NO_WRITE
157             ),
158             tf.mesh(),
159             tf.dimensions()
160         )
161     );
163     transform(tranf(), t, tf);
165     return tranf;
169 template<class Type, template<class> class PatchField, class GeoMesh>
170 tmp<GeometricField<Type, PatchField, GeoMesh> > transform
172     const dimensionedTensor& t,
173     const tmp<GeometricField<Type, PatchField, GeoMesh> >& ttf
176     tmp<GeometricField<Type, PatchField, GeoMesh> > tranf =
177         transform(t, ttf());
178     ttf.clear();
179     return tranf;
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 } // End namespace Foam
187 // ************************************************************************* //