Loading...
Searching...
No Matches
complexField.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011 OpenFOAM Foundation
9 Copyright (C) 2019-2023 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Typedef
28 Foam::complexField
29
30Description
31 Specialisation of Field<T> for complex.
32
33SourceFiles
34 complexField.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef Foam_complexField_H
39#define Foam_complexField_H
41#include "complex.H"
42#include "scalarField.H"
43
44#define TEMPLATE
45#include "FieldFunctionsM.H"
46
47// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48
49namespace Foam
51
52// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53
55
56
57// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
58
59//- Zip together complex field from real/imag components
60void zip
61(
62 complexField& result,
63 const UList<scalar>& realValues,
64 const UList<scalar>& imagValues
65);
66
67//- Zip together complex field from real components and constant imag component
68void zip
69(
70 complexField& result,
71 const UList<scalar>& realValues,
72 const scalar imagValue
73);
74
75//- Zip together complex field from constant real component and imag components
76void zip
77(
78 complexField& result,
79 const scalar realValue,
80 const UList<scalar>& imagValues
81);
82
83//- Unzip complex field into components
84void unzip
85(
86 const UList<complex>& input,
87 scalarField& realValues,
88 scalarField& imagValues
89);
90
91
92//- Create complex field by zipping two lists of real/imag values
94(
95 const UList<scalar>& realValues,
96 const UList<scalar>& imagValues
97);
98
99//- Create complex field by zipping a list of real components
100//- and a constant imag component
102(
103 const UList<scalar>& realValues,
104 const scalar imagValue
105);
106
107//- Create complex field by zipping a constant real component
108//- and a list of imag components
110(
111 const scalar realValue,
112 const UList<scalar>& imagValues
113);
114
115
116//- Extract real component
117scalarField Re(const UList<complex>& cmplx);
118
119//- Extract imag component
120scalarField Im(const UList<complex>& cmplx);
121
122//- Sum real and imag components
124
125
126//- Create complex field from a list of real (using imag == 0)
127inline complexField ReComplexField(const UList<scalar>& realValues)
128{
129 return ComplexField(realValues, scalar(0));
130}
131
132//- Create complex field from a list of imag (using real == 0)
133inline complexField ImComplexField(const UList<scalar>& imagValues)
134{
135 return ComplexField(scalar(0), imagValues);
136}
137
138
139// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140
141//- Sum product
142template<>
143complex sumProd(const UList<complex>& f1, const UList<complex>& f2);
144
146// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147
150
154
155// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156
178
179// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180
181} // End namespace Foam
182
183// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184
185#include "undefFieldFunctionsM.H"
186
187// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188
189#endif
190
191// ************************************************************************* //
#define BINARY_TYPE_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
#define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
#define UNARY_FUNCTION(ReturnType, Type1, Func, Dfunc)
Macro functions for Field<Type> algebra.
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition Field.H:172
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition UList.H:89
A complex number, similar to the C++ complex type.
Definition complex.H:71
Namespace for OpenFOAM.
scalarField ReImSum(const UList< complex > &cmplx)
Sum real and imag components.
dimensionedScalar pow6(const dimensionedScalar &ds)
dimensionedScalar pow5(const dimensionedScalar &ds)
dimensionedScalar asin(const dimensionedScalar &ds)
dimensionedScalar exp(const dimensionedScalar &ds)
dimensionedScalar tan(const dimensionedScalar &ds)
scalarField Im(const UList< complex > &cmplx)
Extract imag component.
void subtract(DimensionedField< scalar, GeoMesh > &result, const dimensioned< scalar > &dt1, const DimensionedField< scalar, GeoMesh > &f2)
dimensionedScalar pow3(const dimensionedScalar &ds)
complexField ReComplexField(const UList< scalar > &realValues)
Create complex field from a list of real (using imag == 0).
dimensionedScalar cosh(const dimensionedScalar &ds)
dimensionedScalar sin(const dimensionedScalar &ds)
dimensionedScalar tanh(const dimensionedScalar &ds)
dimensionedScalar sinh(const dimensionedScalar &ds)
void divide(DimensionedField< Type, GeoMesh > &result, const DimensionedField< Type, GeoMesh > &f1, const DimensionedField< scalar, GeoMesh > &f2)
dimensionedScalar log10(const dimensionedScalar &ds)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensionedScalar log(const dimensionedScalar &ds)
dimensionedScalar acosh(const dimensionedScalar &ds)
void add(DimensionedField< scalar, GeoMesh > &result, const dimensioned< scalar > &dt1, const DimensionedField< scalar, GeoMesh > &f2)
dimensionedScalar sqrt(const dimensionedScalar &ds)
complex sumProd(const UList< complex > &f1, const UList< complex > &f2)
Sum product.
Field< complex > complexField
Specialisation of Field<T> for complex.
dimensionedScalar pow4(const dimensionedScalar &ds)
dimensionedScalar atanh(const dimensionedScalar &ds)
scalarField Re(const UList< complex > &cmplx)
Extract real component.
void unzip(const FieldField< Field, SphericalTensor< Cmpt > > &input, FieldField< Field, Cmpt > &ii)
Unzip sphericalTensor field field into components.
dimensionedScalar atan(const dimensionedScalar &ds)
void multiply(DimensionedField< Type, GeoMesh > &result, const DimensionedField< Type, GeoMesh > &f1, const DimensionedField< scalar, GeoMesh > &f2)
dimensionedScalar cos(const dimensionedScalar &ds)
dimensionedScalar acos(const dimensionedScalar &ds)
complexField ComplexField(const UList< scalar > &realValues, const UList< scalar > &imagValues)
Create complex field by zipping two lists of real/imag values.
complexField ImComplexField(const UList< scalar > &imagValues)
Create complex field from a list of imag (using real == 0).
void zip(FieldField< Field, SphericalTensor< Cmpt > > &result, const FieldField< Field, Cmpt > &ii)
Zip together sphericalTensor field field from components.
dimensionedScalar pow025(const dimensionedScalar &ds)
dimensionedScalar asinh(const dimensionedScalar &ds)
dict add("bounds", meshBb)