initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / OpenFOAM / fields / GeometricFields / transformGeometricField / transformGeometricField.C
blobfa501ac0262bbd1efe67664245048ac80aed8d2e
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM 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 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Description
26     Spatial transformation functions for FieldFields.
28 \*---------------------------------------------------------------------------*/
30 #include "transformGeometricField.H"
31 #include "transformField.H"
32 #include "transformFieldField.H"
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 namespace Foam
39 // * * * * * * * * * * * * * * * global functions  * * * * * * * * * * * * * //
41 template<class Type, template<class> class PatchField, class GeoMesh>
42 void transform
44     GeometricField<Type, PatchField, GeoMesh>& rtf,
45     const GeometricField<tensor, PatchField, GeoMesh>& trf,
46     const GeometricField<Type, PatchField, GeoMesh>& tf
49     transform(rtf.internalField(), trf.internalField(), tf.internalField());
50     transform(rtf.boundaryField(), trf.boundaryField(), tf.boundaryField());
54 template<class Type, template<class> class PatchField, class GeoMesh>
55 tmp<GeometricField<Type, PatchField, GeoMesh> > transform
57     const GeometricField<tensor, PatchField, GeoMesh>& trf,
58     const GeometricField<Type, PatchField, GeoMesh>& tf
61     tmp<GeometricField<Type, PatchField, GeoMesh> > tranf
62     (
63         new GeometricField<Type, PatchField, GeoMesh>
64         (
65             IOobject
66             (
67                 "transform(" + trf.name() + ',' + tf.name() + ')',
68                 tf.instance(),
69                 tf.db(),
70                 IOobject::NO_READ,
71                 IOobject::NO_WRITE
72             ),
73             tf.mesh(),
74             tf.dimensions()
75         )
76     );
78     transform(tranf(), trf, tf);
80     return tranf;
84 template<class Type, template<class> class PatchField, class GeoMesh>
85 tmp<GeometricField<Type, PatchField, GeoMesh> > transform
87     const GeometricField<tensor, PatchField, GeoMesh>& trf,
88     const tmp<GeometricField<Type, PatchField, GeoMesh> >& ttf
91     tmp<GeometricField<Type, PatchField, GeoMesh> > tranf = 
92         transform(trf, ttf());
93     ttf.clear();
94     return tranf;
98 template<class Type, template<class> class PatchField, class GeoMesh>
99 tmp<GeometricField<Type, PatchField, GeoMesh> > transform
101     const tmp<GeometricField<tensor, PatchField, GeoMesh> >& ttrf,
102     const GeometricField<Type, PatchField, GeoMesh>& tf
105     tmp<GeometricField<Type, PatchField, GeoMesh> > tranf = 
106         transform(ttrf(), tf);
107     ttrf.clear();
108     return tranf;
112 template<class Type, template<class> class PatchField, class GeoMesh>
113 tmp<GeometricField<Type, PatchField, GeoMesh> > transform
115     const tmp<GeometricField<tensor, PatchField, GeoMesh> >& ttrf,
116     const tmp<GeometricField<Type, PatchField, GeoMesh> >& ttf
119     tmp<GeometricField<Type, PatchField, GeoMesh> > tranf = 
120         transform(ttrf(), ttf());
121     ttf.clear();
122     ttrf.clear();
123     return tranf;
127 template<class Type, template<class> class PatchField, class GeoMesh>
128 void transform
130     GeometricField<Type, PatchField, GeoMesh>& rtf,
131     const dimensionedTensor& t,
132     const GeometricField<Type, PatchField, GeoMesh>& tf
135     transform(rtf.internalField(), t.value(), tf.internalField());
136     transform(rtf.boundaryField(), t.value(), tf.boundaryField());
140 template<class Type, template<class> class PatchField, class GeoMesh>
141 tmp<GeometricField<Type, PatchField, GeoMesh> > transform
143     const dimensionedTensor& t,
144     const GeometricField<Type, PatchField, GeoMesh>& tf
147     tmp<GeometricField<Type, PatchField, GeoMesh> > tranf
148     (
149         new GeometricField<vector, PatchField, GeoMesh>
150         (
151             IOobject
152             (
153                 "transform(" + t.name() + ',' + tf.name() + ')',
154                 tf.instance(),
155                 tf.db(),
156                 IOobject::NO_READ,
157                 IOobject::NO_WRITE
158             ),
159             tf.mesh(),
160             tf.dimensions()
161         )
162     );
164     transform(tranf(), t, tf);
166     return tranf;
170 template<class Type, template<class> class PatchField, class GeoMesh>
171 tmp<GeometricField<Type, PatchField, GeoMesh> > transform
173     const dimensionedTensor& t,
174     const tmp<GeometricField<Type, PatchField, GeoMesh> >& ttf
177     tmp<GeometricField<Type, PatchField, GeoMesh> > tranf = 
178         transform(t, ttf());
179     ttf.clear();
180     return tranf;
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 } // End namespace Foam
188 // ************************************************************************* //