OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

transformGeometricField.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Description
00026     Spatial transformation functions for FieldFields.
00027 
00028 \*---------------------------------------------------------------------------*/
00029 
00030 #include "transformGeometricField.H"
00031 #include "transformField.H"
00032 #include "transformFieldField.H"
00033 
00034 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00035 
00036 namespace Foam
00037 {
00038 
00039 // * * * * * * * * * * * * * * * global functions  * * * * * * * * * * * * * //
00040 
00041 template<class Type, template<class> class PatchField, class GeoMesh>
00042 void transform
00043 (
00044     GeometricField<Type, PatchField, GeoMesh>& rtf,
00045     const GeometricField<tensor, PatchField, GeoMesh>& trf,
00046     const GeometricField<Type, PatchField, GeoMesh>& tf
00047 )
00048 {
00049     transform(rtf.internalField(), trf.internalField(), tf.internalField());
00050     transform(rtf.boundaryField(), trf.boundaryField(), tf.boundaryField());
00051 }
00052 
00053 
00054 template<class Type, template<class> class PatchField, class GeoMesh>
00055 tmp<GeometricField<Type, PatchField, GeoMesh> > transform
00056 (
00057     const GeometricField<tensor, PatchField, GeoMesh>& trf,
00058     const GeometricField<Type, PatchField, GeoMesh>& tf
00059 )
00060 {
00061     tmp<GeometricField<Type, PatchField, GeoMesh> > tranf
00062     (
00063         new GeometricField<Type, PatchField, GeoMesh>
00064         (
00065             IOobject
00066             (
00067                 "transform(" + trf.name() + ',' + tf.name() + ')',
00068                 tf.instance(),
00069                 tf.db(),
00070                 IOobject::NO_READ,
00071                 IOobject::NO_WRITE
00072             ),
00073             tf.mesh(),
00074             tf.dimensions()
00075         )
00076     );
00077 
00078     transform(tranf(), trf, tf);
00079 
00080     return tranf;
00081 }
00082 
00083 
00084 template<class Type, template<class> class PatchField, class GeoMesh>
00085 tmp<GeometricField<Type, PatchField, GeoMesh> > transform
00086 (
00087     const GeometricField<tensor, PatchField, GeoMesh>& trf,
00088     const tmp<GeometricField<Type, PatchField, GeoMesh> >& ttf
00089 )
00090 {
00091     tmp<GeometricField<Type, PatchField, GeoMesh> > tranf = 
00092         transform(trf, ttf());
00093     ttf.clear();
00094     return tranf;
00095 }
00096 
00097 
00098 template<class Type, template<class> class PatchField, class GeoMesh>
00099 tmp<GeometricField<Type, PatchField, GeoMesh> > transform
00100 (
00101     const tmp<GeometricField<tensor, PatchField, GeoMesh> >& ttrf,
00102     const GeometricField<Type, PatchField, GeoMesh>& tf
00103 )
00104 {
00105     tmp<GeometricField<Type, PatchField, GeoMesh> > tranf = 
00106         transform(ttrf(), tf);
00107     ttrf.clear();
00108     return tranf;
00109 }
00110 
00111 
00112 template<class Type, template<class> class PatchField, class GeoMesh>
00113 tmp<GeometricField<Type, PatchField, GeoMesh> > transform
00114 (
00115     const tmp<GeometricField<tensor, PatchField, GeoMesh> >& ttrf,
00116     const tmp<GeometricField<Type, PatchField, GeoMesh> >& ttf
00117 )
00118 {
00119     tmp<GeometricField<Type, PatchField, GeoMesh> > tranf = 
00120         transform(ttrf(), ttf());
00121     ttf.clear();
00122     ttrf.clear();
00123     return tranf;
00124 }
00125 
00126 
00127 template<class Type, template<class> class PatchField, class GeoMesh>
00128 void transform
00129 (
00130     GeometricField<Type, PatchField, GeoMesh>& rtf,
00131     const dimensionedTensor& t,
00132     const GeometricField<Type, PatchField, GeoMesh>& tf
00133 )
00134 {
00135     transform(rtf.internalField(), t.value(), tf.internalField());
00136     transform(rtf.boundaryField(), t.value(), tf.boundaryField());
00137 }
00138 
00139 
00140 template<class Type, template<class> class PatchField, class GeoMesh>
00141 tmp<GeometricField<Type, PatchField, GeoMesh> > transform
00142 (
00143     const dimensionedTensor& t,
00144     const GeometricField<Type, PatchField, GeoMesh>& tf
00145 )
00146 {
00147     tmp<GeometricField<Type, PatchField, GeoMesh> > tranf
00148     (
00149         new GeometricField<vector, PatchField, GeoMesh>
00150         (
00151             IOobject
00152             (
00153                 "transform(" + t.name() + ',' + tf.name() + ')',
00154                 tf.instance(),
00155                 tf.db(),
00156                 IOobject::NO_READ,
00157                 IOobject::NO_WRITE
00158             ),
00159             tf.mesh(),
00160             tf.dimensions()
00161         )
00162     );
00163 
00164     transform(tranf(), t, tf);
00165 
00166     return tranf;
00167 }
00168 
00169 
00170 template<class Type, template<class> class PatchField, class GeoMesh>
00171 tmp<GeometricField<Type, PatchField, GeoMesh> > transform
00172 (
00173     const dimensionedTensor& t,
00174     const tmp<GeometricField<Type, PatchField, GeoMesh> >& ttf
00175 )
00176 {
00177     tmp<GeometricField<Type, PatchField, GeoMesh> > tranf = 
00178         transform(t, ttf());
00179     ttf.clear();
00180     return tranf;
00181 }
00182 
00183 
00184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00185 
00186 } // End namespace Foam
00187 
00188 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd