Fix tutorials: typo in tutorials/viscoelastic/viscoelasticFluidFoam/S-MDCPP/constant...
[OpenFOAM-1.6-ext.git] / src / blockMatrix / CoeffField / CoeffFieldFunctions.H
blob7a4ebe396d640e115d2e9a7d854a9ee599b5d50f
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2004-6 H. Jasak All rights reserved
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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
25 Description
26     Generic coefficient field type.
28 Author
29     Hrvoje Jasak, Wikki Ltd.  All rights reserved.
31 \*---------------------------------------------------------------------------*/
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 namespace Foam
38 /* * * * * * * * * * * * * * * * Global functions  * * * * * * * * * * * * * */
40 template<class Type>
41 tmp<CoeffField<Type> > inv(const CoeffField<Type>& f);
44 template<class Type>
45 void multiply
47     Field<Type>& f,
48     const CoeffField<Type>& f1,
49     const Type& f2
53 template<class Type>
54 void multiply
56     Field<Type>& f,
57     const CoeffField<Type>& f1,
58     const Field<Type>& f2
62 template<class Type>
63 void multiply
65     Field<Type>& f,
66     const Field<Type>& f1,
67     const CoeffField<Type>& f2
71 /* * * * * * * * * * * * * * * * Global operators  * * * * * * * * * * * * * */
73 #define UNARY_OPERATOR(op, opFunc)                                            \
74                                                                               \
75 template<class Type>                                                          \
76 void opFunc                                                                   \
77 (                                                                             \
78     CoeffField<Type>& f,                                                      \
79     const CoeffField<Type>& f1                                                \
80 );                                                                            \
81                                                                               \
82 template<class Type>                                                          \
83 tmp<CoeffField<Type> > operator op                                            \
84 (                                                                             \
85     const CoeffField<Type>& f1                                                \
86 );                                                                            \
87                                                                               \
88 template<class Type>                                                          \
89 tmp<CoeffField<Type> > operator op                                            \
90 (                                                                             \
91     const tmp<CoeffField<Type> >& tf1                                         \
94 UNARY_OPERATOR(-, negate)
96 #undef UNARY_OPERATOR
99 /* * * * * * * * * * * * * * * * Global operators  * * * * * * * * * * * * * */
101 #define BINARY_OPERATOR_FF(Type1, Type2, op, opFunc)                          \
102                                                                               \
103 template<class Type>                                                          \
104 tmp<Field<Type> > operator op                                                 \
105 (                                                                             \
106     const CoeffField<Type1>& f1,                                              \
107     const Type2& f2                                                           \
108 );                                                                            \
109                                                                               \
110                                                                               \
111 template<class Type>                                                          \
112 tmp<Field<Type> > operator op                                                 \
113 (                                                                             \
114     const CoeffField<Type1>& f1,                                              \
115     const Field<Type2>& f2                                                    \
116 );                                                                            \
117                                                                               \
118                                                                               \
119 template<class Type>                                                          \
120 tmp<Field<Type> > operator op                                                 \
121 (                                                                             \
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                                                 \
130 (                                                                             \
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                                                 \
138 (                                                                             \
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                                                 \
146 (                                                                             \
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                                                 \
154 (                                                                             \
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                                                 \
162 (                                                                             \
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                                                 \
170 (                                                                             \
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //