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-2026 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 
64 template<>
65 void scalarField::replace(const direction, const UList<scalar>& sf);
66 
67 template<>
68 void scalarField::replace(const direction, const scalar& s);
69 
70 
71 void stabilise(scalarField& Res, const UList<scalar>& sf, const scalar s);
72 
73 tmp<scalarField> stabilise(const Field<scalar>&, const scalar s);
74 
75 tmp<scalarField> stabilise(const SubField<scalar>&, const scalar s);
76 
77 tmp<scalarField> stabilise(const tmp<scalarField>&, const scalar s);
78 
79 
80 tmp<scalarField> linearSequence
81 (
82  const scalar start,
83  const scalar end,
84  const label n
85 );
86 
87 tmp<scalarField> linearSequence01(const label n);
88 
89 
90 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
91 
92 template<>
93 scalar sumProd(const UList<scalar>& f1, const UList<scalar>& f2);
94 
95 
96 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
97 
98 BINARY_TYPE_OPERATOR(scalar, scalar, scalar, +, add)
99 BINARY_TYPE_OPERATOR(scalar, scalar, scalar, -, subtract)
100 
101 BINARY_OPERATOR(scalar, scalar, scalar, *, multiply)
102 BINARY_OPERATOR(scalar, scalar, scalar, /, divide)
103 
104 BINARY_TYPE_OPERATOR_SF(scalar, scalar, scalar, /, divide)
105 
106 BINARY_FUNCTION(scalar, scalar, scalar, pow)
107 BINARY_TYPE_FUNCTION(scalar, scalar, scalar, pow)
108 BINARY_FUNCTION(scalar, scalar, label, integerPow)
109 BINARY_TYPE_FUNCTION_FS(scalar, scalar, label, integerPow)
110 BINARY_FUNCTION(scalar, scalar, label, integerRoot)
111 BINARY_TYPE_FUNCTION_FS(scalar, scalar, label, integerRoot)
112 
113 BINARY_FUNCTION(scalar, scalar, scalar, atan2)
114 BINARY_TYPE_FUNCTION(scalar, scalar, scalar, atan2)
115 
116 
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
118 
119 UNARY_FUNCTION(scalar, scalar, pow3)
120 UNARY_FUNCTION(scalar, scalar, pow4)
121 UNARY_FUNCTION(scalar, scalar, pow5)
122 UNARY_FUNCTION(scalar, scalar, pow6)
123 UNARY_FUNCTION(scalar, scalar, pow025)
124 UNARY_FUNCTION(scalar, scalar, sqrt)
125 UNARY_FUNCTION(scalar, scalar, cbrt)
126 UNARY_FUNCTION(scalar, scalar, sign)
127 UNARY_FUNCTION(scalar, scalar, pos)
128 UNARY_FUNCTION(scalar, scalar, pos0)
129 UNARY_FUNCTION(scalar, scalar, neg)
130 UNARY_FUNCTION(scalar, scalar, neg0)
131 UNARY_FUNCTION(scalar, scalar, posPart)
132 UNARY_FUNCTION(scalar, scalar, negPart)
133 UNARY_FUNCTION(scalar, scalar, exp)
134 UNARY_FUNCTION(scalar, scalar, log)
135 UNARY_FUNCTION(scalar, scalar, log10)
136 UNARY_FUNCTION(scalar, scalar, sin)
137 UNARY_FUNCTION(scalar, scalar, cos)
138 UNARY_FUNCTION(scalar, scalar, tan)
139 UNARY_FUNCTION(scalar, scalar, asin)
140 UNARY_FUNCTION(scalar, scalar, acos)
141 UNARY_FUNCTION(scalar, scalar, atan)
142 UNARY_FUNCTION(scalar, scalar, sinh)
143 UNARY_FUNCTION(scalar, scalar, cosh)
144 UNARY_FUNCTION(scalar, scalar, tanh)
145 UNARY_FUNCTION(scalar, scalar, asinh)
146 UNARY_FUNCTION(scalar, scalar, acosh)
147 UNARY_FUNCTION(scalar, scalar, atanh)
148 UNARY_FUNCTION(scalar, scalar, erf)
149 UNARY_FUNCTION(scalar, scalar, erfc)
150 UNARY_FUNCTION(scalar, scalar, lgamma)
151 UNARY_FUNCTION(scalar, scalar, j0)
152 UNARY_FUNCTION(scalar, scalar, j1)
153 UNARY_FUNCTION(scalar, scalar, y0)
154 UNARY_FUNCTION(scalar, scalar, y1)
155 
156 #define BesselFunc(func) \
157 void func(scalarField& Res, const int n, const UList<scalar>& sf); \
158 tmp<scalarField> func(const int n, const UList<scalar>&); \
159 tmp<scalarField> func(const int n, const tmp<scalarField>&);
160 
161 BesselFunc(jn)
162 BesselFunc(yn)
163 
164 #undef BesselFunc
165 
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 } // End namespace Foam
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 #include "undefFieldFunctionsM.H"
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 #endif
178 
179 // ************************************************************************* //
#define BINARY_FUNCTION(ReturnType, Type1, Type2, Func)
#define BINARY_TYPE_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
#define BINARY_TYPE_FUNCTION_FS(ReturnType, Type1, Type2, Func)
#define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
#define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc)
#define UNARY_FUNCTION(ReturnType, Type1, Func, Dfunc)
#define BINARY_TYPE_FUNCTION(ReturnType, Type1, Type2, Func)
High performance macro functions for Field<Type> algebra. These expand using either array element acc...
label n
void replace(const direction, const UList< cmptType > &)
Replace a component field of the field.
Definition: Field.C:498
tmp< Field< cmptType > > component(const direction) const
Return a component field of the field.
Definition: Field.C:486
volScalarField sf(fieldObject, mesh)
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), lagrangian::cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Namespace for OpenFOAM.
void subtract(GeometricField< typename typeOfSum< Type1, Type2 >::type, GeoMesh, PrimitiveField1 > &gf, const GeometricField< Type1, GeoMesh, PrimitiveField2 > &gf1, const GeometricField< Type2, GeoMesh, PrimitiveField3 > &gf2)
dimensionedScalar pos(const dimensionedScalar &ds)
scalar integerRoot(const scalar x, const label e)
Compute the power of the number x to the reciprocal integer 1/e.
Definition: scalarI.H:55
dimensionedScalar erfc(const dimensionedScalar &ds)
dimensionedScalar asin(const dimensionedScalar &ds)
dimensionedScalar exp(const dimensionedScalar &ds)
dimensionedScalar tan(const dimensionedScalar &ds)
dimensionedScalar pos0(const dimensionedScalar &ds)
dimensionedScalar sign(const dimensionedScalar &ds)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
void add(GeometricField< typename typeOfSum< Type1, Type2 >::type, GeoMesh, PrimitiveField1 > &gf, const GeometricField< Type1, GeoMesh, PrimitiveField2 > &gf1, const GeometricField< Type2, GeoMesh, PrimitiveField3 > &gf2)
dimensionedScalar lgamma(const dimensionedScalar &ds)
dimensionedScalar j1(const dimensionedScalar &ds)
dimensionedScalar y0(const dimensionedScalar &ds)
dimensionedScalar cosh(const dimensionedScalar &ds)
void pow025(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
dimensionedScalar sin(const dimensionedScalar &ds)
dimensionedScalar tanh(const dimensionedScalar &ds)
dimensionedScalar erf(const dimensionedScalar &ds)
dimensionedScalar sinh(const dimensionedScalar &ds)
scalar integerPow(const scalar x, const label e)
Compute the power of the number x to the integer e.
Definition: scalarI.H:30
dimensionedScalar log10(const dimensionedScalar &ds)
tmp< DimensionedField< scalar, GeoMesh, Field > > stabilise(const DimensionedField< scalar, GeoMesh, PrimitiveField > &dsf, const dimensioned< scalar > &ds)
void pow4(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
void divide(pointPatchField< Type > &f, const pointPatchField< Type > &f1, const pointPatchField< scalar > &f2)
void pow6(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensionedScalar log(const dimensionedScalar &ds)
void component(GeometricField< typename GeometricField< Type, GeoMesh, PrimitiveField1 >::cmptType, GeoMesh, PrimitiveField1 > &gcf, const GeometricField< Type, GeoMesh, PrimitiveField2 > &gf, const direction d)
dimensionedScalar y1(const dimensionedScalar &ds)
dimensionedScalar negPart(const dimensionedScalar &ds)
dimensionedScalar acosh(const dimensionedScalar &ds)
tmp< scalarField > linearSequence01(const label n)
Definition: scalarField.C:107
void pow5(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
scalar sumProd(const UList< Type > &f1, const UList< Type > &f2)
tmp< DimensionedField< scalar, GeoMesh, Field > > jn(const int n, const DimensionedField< scalar, GeoMesh, PrimitiveField > &dsf)
void pow3(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
dimensionedScalar neg(const dimensionedScalar &ds)
void cbrt(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
dimensionedScalar atanh(const dimensionedScalar &ds)
tmp< DimensionedField< typename powProduct< Type, r >::type, GeoMesh, Field > > pow(const DimensionedField< Type, GeoMesh, PrimitiveField > &df, typename powProduct< Type, r >::type)
tmp< DimensionedField< scalar, GeoMesh, Field > > atan2(const DimensionedField< scalar, GeoMesh, PrimitiveField1 > &dsf1, const DimensionedField< scalar, GeoMesh, PrimitiveField2 > &dsf2)
void multiply(pointPatchField< Type > &f, const pointPatchField< scalar > &f1, const pointPatchField< Type > &f2)
dimensionedScalar neg0(const dimensionedScalar &ds)
tmp< scalarField > linearSequence(const scalar start, const scalar end, const label n)
Definition: scalarField.C:98
dimensionedScalar atan(const dimensionedScalar &ds)
void sqrt(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
dimensionedScalar cos(const dimensionedScalar &ds)
dimensionedScalar posPart(const dimensionedScalar &ds)
tmp< DimensionedField< scalar, GeoMesh, Field > > yn(const int n, const DimensionedField< scalar, GeoMesh, PrimitiveField > &dsf)
uint8_t direction
Definition: direction.H:45
dimensionedScalar acos(const dimensionedScalar &ds)
dimensionedScalar j0(const dimensionedScalar &ds)
dimensionedScalar asinh(const dimensionedScalar &ds)
labelList f(nPoints)
#define BesselFunc(func)
Definition: scalarField.H:156