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 -------------------------------------------------------------------------------
11 License
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 
27 Typedef
28  Foam::complexField
29 
30 Description
31  Specialisation of Field<T> for complex.
32 
33 SourceFiles
34  complexField.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef Foam_complexField_H
39 #define Foam_complexField_H
40 
41 #include "complex.H"
42 #include "scalarField.H"
43 
44 #define TEMPLATE
45 #include "FieldFunctionsM.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
55 
56 
57 // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
58 
59 //- Zip together complex field from real/imag components
60 void 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
68 void 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
76 void zip
77 (
78  complexField& result,
79  const scalar realValue,
80  const UList<scalar>& imagValues
81 );
82 
83 //- Unzip complex field into components
84 void 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
117 scalarField Re(const UList<complex>& cmplx);
118 
119 //- Extract imag component
120 scalarField Im(const UList<complex>& cmplx);
121 
122 //- Sum real and imag components
123 scalarField ReImSum(const UList<complex>& cmplx);
124 
125 
126 //- Create complex field from a list of real (using imag == 0)
127 inline 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)
133 inline complexField ImComplexField(const UList<scalar>& imagValues)
134 {
135  return ComplexField(scalar(0), imagValues);
136 }
137 
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 //- Sum product
142 template<>
143 complex 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 // ************************************************************************* //
dimensionedScalar tanh(const dimensionedScalar &ds)
dimensionedScalar acos(const dimensionedScalar &ds)
#define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
void divide(DimensionedField< Type, GeoMesh > &result, const DimensionedField< Type, GeoMesh > &f1, const DimensionedField< scalar, GeoMesh > &f2)
dimensionedScalar log(const dimensionedScalar &ds)
#define UNARY_FUNCTION(ReturnType, Type1, Func, Dfunc)
Field< complex > complexField
Specialisation of Field<T> for complex.
Definition: complexField.H:50
void zip(FieldField< Field, SphericalTensor< Cmpt >> &result, const FieldField< Field, Cmpt > &ii)
Zip together sphericalTensor field field from components.
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensionedScalar pow025(const dimensionedScalar &ds)
scalarField ReImSum(const UList< complex > &cmplx)
Sum real and imag components.
Definition: complexField.C:191
void subtract(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dimensionedScalar asin(const dimensionedScalar &ds)
dimensionedScalar pow5(const dimensionedScalar &ds)
scalarField Im(const UList< complex > &cmplx)
Extract imag component.
Definition: complexField.C:223
complex sumProd(const UList< complex > &f1, const UList< complex > &f2)
Sum product.
Definition: complexField.C:245
void unzip(const FieldField< Field, SphericalTensor< Cmpt >> &input, FieldField< Field, Cmpt > &ii)
Unzip sphericalTensor field field into components.
dimensionedScalar acosh(const dimensionedScalar &ds)
dimensionedScalar cos(const dimensionedScalar &ds)
dimensionedScalar exp(const dimensionedScalar &ds)
Generic templated field type.
Definition: Field.H:62
dimensionedScalar asinh(const dimensionedScalar &ds)
static Istream & input(Istream &is, IntRange< T > &range)
Definition: IntRanges.C:33
complexField ComplexField(const UList< scalar > &realValues, const UList< scalar > &imagValues)
Create complex field by zipping two lists of real/imag values.
Definition: complexField.C:150
dimensionedScalar atanh(const dimensionedScalar &ds)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:105
Macro functions for Field<Type> algebra.
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)
scalarField Re(const UList< complex > &cmplx)
Extract real component.
Definition: complexField.C:207
dimensionedScalar pow3(const dimensionedScalar &ds)
dimensionedScalar sinh(const dimensionedScalar &ds)
dimensionedScalar atan(const dimensionedScalar &ds)
dimensionedScalar pow4(const dimensionedScalar &ds)
dimensionedScalar pow6(const dimensionedScalar &ds)
complexField ReComplexField(const UList< scalar > &realValues)
Create complex field from a list of real (using imag == 0)
Definition: complexField.H:145
A complex number, similar to the C++ complex type.
Definition: complex.H:70
dimensionedScalar cosh(const dimensionedScalar &ds)
void multiply(DimensionedField< Type, GeoMesh > &result, const DimensionedField< Type, GeoMesh > &f1, const DimensionedField< scalar, GeoMesh > &f2)
dimensionedScalar tan(const dimensionedScalar &ds)
#define BINARY_TYPE_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
complexField ImComplexField(const UList< scalar > &imagValues)
Create complex field from a list of imag (using real == 0)
Definition: complexField.H:153
dimensionedScalar log10(const dimensionedScalar &ds)
Namespace for OpenFOAM.