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

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