1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
25 Specialisation of FieldField\<T\> for scalar.
27 \*---------------------------------------------------------------------------*/
29 #include "scalarFieldField.H"
31 #define TEMPLATE template<template<class> class Field>
32 #include "FieldFieldFunctionsM.C"
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 template<template<class> class Field>
44 FieldField<Field, scalar>& f,
45 const FieldField<Field, scalar>& f1,
51 stabilise(f[i], f1[i], s);
55 template<template<class> class Field>
56 tmp<FieldField<Field, scalar> > stabilise
58 const FieldField<Field, scalar>& f1,
62 tmp<FieldField<Field, scalar> > tf
64 FieldField<Field, scalar>::NewCalculatedType(f1)
66 stabilise(tf(), f1, s);
70 template<template<class> class Field>
71 tmp<FieldField<Field, scalar> > stabilise
73 const tmp<FieldField<Field, scalar> >& tf1,
77 tmp<FieldField<Field, scalar> > tf(tf1.ptr());
78 stabilise(tf(), tf(), s);
83 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
85 BINARY_TYPE_OPERATOR(scalar, scalar, scalar, +, add)
86 BINARY_TYPE_OPERATOR(scalar, scalar, scalar, -, subtract)
88 BINARY_OPERATOR(scalar, scalar, scalar, *, multiply)
89 BINARY_OPERATOR(scalar, scalar, scalar, /, divide)
91 BINARY_TYPE_OPERATOR_SF(scalar, scalar, scalar, /, divide)
93 BINARY_FUNCTION(scalar, scalar, scalar, pow)
94 BINARY_TYPE_FUNCTION(scalar, scalar, scalar, pow)
96 BINARY_FUNCTION(scalar, scalar, scalar, atan2)
97 BINARY_TYPE_FUNCTION(scalar, scalar, scalar, atan2)
100 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
102 UNARY_FUNCTION(scalar, scalar, pow3)
103 UNARY_FUNCTION(scalar, scalar, pow4)
104 UNARY_FUNCTION(scalar, scalar, pow5)
105 UNARY_FUNCTION(scalar, scalar, pow6)
106 UNARY_FUNCTION(scalar, scalar, pow025)
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 // ************************************************************************* //