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

FieldFieldFunctionsM.H

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     High performance macro functions for Field<Type> algebra.
00026     These expand using either array element access (for vector machines)
00027     or pointer dereferencing for scalar machines as appropriate.
00028 
00029 \*---------------------------------------------------------------------------*/
00030 
00031 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00032 
00033 #define UNARY_FUNCTION(ReturnType, Type1, Func)                               \
00034                                                                               \
00035 TEMPLATE                                                                      \
00036 void Func                                                                     \
00037 (                                                                             \
00038     FieldField<Field, ReturnType>& res,                                       \
00039     const FieldField<Field, Type1>& f                                         \
00040 );                                                                            \
00041                                                                               \
00042 TEMPLATE                                                                      \
00043 tmp<FieldField<Field, ReturnType> > Func                                      \
00044 (                                                                             \
00045     const FieldField<Field, Type1>& f                                         \
00046 );                                                                            \
00047                                                                               \
00048 TEMPLATE                                                                      \
00049 tmp<FieldField<Field, ReturnType> > Func                                      \
00050 (                                                                             \
00051     const tmp<FieldField<Field, Type1> >& tf                                  \
00052 );
00053 
00054 
00055 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00056 
00057 #define UNARY_OPERATOR(ReturnType, Type1, Op, OpFunc)                         \
00058                                                                               \
00059 TEMPLATE                                                                      \
00060 void OpFunc                                                                   \
00061 (                                                                             \
00062     FieldField<Field, ReturnType>& res,                                       \
00063     const FieldField<Field, Type1>& f                                         \
00064 );                                                                            \
00065                                                                               \
00066 TEMPLATE                                                                      \
00067 tmp<FieldField<Field, ReturnType> > operator Op                               \
00068 (                                                                             \
00069     const FieldField<Field, Type1>& f                                         \
00070 );                                                                            \
00071                                                                               \
00072 TEMPLATE                                                                      \
00073 tmp<FieldField<Field, ReturnType> > operator Op                               \
00074 (                                                                             \
00075     const tmp<FieldField<Field, Type1> >& tf                                  \
00076 );
00077 
00078 
00079 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00080 
00081 #define BINARY_FUNCTION(ReturnType, Type1, Type2, Func)                       \
00082                                                                               \
00083 TEMPLATE                                                                      \
00084 void func                                                                     \
00085 (                                                                             \
00086     FieldField<Field, ReturnType>& f,                                         \
00087     const FieldField<Field, Type1>& f1,                                       \
00088     const FieldField<Field, Type2>& f2                                        \
00089 );                                                                            \
00090                                                                               \
00091 TEMPLATE                                                                      \
00092 tmp<FieldField<Field, ReturnType> > func                                      \
00093 (                                                                             \
00094     const FieldField<Field, Type1>& f1,                                       \
00095     const FieldField<Field, Type2>& f2                                        \
00096 );                                                                            \
00097                                                                               \
00098 TEMPLATE                                                                      \
00099 tmp<FieldField<Field, ReturnType> > func                                      \
00100 (                                                                             \
00101     const FieldField<Field, Type1>& f1,                                       \
00102     const tmp<FieldField<Field, Type2> >& tf2                                 \
00103 );                                                                            \
00104                                                                               \
00105 TEMPLATE                                                                      \
00106 tmp<FieldField<Field, ReturnType> > func                                      \
00107 (                                                                             \
00108     const tmp<FieldField<Field, Type1> >& tf1,                                \
00109     const FieldField<Field, Type2>& f2                                        \
00110 );                                                                            \
00111                                                                               \
00112 TEMPLATE                                                                      \
00113 tmp<FieldField<Field, ReturnType> > func                                      \
00114 (                                                                             \
00115     const tmp<FieldField<Field, Type1> >& tf1,                                \
00116     const tmp<FieldField<Field, Type2> >& tf2                                 \
00117 );
00118 
00119 
00120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00121 
00122 #define BINARY_TYPE_FUNCTION_SF(ReturnType, Type1, Type2, Func)               \
00123                                                                               \
00124 TEMPLATE                                                                      \
00125 void func                                                                     \
00126 (                                                                             \
00127     FieldField<Field, ReturnType>& f,                                         \
00128     const Type1& s1,                                                          \
00129     const FieldField<Field, Type2>& f2                                        \
00130 );                                                                            \
00131                                                                               \
00132 TEMPLATE                                                                      \
00133 tmp<FieldField<Field, ReturnType> > func                                      \
00134 (                                                                             \
00135     const Type1& s1,                                                          \
00136     const FieldField<Field, Type1>& f2                                        \
00137 );                                                                            \
00138                                                                               \
00139 TEMPLATE                                                                      \
00140 tmp<FieldField<Field, ReturnType> > func                                      \
00141 (                                                                             \
00142     const Type1& s1,                                                          \
00143     const tmp<FieldField<Field, Type1> >& tf2                                 \
00144 );
00145 
00146 
00147 #define BINARY_TYPE_FUNCTION_FS(ReturnType, Type1, Type2, Func)               \
00148                                                                               \
00149 TEMPLATE                                                                      \
00150 void func                                                                     \
00151 (                                                                             \
00152     FieldField<Field, ReturnType>& f,                                         \
00153     const FieldField<Field, Type1>& f1,                                       \
00154     const Type2& s                                                            \
00155 );                                                                            \
00156                                                                               \
00157 TEMPLATE                                                                      \
00158 tmp<FieldField<Field, ReturnType> > func                                      \
00159 (                                                                             \
00160     const FieldField<Field, Type1>& f1,                                       \
00161     const Type2& s                                                            \
00162 );                                                                            \
00163                                                                               \
00164 TEMPLATE                                                                      \
00165 tmp<FieldField<Field, ReturnType> > func                                      \
00166 (                                                                             \
00167     const tmp<FieldField<Field, Type1> >& tf1,                                \
00168     const Type2& s                                                            \
00169 );
00170 
00171 
00172 #define BINARY_TYPE_FUNCTION(ReturnType, Type1, Type2, Func)                  \
00173     BINARY_TYPE_FUNCTION_SF(ReturnType, Type1, Type2, Func)                   \
00174     BINARY_TYPE_FUNCTION_FS(ReturnType, Type1, Type2, Func)
00175 
00176 
00177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00178 
00179 #define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpFunc)                 \
00180                                                                               \
00181 TEMPLATE                                                                      \
00182 void OpFunc                                                                   \
00183 (                                                                             \
00184     FieldField<Field, ReturnType>& f,                                         \
00185     const FieldField<Field, Type1>& f1,                                       \
00186     const FieldField<Field, Type2>& f2                                        \
00187 );                                                                            \
00188                                                                               \
00189 TEMPLATE                                                                      \
00190 tmp<FieldField<Field, ReturnType> > operator Op                               \
00191 (                                                                             \
00192     const FieldField<Field, Type1>& f1,                                       \
00193     const FieldField<Field, Type2>& f2                                        \
00194 );                                                                            \
00195                                                                               \
00196 TEMPLATE                                                                      \
00197 tmp<FieldField<Field, ReturnType> > operator Op                               \
00198 (                                                                             \
00199     const FieldField<Field, Type1>& f1,                                       \
00200     const tmp<FieldField<Field, Type2> >& tf2                                 \
00201 );                                                                            \
00202                                                                               \
00203 TEMPLATE                                                                      \
00204 tmp<FieldField<Field, ReturnType> > operator Op                               \
00205 (                                                                             \
00206     const tmp<FieldField<Field, Type1> >& tf1,                                \
00207     const FieldField<Field, Type2>& f2                                        \
00208 );                                                                            \
00209                                                                               \
00210 TEMPLATE                                                                      \
00211 tmp<FieldField<Field, ReturnType> > operator Op                               \
00212 (                                                                             \
00213     const tmp<FieldField<Field, Type1> >& tf1,                                \
00214     const tmp<FieldField<Field, Type2> >& tf2                                 \
00215 );
00216 
00217 
00218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00219 
00220 #define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpFunc)         \
00221                                                                               \
00222 TEMPLATE                                                                      \
00223 void OpFunc                                                                   \
00224 (                                                                             \
00225     FieldField<Field, ReturnType>& f,                                         \
00226     const Type1& s1,                                                          \
00227     const FieldField<Field, Type2>& f2                                        \
00228 );                                                                            \
00229                                                                               \
00230 TEMPLATE                                                                      \
00231 tmp<FieldField<Field, ReturnType> > operator Op                               \
00232 (                                                                             \
00233     const Type1& s1,                                                          \
00234     const FieldField<Field, Type2>& f2                                        \
00235 );                                                                            \
00236                                                                               \
00237 TEMPLATE                                                                      \
00238 tmp<FieldField<Field, ReturnType> > operator Op                               \
00239 (                                                                             \
00240     const Type1& s1,                                                          \
00241     const tmp<FieldField<Field, Type2> >& tf2                                 \
00242 );
00243 
00244 
00245 #define BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpFunc)         \
00246                                                                               \
00247 TEMPLATE                                                                      \
00248 void OpFunc                                                                   \
00249 (                                                                             \
00250     FieldField<Field, ReturnType>& f,                                         \
00251     const FieldField<Field, Type1>& f1,                                       \
00252     const Type2& s2                                                           \
00253 );                                                                            \
00254                                                                               \
00255 TEMPLATE                                                                      \
00256 tmp<FieldField<Field, ReturnType> > operator Op                               \
00257 (                                                                             \
00258     const FieldField<Field, Type1>& f1,                                       \
00259     const Type2& s2                                                           \
00260 );                                                                            \
00261                                                                               \
00262 TEMPLATE                                                                      \
00263 tmp<FieldField<Field, ReturnType> > operator Op                               \
00264 (                                                                             \
00265     const tmp<FieldField<Field, Type1> >& tf1,                                \
00266     const Type2& s2                                                           \
00267 );
00268 
00269 
00270 #define BINARY_TYPE_OPERATOR(ReturnType, Type1, Type2, Op, OpFunc)            \
00271     BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpFunc)             \
00272     BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpFunc)
00273 
00274 
00275 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines