FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Description
00025     Spatial transformation functions for FieldFields.
00026 
00027 \*---------------------------------------------------------------------------*/
00028 
00029 #include "transformGeometricField.H"
00030 #include <OpenFOAM/transformField.H>
00031 #include <OpenFOAM/transformFieldField.H>
00032 
00033 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00034 
00035 namespace Foam
00036 {
00037 
00038 // * * * * * * * * * * * * * * * global functions  * * * * * * * * * * * * * //
00039 
00040 template<class Type, template<class> class PatchField, class GeoMesh>
00041 void transform
00042 (
00043     GeometricField<Type, PatchField, GeoMesh>& rtf,
00044     const GeometricField<tensor, PatchField, GeoMesh>& trf,
00045     const GeometricField<Type, PatchField, GeoMesh>& tf
00046 )
00047 {
00048     transform(rtf.internalField(), trf.internalField(), tf.internalField());
00049     transform(rtf.boundaryField(), trf.boundaryField(), tf.boundaryField());
00050 }
00051 
00052 
00053 template<class Type, template<class> class PatchField, class GeoMesh>
00054 tmp<GeometricField<Type, PatchField, GeoMesh> > transform
00055 (
00056     const GeometricField<tensor, PatchField, GeoMesh>& trf,
00057     const GeometricField<Type, PatchField, GeoMesh>& tf
00058 )
00059 {
00060     tmp<GeometricField<Type, PatchField, GeoMesh> > tranf
00061     (
00062         new GeometricField<Type, PatchField, GeoMesh>
00063         (
00064             IOobject
00065             (
00066                 "transform(" + trf.name() + ',' + tf.name() + ')',
00067                 tf.instance(),
00068                 tf.db(),
00069                 IOobject::NO_READ,
00070                 IOobject::NO_WRITE
00071             ),
00072             tf.mesh(),
00073             tf.dimensions()
00074         )
00075     );
00076 
00077     transform(tranf(), trf, tf);
00078 
00079     return tranf;
00080 }
00081 
00082 
00083 template<class Type, template<class> class PatchField, class GeoMesh>
00084 tmp<GeometricField<Type, PatchField, GeoMesh> > transform
00085 (
00086     const GeometricField<tensor, PatchField, GeoMesh>& trf,
00087     const tmp<GeometricField<Type, PatchField, GeoMesh> >& ttf
00088 )
00089 {
00090     tmp<GeometricField<Type, PatchField, GeoMesh> > tranf = 
00091         transform(trf, ttf());
00092     ttf.clear();
00093     return tranf;
00094 }
00095 
00096 
00097 template<class Type, template<class> class PatchField, class GeoMesh>
00098 tmp<GeometricField<Type, PatchField, GeoMesh> > transform
00099 (
00100     const tmp<GeometricField<tensor, PatchField, GeoMesh> >& ttrf,
00101     const GeometricField<Type, PatchField, GeoMesh>& tf
00102 )
00103 {
00104     tmp<GeometricField<Type, PatchField, GeoMesh> > tranf = 
00105         transform(ttrf(), tf);
00106     ttrf.clear();
00107     return tranf;
00108 }
00109 
00110 
00111 template<class Type, template<class> class PatchField, class GeoMesh>
00112 tmp<GeometricField<Type, PatchField, GeoMesh> > transform
00113 (
00114     const tmp<GeometricField<tensor, PatchField, GeoMesh> >& ttrf,
00115     const tmp<GeometricField<Type, PatchField, GeoMesh> >& ttf
00116 )
00117 {
00118     tmp<GeometricField<Type, PatchField, GeoMesh> > tranf = 
00119         transform(ttrf(), ttf());
00120     ttf.clear();
00121     ttrf.clear();
00122     return tranf;
00123 }
00124 
00125 
00126 template<class Type, template<class> class PatchField, class GeoMesh>
00127 void transform
00128 (
00129     GeometricField<Type, PatchField, GeoMesh>& rtf,
00130     const dimensionedTensor& t,
00131     const GeometricField<Type, PatchField, GeoMesh>& tf
00132 )
00133 {
00134     transform(rtf.internalField(), t.value(), tf.internalField());
00135     transform(rtf.boundaryField(), t.value(), tf.boundaryField());
00136 }
00137 
00138 
00139 template<class Type, template<class> class PatchField, class GeoMesh>
00140 tmp<GeometricField<Type, PatchField, GeoMesh> > transform
00141 (
00142     const dimensionedTensor& t,
00143     const GeometricField<Type, PatchField, GeoMesh>& tf
00144 )
00145 {
00146     tmp<GeometricField<Type, PatchField, GeoMesh> > tranf
00147     (
00148         new GeometricField<vector, PatchField, GeoMesh>
00149         (
00150             IOobject
00151             (
00152                 "transform(" + t.name() + ',' + tf.name() + ')',
00153                 tf.instance(),
00154                 tf.db(),
00155                 IOobject::NO_READ,
00156                 IOobject::NO_WRITE
00157             ),
00158             tf.mesh(),
00159             tf.dimensions()
00160         )
00161     );
00162 
00163     transform(tranf(), t, tf);
00164 
00165     return tranf;
00166 }
00167 
00168 
00169 template<class Type, template<class> class PatchField, class GeoMesh>
00170 tmp<GeometricField<Type, PatchField, GeoMesh> > transform
00171 (
00172     const dimensionedTensor& t,
00173     const tmp<GeometricField<Type, PatchField, GeoMesh> >& ttf
00174 )
00175 {
00176     tmp<GeometricField<Type, PatchField, GeoMesh> > tranf = 
00177         transform(t, ttf());
00178     ttf.clear();
00179     return tranf;
00180 }
00181 
00182 
00183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00184 
00185 } // End namespace Foam
00186 
00187 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines