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

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