1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 Specialisation of FieldField\<T\> for scalar.
28 \*---------------------------------------------------------------------------*/
30 #include "scalarFieldField.H"
32 #define TEMPLATE template<template<class> class Field>
33 #include "FieldFieldFunctionsM.C"
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 template<template<class> class Field>
45 FieldField<Field, scalar>& f,
46 const FieldField<Field, scalar>& f1,
52 stabilise(f[i], f1[i], s);
56 template<template<class> class Field>
57 tmp<FieldField<Field, scalar> > stabilise
59 const FieldField<Field, scalar>& f1,
63 tmp<FieldField<Field, scalar> > tf
65 FieldField<Field, scalar>::NewCalculatedType(f1)
67 stabilise(tf(), f1, s);
71 template<template<class> class Field>
72 tmp<FieldField<Field, scalar> > stabilise
74 const tmp<FieldField<Field, scalar> >& tf1,
78 tmp<FieldField<Field, scalar> > tf(tf1.ptr());
79 stabilise(tf(), tf(), s);
84 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
86 BINARY_TYPE_OPERATOR(scalar, scalar, scalar, +, add)
87 BINARY_TYPE_OPERATOR(scalar, scalar, scalar, -, subtract)
89 BINARY_OPERATOR(scalar, scalar, scalar, *, multiply)
90 BINARY_OPERATOR(scalar, scalar, scalar, /, divide)
92 BINARY_TYPE_OPERATOR_SF(scalar, scalar, scalar, /, divide)
94 BINARY_FUNCTION(scalar, scalar, scalar, pow)
95 BINARY_TYPE_FUNCTION(scalar, scalar, scalar, pow)
97 BINARY_FUNCTION(scalar, scalar, scalar, atan2)
98 BINARY_TYPE_FUNCTION(scalar, scalar, scalar, atan2)
101 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
103 UNARY_FUNCTION(scalar, scalar, pow3)
104 UNARY_FUNCTION(scalar, scalar, pow4)
105 UNARY_FUNCTION(scalar, scalar, pow5)
106 UNARY_FUNCTION(scalar, scalar, pow6)
107 UNARY_FUNCTION(scalar, scalar, sqrt)
108 UNARY_FUNCTION(scalar, scalar, sign)
109 UNARY_FUNCTION(scalar, scalar, pos)
110 UNARY_FUNCTION(scalar, scalar, neg)
111 UNARY_FUNCTION(scalar, scalar, exp)
112 UNARY_FUNCTION(scalar, scalar, log)
113 UNARY_FUNCTION(scalar, scalar, log10)
114 UNARY_FUNCTION(scalar, scalar, sin)
115 UNARY_FUNCTION(scalar, scalar, cos)
116 UNARY_FUNCTION(scalar, scalar, tan)
117 UNARY_FUNCTION(scalar, scalar, asin)
118 UNARY_FUNCTION(scalar, scalar, acos)
119 UNARY_FUNCTION(scalar, scalar, atan)
120 UNARY_FUNCTION(scalar, scalar, sinh)
121 UNARY_FUNCTION(scalar, scalar, cosh)
122 UNARY_FUNCTION(scalar, scalar, tanh)
123 UNARY_FUNCTION(scalar, scalar, asinh)
124 UNARY_FUNCTION(scalar, scalar, acosh)
125 UNARY_FUNCTION(scalar, scalar, atanh)
126 UNARY_FUNCTION(scalar, scalar, erf)
127 UNARY_FUNCTION(scalar, scalar, erfc)
128 UNARY_FUNCTION(scalar, scalar, lgamma)
129 UNARY_FUNCTION(scalar, scalar, j0)
130 UNARY_FUNCTION(scalar, scalar, j1)
131 UNARY_FUNCTION(scalar, scalar, y0)
132 UNARY_FUNCTION(scalar, scalar, y1)
135 #define BesselFunc(func) \
137 template<template<class> class Field> \
140 FieldField<Field, scalar>& res, \
142 const FieldField<Field, scalar>& sf \
147 func(res[i], n, sf[i]); \
151 template<template<class> class Field> \
152 tmp<FieldField<Field, scalar> > func \
155 const FieldField<Field, scalar>& sf \
158 tmp<FieldField<Field, scalar> > tRes \
160 FieldField<Field, scalar>::NewCalculatedType(sf) \
162 func(tRes(), n, sf); \
166 template<template<class> class Field> \
167 tmp<FieldField<Field, scalar> > func \
170 const tmp<FieldField<Field, scalar> >& tsf \
173 tmp<FieldField<Field, scalar> > tRes \
175 reuseTmpFieldField<Field, scalar, scalar>::New(tsf) \
177 func(tRes(), n, tsf()); \
178 reuseTmpFieldField<Field, scalar, scalar>::clear(tsf); \
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 } // End namespace Foam
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 #include "undefFieldFunctionsM.H"
196 // ************************************************************************* //