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 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32 
33 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
34 
35 inline complexVector operator*(const complex& v1, const complexVector& v2)
36 {
37  return complexVector
38  (
39  v1*v2.x(),
40  v1*v2.y(),
41  v1*v2.z()
42  );
43 }
44 
45 
46 inline complexVector operator*(const complexVector& v2, const complex& v1)
47 {
48  return complexVector
49  (
50  v1*v2.x(),
51  v1*v2.y(),
52  v1*v2.z()
53  );
54 }
55 
56 
57 inline complexVector operator/(const complexVector& v1, const complex& v2)
58 {
59  return complexVector
60  (
61  v1.x()/v2,
62  v1.y()/v2,
63  v1.z()/v2
64  );
65 }
66 
67 
68 inline complexVector operator/(const complex& v1, const complexVector& v2)
69 {
70  return complexVector
71  (
72  v1/v2.x(),
73  v1/v2.y(),
74  v1/v2.z()
75  );
76 }
77 
78 
79 //- Dot product for complexVector
80 inline complex operator&(const complexVector& v1, const complexVector& v2)
81 {
82  return complex
83  (
84  v1.x()*v2.x().conjugate()
85  + v1.y()*v2.y().conjugate()
86  + v1.z()*v2.z().conjugate()
87  );
88 }
89 
90 
91 //- Cross product for complexVector
92 inline complexVector operator^(const complexVector& v1, const complexVector& v2)
93 {
94  return complexVector
95  (
96  (v1.y()*v2.z() - v1.z()*v2.y()),
97  (v1.z()*v2.x() - v1.x()*v2.z()),
98  (v1.x()*v2.y() - v1.y()*v2.x())
99  );
100 }
101 
102 
103 //- Cross product for complexVector
104 inline complexVector operator^(const vector& v1, const complexVector& v2)
105 {
106  return complexVector
107  (
108  (v1.y()*v2.z() - v1.z()*v2.y()),
109  (v1.z()*v2.x() - v1.x()*v2.z()),
110  (v1.x()*v2.y() - v1.y()*v2.x())
111  );
112 }
113 
114 
115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
116 
117 } // End namespace Foam
118 
119 // ************************************************************************* //
Foam::complexVector
Vector< complex > complexVector
A Vector of complex values with 'scalar' precision.
Definition: complexVector.H:49
Foam::Vector::x
const Cmpt & x() const
Access to the vector x component.
Definition: VectorI.H:73
Foam::roots::complex
Definition: Roots.H:57
Foam::operator&
tmp< GeometricField< Type, fvPatchField, volMesh > > operator&(const fvMatrix< Type > &, const DimensionedField< Type, volMesh > &)
Foam::Vector::z
const Cmpt & z() const
Access to the vector z component.
Definition: VectorI.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::complex
A complex number, similar to the C++ complex type.
Definition: complex.H:82
Foam::operator/
dimensionedScalar operator/(const scalar s1, const dimensionedScalar &ds2)
Definition: dimensionedScalar.C:68
Foam::Vector::y
const Cmpt & y() const
Access to the vector y component.
Definition: VectorI.H:79
Foam::Vector
Templated 3D Vector derived from VectorSpace adding construction from 3 components,...
Definition: Vector.H:62
Foam::operator*
tmp< faMatrix< Type > > operator*(const areaScalarField &, const faMatrix< Type > &)
Foam::operator^
bitSet operator^(const bitSet &a, const bitSet &b)
Bitwise-XOR of two bitsets to form a unique bit-set.
Definition: bitSetI.H:768