scalarField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 Typedef
25  Foam::scalarField
26 
27 Description
28  Specialisation of Field<T> for scalar.
29 
30 SourceFiles
31  scalarField.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef scalarField_H
36 #define scalarField_H
37 
38 #include "Field.H"
39 #include "scalar.H"
40 
41 #define TEMPLATE
42 #include "FieldFunctionsM.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 typedef Field<scalar> scalarField;
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 template<>
54 tmp<scalarField> scalarField::component(const direction) const;
55 
56 void component
57 (
58  scalarField& sf,
59  const UList<scalar>& f,
60  const direction
61 );
62 
63 template<>
64 void scalarField::replace(const direction, const UList<scalar>& sf);
65 
66 template<>
67 void scalarField::replace(const direction, const scalar& s);
68 
69 
70 void stabilise(scalarField& Res, const UList<scalar>& sf, const scalar s);
71 tmp<scalarField> stabilise(const UList<scalar>&, const scalar s);
72 tmp<scalarField> stabilise(const tmp<scalarField>&, const scalar s);
73 
74 
75 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
76 
77 template<>
78 scalar sumProd(const UList<scalar>& f1, const UList<scalar>& f2);
79 
80 
81 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
82 
83 BINARY_TYPE_OPERATOR(scalar, scalar, scalar, +, add)
84 BINARY_TYPE_OPERATOR(scalar, scalar, scalar, -, subtract)
85 
86 BINARY_OPERATOR(scalar, scalar, scalar, *, multiply)
87 BINARY_OPERATOR(scalar, scalar, scalar, /, divide)
88 
89 BINARY_TYPE_OPERATOR_SF(scalar, scalar, scalar, /, divide)
90 
91 BINARY_FUNCTION(scalar, scalar, scalar, pow)
92 BINARY_TYPE_FUNCTION(scalar, scalar, scalar, pow)
93 
94 BINARY_FUNCTION(scalar, scalar, scalar, atan2)
95 BINARY_TYPE_FUNCTION(scalar, scalar, scalar, atan2)
96 
97 
98 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
99 
100 UNARY_FUNCTION(scalar, scalar, pow3)
101 UNARY_FUNCTION(scalar, scalar, pow4)
102 UNARY_FUNCTION(scalar, scalar, pow5)
103 UNARY_FUNCTION(scalar, scalar, pow6)
104 UNARY_FUNCTION(scalar, scalar, pow025)
105 UNARY_FUNCTION(scalar, scalar, sqrt)
106 UNARY_FUNCTION(scalar, scalar, cbrt)
107 UNARY_FUNCTION(scalar, scalar, sign)
108 UNARY_FUNCTION(scalar, scalar, pos)
109 UNARY_FUNCTION(scalar, scalar, pos0)
110 UNARY_FUNCTION(scalar, scalar, neg)
111 UNARY_FUNCTION(scalar, scalar, neg0)
112 UNARY_FUNCTION(scalar, scalar, posPart)
113 UNARY_FUNCTION(scalar, scalar, negPart)
114 UNARY_FUNCTION(scalar, scalar, exp)
115 UNARY_FUNCTION(scalar, scalar, log)
116 UNARY_FUNCTION(scalar, scalar, log10)
117 UNARY_FUNCTION(scalar, scalar, sin)
118 UNARY_FUNCTION(scalar, scalar, cos)
119 UNARY_FUNCTION(scalar, scalar, tan)
120 UNARY_FUNCTION(scalar, scalar, asin)
121 UNARY_FUNCTION(scalar, scalar, acos)
122 UNARY_FUNCTION(scalar, scalar, atan)
123 UNARY_FUNCTION(scalar, scalar, sinh)
124 UNARY_FUNCTION(scalar, scalar, cosh)
125 UNARY_FUNCTION(scalar, scalar, tanh)
126 UNARY_FUNCTION(scalar, scalar, asinh)
127 UNARY_FUNCTION(scalar, scalar, acosh)
128 UNARY_FUNCTION(scalar, scalar, atanh)
129 UNARY_FUNCTION(scalar, scalar, erf)
130 UNARY_FUNCTION(scalar, scalar, erfc)
131 UNARY_FUNCTION(scalar, scalar, lgamma)
132 UNARY_FUNCTION(scalar, scalar, j0)
133 UNARY_FUNCTION(scalar, scalar, j1)
134 UNARY_FUNCTION(scalar, scalar, y0)
135 UNARY_FUNCTION(scalar, scalar, y1)
136 
137 UNARY_FUNCTION(scalar, scalar, degToRad)
138 UNARY_FUNCTION(scalar, scalar, radToDeg)
139 UNARY_FUNCTION(scalar, scalar, atmToPa)
140 UNARY_FUNCTION(scalar, scalar, paToAtm)
141 
142 #define BesselFunc(func) \
143 void func(scalarField& Res, const int n, const UList<scalar>& sf); \
144 tmp<scalarField> func(const int n, const UList<scalar>&); \
145 tmp<scalarField> func(const int n, const tmp<scalarField>&);
146 
147 BesselFunc(jn)
148 BesselFunc(yn)
149 
150 #undef BesselFunc
151 
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 } // End namespace Foam
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 #include "undefFieldFunctionsM.H"
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 #endif
164 
165 // ************************************************************************* //
void divide(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
dimensionedScalar sign(const dimensionedScalar &ds)
dimensionedScalar tanh(const dimensionedScalar &ds)
dimensionedScalar acos(const dimensionedScalar &ds)
#define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
void multiply(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
scalar radToDeg(const scalar rad)
Conversion from radians to degrees.
dimensionedScalar log(const dimensionedScalar &ds)
#define UNARY_FUNCTION(ReturnType, Type1, Func, Dfunc)
uint8_t direction
Definition: direction.H:45
dimensionedScalar yn(const int n, const dimensionedScalar &ds)
#define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc)
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensionedScalar pow025(const dimensionedScalar &ds)
dimensionedScalar y0(const dimensionedScalar &ds)
#define BINARY_TYPE_FUNCTION(ReturnType, Type1, Type2, Func)
void replace(const direction, const UList< cmptType > &)
Replace a component field of the field.
Definition: Field.C:472
void subtract(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dimensionedScalar posPart(const dimensionedScalar &ds)
dimensionedScalar neg(const dimensionedScalar &ds)
dimensionedScalar asin(const dimensionedScalar &ds)
dimensionedScalar pow5(const dimensionedScalar &ds)
scalar degToRad(const scalar deg)
Conversion from degrees to radians.
dimensionedScalar j1(const dimensionedScalar &ds)
scalar sumProd(const UList< Type > &f1, const UList< Type > &f2)
#define BINARY_FUNCTION(ReturnType, Type1, Type2, Func)
dimensionedScalar pos(const dimensionedScalar &ds)
dimensionedScalar acosh(const dimensionedScalar &ds)
scalar atmToPa(const scalar atm)
Conversion from atm to Pa.
dimensionedScalar cos(const dimensionedScalar &ds)
dimensionedScalar exp(const dimensionedScalar &ds)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensionedScalar asinh(const dimensionedScalar &ds)
dimensionedScalar jn(const int n, const dimensionedScalar &ds)
dimensionedScalar cbrt(const dimensionedScalar &ds)
dimensionedScalar neg0(const dimensionedScalar &ds)
dimensionedScalar atanh(const dimensionedScalar &ds)
dimensionedScalar y1(const dimensionedScalar &ds)
tmp< Field< cmptType > > component(const direction) const
Return a component field of the field.
Definition: Field.C:460
High performance macro functions for Field<Type> algebra. These expand using either array element acc...
dimensionedScalar pos0(const dimensionedScalar &ds)
dimensionedScalar sin(const dimensionedScalar &ds)
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dimensionedScalar erf(const dimensionedScalar &ds)
dimensionedScalar atan2(const dimensionedScalar &x, const dimensionedScalar &y)
dimensionedScalar lgamma(const dimensionedScalar &ds)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
dimensionedScalar pow3(const dimensionedScalar &ds)
tmp< DimensionedField< scalar, GeoMesh > > stabilise(const DimensionedField< scalar, GeoMesh > &dsf, const dimensioned< scalar > &ds)
dimensionedScalar erfc(const dimensionedScalar &ds)
scalar paToAtm(const scalar pa)
Conversion from atm to Pa.
dimensionedScalar sinh(const dimensionedScalar &ds)
dimensionedScalar atan(const dimensionedScalar &ds)
dimensionedScalar pow4(const dimensionedScalar &ds)
dimensionedScalar pow6(const dimensionedScalar &ds)
dimensionedScalar cosh(const dimensionedScalar &ds)
dimensionedScalar tan(const dimensionedScalar &ds)
dimensionedScalar j0(const dimensionedScalar &ds)
#define BINARY_TYPE_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
#define BesselFunc(func)
Definition: scalarField.H:142
dimensionedScalar log10(const dimensionedScalar &ds)
Namespace for OpenFOAM.
dimensionedScalar negPart(const dimensionedScalar &ds)