00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include "scalarField.H"
00031
00032 #define TEMPLATE
00033 #include "FieldFunctionsM.C"
00034
00035
00036
00037 namespace Foam
00038 {
00039
00040
00041
00042 template<>
00043 tmp<scalarField> scalarField::component(const direction) const
00044 {
00045 return *this;
00046 }
00047
00048 void component(scalarField& sf, const UList<scalar>& f, const direction)
00049 {
00050 sf = f;
00051 }
00052
00053 template<>
00054 void scalarField::replace(const direction, const UList<scalar>& sf)
00055 {
00056 *this = sf;
00057 }
00058
00059 template<>
00060 void scalarField::replace(const direction, const scalar& s)
00061 {
00062 *this = s;
00063 }
00064
00065
00066 void stabilise(scalarField& res, const UList<scalar>& sf, const scalar s)
00067 {
00068 TFOR_ALL_F_OP_FUNC_S_F
00069 (
00070 scalar, res, =, ::Foam::stabilise, scalar, s, scalar, sf
00071 )
00072 }
00073
00074 tmp<scalarField> stabilise(const UList<scalar>& sf, const scalar s)
00075 {
00076 tmp<scalarField> tRes(new scalarField(sf.size()));
00077 stabilise(tRes(), sf, s);
00078 return tRes;
00079 }
00080
00081 tmp<scalarField> stabilise(const tmp<scalarField>& tsf, const scalar s)
00082 {
00083 tmp<scalarField> tRes = reuseTmp<scalar, scalar>::New(tsf);
00084 stabilise(tRes(), tsf(), s);
00085 reuseTmp<scalar, scalar>::clear(tsf);
00086 return tRes;
00087 }
00088
00089
00090
00091
00092 BINARY_TYPE_OPERATOR(scalar, scalar, scalar, +, add)
00093 BINARY_TYPE_OPERATOR(scalar, scalar, scalar, -, subtract)
00094
00095 BINARY_OPERATOR(scalar, scalar, scalar, *, multiply)
00096 BINARY_OPERATOR(scalar, scalar, scalar, /, divide)
00097
00098 BINARY_TYPE_OPERATOR_SF(scalar, scalar, scalar, /, divide)
00099
00100 BINARY_FUNCTION(scalar, scalar, scalar, pow)
00101 BINARY_TYPE_FUNCTION(scalar, scalar, scalar, pow)
00102
00103 BINARY_FUNCTION(scalar, scalar, scalar, atan2)
00104 BINARY_TYPE_FUNCTION(scalar, scalar, scalar, atan2)
00105
00106
00107
00108 UNARY_FUNCTION(scalar, scalar, pow3)
00109 UNARY_FUNCTION(scalar, scalar, pow4)
00110 UNARY_FUNCTION(scalar, scalar, pow5)
00111 UNARY_FUNCTION(scalar, scalar, pow6)
00112 UNARY_FUNCTION(scalar, scalar, sqrt)
00113 UNARY_FUNCTION(scalar, scalar, sign)
00114 UNARY_FUNCTION(scalar, scalar, pos)
00115 UNARY_FUNCTION(scalar, scalar, neg)
00116 UNARY_FUNCTION(scalar, scalar, exp)
00117 UNARY_FUNCTION(scalar, scalar, log)
00118 UNARY_FUNCTION(scalar, scalar, log10)
00119 UNARY_FUNCTION(scalar, scalar, sin)
00120 UNARY_FUNCTION(scalar, scalar, cos)
00121 UNARY_FUNCTION(scalar, scalar, tan)
00122 UNARY_FUNCTION(scalar, scalar, asin)
00123 UNARY_FUNCTION(scalar, scalar, acos)
00124 UNARY_FUNCTION(scalar, scalar, atan)
00125 UNARY_FUNCTION(scalar, scalar, sinh)
00126 UNARY_FUNCTION(scalar, scalar, cosh)
00127 UNARY_FUNCTION(scalar, scalar, tanh)
00128 UNARY_FUNCTION(scalar, scalar, asinh)
00129 UNARY_FUNCTION(scalar, scalar, acosh)
00130 UNARY_FUNCTION(scalar, scalar, atanh)
00131 UNARY_FUNCTION(scalar, scalar, erf)
00132 UNARY_FUNCTION(scalar, scalar, erfc)
00133 UNARY_FUNCTION(scalar, scalar, lgamma)
00134 UNARY_FUNCTION(scalar, scalar, j0)
00135 UNARY_FUNCTION(scalar, scalar, j1)
00136 UNARY_FUNCTION(scalar, scalar, y0)
00137 UNARY_FUNCTION(scalar, scalar, y1)
00138
00139
00140 #define BesselFunc(func) \
00141 void func(scalarField& res, const int n, const UList<scalar>& sf) \
00142 { \
00143 TFOR_ALL_F_OP_FUNC_S_F(scalar, res, =, ::Foam::func, int, n, scalar, sf) \
00144 } \
00145 \
00146 tmp<scalarField> func(const int n, const UList<scalar>& sf) \
00147 { \
00148 tmp<scalarField> tRes(new scalarField(sf.size())); \
00149 func(tRes(), n, sf); \
00150 return tRes; \
00151 } \
00152 \
00153 tmp<scalarField> func(const int n, const tmp<scalarField>& tsf) \
00154 { \
00155 tmp<scalarField> tRes = reuseTmp<scalar, scalar>::New(tsf); \
00156 func(tRes(), n, tsf()); \
00157 reuseTmp<scalar, scalar>::clear(tsf); \
00158 return tRes; \
00159 }
00160
00161 BesselFunc(jn)
00162 BesselFunc(yn)
00163
00164 #undef BesselFunc
00165
00166
00167
00168
00169 }
00170
00171
00172
00173 #include "undefFieldFunctionsM.H"
00174
00175