Loading...
Searching...
No Matches
complexVectorI.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) 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
27\*---------------------------------------------------------------------------*/
28
29// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30
31namespace Foam
33
34// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
35
36//- Zip together complexVector from real/imag vectors
37inline complexVector zip(const vector& realValue, const vector& imagValue)
38{
39 return complexVector
40 (
41 complex(realValue.x(), imagValue.x()),
42 complex(realValue.y(), imagValue.y()),
43 complex(realValue.z(), imagValue.z())
44 );
46
47
48// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
49
50inline complexVector operator*(const complex& v1, const complexVector& v2)
51{
52 return complexVector
53 (
54 v1*v2.x(),
55 v1*v2.y(),
56 v1*v2.z()
57 );
58}
59
60
61inline complexVector operator*(const complexVector& v2, const complex& v1)
62{
63 return complexVector
64 (
65 v1*v2.x(),
66 v1*v2.y(),
67 v1*v2.z()
68 );
69}
70
71
72inline complexVector operator/(const complexVector& v1, const complex& v2)
73{
74 return complexVector
75 (
76 v1.x()/v2,
77 v1.y()/v2,
78 v1.z()/v2
79 );
80}
81
82
83inline complexVector operator/(const complex& v1, const complexVector& v2)
84{
85 return complexVector
86 (
87 v1/v2.x(),
88 v1/v2.y(),
89 v1/v2.z()
90 );
91}
93
94//- Dot product for complexVector
95inline complex operator&(const complexVector& v1, const complexVector& v2)
96{
97 return complex
98 (
99 v1.x()*v2.x().conjugate()
100 + v1.y()*v2.y().conjugate()
101 + v1.z()*v2.z().conjugate()
102 );
103}
104
105
106//- Cross product for complexVector
107inline complexVector operator^(const complexVector& v1, const complexVector& v2)
108{
109 return complexVector
110 (
111 (v1.y()*v2.z() - v1.z()*v2.y()),
112 (v1.z()*v2.x() - v1.x()*v2.z()),
113 (v1.x()*v2.y() - v1.y()*v2.x())
114 );
115}
116
117
118//- Cross product for complexVector
119inline complexVector operator^(const vector& v1, const complexVector& v2)
121 return complexVector
122 (
123 (v1.y()*v2.z() - v1.z()*v2.y()),
124 (v1.z()*v2.x() - v1.x()*v2.z()),
125 (v1.x()*v2.y() - v1.y()*v2.x())
126 );
127}
128
129
130// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131
132} // End namespace Foam
133
134// ************************************************************************* //
const Cmpt & x() const noexcept
Access to the vector x component.
Definition Vector.H:135
const Cmpt & z() const noexcept
Access to the vector z component.
Definition Vector.H:145
const Cmpt & y() const noexcept
Access to the vector y component.
Definition Vector.H:140
A complex number, similar to the C++ complex type.
Definition complex.H:71
complex conjugate() const
Complex conjugate.
Definition complexI.H:68
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
Namespace for OpenFOAM.
Vector< complex > complexVector
A Vector of complex values with 'scalar' precision.
tmp< faMatrix< Type > > operator*(const areaScalarField::Internal &, const faMatrix< Type > &)
bitSet operator^(const bitSet &a, const bitSet &b)
Bitwise-XOR of two bitsets to form a unique bit-set.
Definition bitSetI.H:702
dimensionedScalar operator/(const scalar s1, const dimensionedScalar &ds2)
tmp< GeometricField< Type, faPatchField, areaMesh > > operator&(const faMatrix< Type > &, const DimensionedField< Type, areaMesh > &)
Vector< scalar > vector
Definition vector.H:57
void zip(FieldField< Field, SphericalTensor< Cmpt > > &result, const FieldField< Field, Cmpt > &ii)
Zip together sphericalTensor field field from components.