1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-6 H. Jasak All rights reserved
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 Generic coefficient field type.
29 Hrvoje Jasak, Wikki Ltd. All rights reserved.
31 \*---------------------------------------------------------------------------*/
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 /* * * * * * * * * * * * * * * * Global functions * * * * * * * * * * * * * */
41 tmp<CoeffField<Type> > inv(const CoeffField<Type>& f);
48 const CoeffField<Type>& f1,
57 const CoeffField<Type>& f1,
66 const Field<Type>& f1,
67 const CoeffField<Type>& f2
71 /* * * * * * * * * * * * * * * * Global operators * * * * * * * * * * * * * */
73 #define UNARY_OPERATOR(op, opFunc) \
75 template<class Type> \
78 CoeffField<Type>& f, \
79 const CoeffField<Type>& f1 \
82 template<class Type> \
83 tmp<CoeffField<Type> > operator op \
85 const CoeffField<Type>& f1 \
88 template<class Type> \
89 tmp<CoeffField<Type> > operator op \
91 const tmp<CoeffField<Type> >& tf1 \
94 UNARY_OPERATOR(-, negate)
99 /* * * * * * * * * * * * * * * * Global operators * * * * * * * * * * * * * */
101 #define BINARY_OPERATOR_FF(Type1, Type2, op, opFunc) \
103 template<class Type> \
104 tmp<Field<Type> > operator op \
106 const CoeffField<Type1>& f1, \
111 template<class Type> \
112 tmp<Field<Type> > operator op \
114 const CoeffField<Type1>& f1, \
115 const Field<Type2>& f2 \
119 template<class Type> \
120 tmp<Field<Type> > operator op \
122 const Field<Type2>& f1, \
123 const CoeffField<Type1>& f2 \
127 #define BINARY_OPERATOR_FTR(Type1, Type2, op, opFunc) \
128 template<class Type> \
129 tmp<Field<Type> > operator op \
131 const CoeffField<Type1>& f1, \
132 const tmp<Field<Type2> >& tf2 \
135 #define BINARY_OPERATOR_FT(Type1, Type2, op, opFunc) \
136 template<class Type> \
137 tmp<Field<Type> > operator op \
139 const Field<Type1>& f1, \
140 const tmp<CoeffField<Type2> >& tf2 \
143 #define BINARY_OPERATOR_TRF(Type1, Type2, op, opFunc) \
144 template<class Type> \
145 tmp<Field<Type> > operator op \
147 const tmp<Field<Type1> >& tf1, \
148 const CoeffField<Type2>& f2 \
151 #define BINARY_OPERATOR_TF(Type1, Type2, op, opFunc) \
152 template<class Type> \
153 tmp<Field<Type> > operator op \
155 const tmp<CoeffField<Type1> >& tf1, \
156 const Field<Type2>& f2 \
159 #define BINARY_OPERATOR_TRT(Type1, Type2, op, opFunc) \
160 template<class Type> \
161 tmp<Field<Type> > operator op \
163 const tmp<CoeffField<Type1> >& tf1, \
164 const tmp<Field<Type2> >& tf2 \
167 #define BINARY_OPERATOR_TTR(Type1, Type2, op, opFunc) \
168 template<class Type> \
169 tmp<Field<Type> > operator op \
171 const tmp<Field<Type1> >& tf1, \
172 const tmp<CoeffField<Type2> >& tf2 \
175 #define BINARY_OPERATOR_R(Type1, Type2, op, opFunc) \
176 BINARY_OPERATOR_FF(Type1, Type2, op, opFunc) \
177 BINARY_OPERATOR_FTR(Type1, Type2, op, opFunc) \
178 BINARY_OPERATOR_TRF(Type1, Type2, op, opFunc) \
179 BINARY_OPERATOR_TRT(Type1, Type2, op, opFunc)
181 BINARY_OPERATOR_R(Type, Type, *, multiply)
183 #undef BINARY_OPERATOR_R
184 #undef BINARY_OPERATOR_FF
185 #undef BINARY_OPERATOR_FTR
186 #undef BINARY_OPERATOR_TF
187 #undef BINARY_OPERATOR_TTR
188 #undef BINARY_OPERATOR_FT
189 #undef BINARY_OPERATOR_TRF
190 #undef BINARY_OPERATOR_TRT
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 } // End namespace Foam
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //