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