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

transformFieldTemplates.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 \*---------------------------------------------------------------------------*/
00025 
00026 #include "transformField.H"
00027 #include <OpenFOAM/FieldM.H>
00028 
00029 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00030 
00031 namespace Foam
00032 {
00033 
00034 // * * * * * * * * * * * * * * * global functions  * * * * * * * * * * * * * //
00035 
00036 template<class Type>
00037 void transform
00038 (
00039     Field<Type>& rtf,
00040     const tensorField& trf,
00041     const Field<Type>& tf
00042 )
00043 {
00044     if (trf.size() == 1)
00045     {
00046         return transform(rtf, trf[0], tf);
00047     }
00048     else
00049     {
00050         TFOR_ALL_F_OP_FUNC_F_F
00051         (
00052             Type, rtf, =, transform, tensor, trf, Type, tf
00053         )
00054     }
00055 }
00056 
00057 
00058 template<class Type>
00059 tmp<Field<Type> > transform
00060 (
00061     const tensorField& trf,
00062     const Field<Type>& tf
00063 )
00064 {
00065     tmp<Field<Type> > tranf(new Field<Type> (tf.size()));
00066     transform(tranf(), trf, tf);
00067     return tranf;
00068 }
00069 
00070 
00071 template<class Type>
00072 tmp<Field<Type> > transform
00073 (
00074     const tensorField& trf,
00075     const tmp<Field<Type> >& ttf
00076 )
00077 {
00078     tmp<Field<Type> > tranf = reuseTmp<Type, Type>::New(ttf);
00079     transform(tranf(), trf, ttf());
00080     reuseTmp<Type, Type>::clear(ttf);
00081     return tranf;
00082 }
00083 
00084 
00085 template<class Type>
00086 tmp<Field<Type> > transform
00087 (
00088     const tmp<tensorField>& ttrf,
00089     const Field<Type>& tf
00090 )
00091 {
00092     tmp<Field<Type> > tranf(new Field<Type> (tf.size()));
00093     transform(tranf(), ttrf(), tf);
00094     ttrf.clear();
00095     return tranf;
00096 }
00097 
00098 
00099 template<class Type>
00100 tmp<Field<Type> > transform
00101 (
00102     const tmp<tensorField>& ttrf,
00103     const tmp<Field<Type> >& ttf
00104 )
00105 {
00106     tmp<Field<Type> > tranf = reuseTmp<Type, Type>::New(ttf);
00107     transform(tranf(), ttrf(), ttf());
00108     reuseTmp<Type, Type>::clear(ttf);
00109     ttrf.clear();
00110     return tranf;
00111 }
00112 
00113 
00114 template<class Type>
00115 void transform
00116 (
00117     Field<Type>& rtf,
00118     const tensor& t,
00119     const Field<Type>& tf
00120 )
00121 {
00122     TFOR_ALL_F_OP_FUNC_S_F(Type, rtf, =, transform, tensor, t, Type, tf)
00123 }
00124 
00125 
00126 template<class Type>
00127 tmp<Field<Type> > transform
00128 (
00129     const tensor& t,
00130     const Field<Type>& tf
00131 )
00132 {
00133     tmp<Field<Type> > tranf(new Field<Type>(tf.size()));
00134     transform(tranf(), t, tf);
00135     return tranf;
00136 }
00137 
00138 
00139 template<class Type>
00140 tmp<Field<Type> > transform
00141 (
00142     const tensor& t,
00143     const tmp<Field<Type> >& ttf
00144 )
00145 {
00146     tmp<Field<Type> > tranf = reuseTmp<Type, Type>::New(ttf);
00147     transform(tranf(), t, ttf());
00148     reuseTmp<Type, Type>::clear(ttf);
00149     return tranf;
00150 }
00151 
00152 
00153 template<class Type1, class Type2>
00154 tmp<Field<Type1> > transformFieldMask(const Field<Type2>& f)
00155 {
00156     return f;
00157 }
00158 
00159 template<class Type1, class Type2>
00160 tmp<Field<Type1> > transformFieldMask(const tmp<Field<Type2> >& tf)
00161 {
00162     return tmp<Field<Type1> >(tf.ptr());
00163 }
00164 
00165 
00166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00167 
00168 } // End namespace Foam
00169 
00170 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines