complexVectorI.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-2018 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 Description
25  complexVector specific part of 3D complexVector obtained from
26  generic Vector.
27 
28 \*---------------------------------------------------------------------------*/
29 
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 
35 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
36 
37 inline complexVector operator*(const complex& v1, const complexVector& v2)
38 {
39  return complexVector
40  (
41  v1*v2.x(),
42  v1*v2.y(),
43  v1*v2.z()
44  );
45 }
46 
47 
48 inline complexVector operator*(const complexVector& v2, const complex& v1)
49 {
50  return complexVector
51  (
52  v1*v2.x(),
53  v1*v2.y(),
54  v1*v2.z()
55  );
56 }
57 
58 
59 inline complexVector operator/(const complexVector& v1, const complex& v2)
60 {
61  return complexVector
62  (
63  v1.x()/v2,
64  v1.y()/v2,
65  v1.z()/v2
66  );
67 }
68 
69 
70 inline complexVector operator/(const complex& v1, const complexVector& v2)
71 {
72  return complexVector
73  (
74  v1/v2.x(),
75  v1/v2.y(),
76  v1/v2.z()
77  );
78 }
79 
80 
81 // complexVector dot product
82 
83 inline complex operator&(const complexVector& v1, const complexVector& v2)
84 {
85  return complex
86  (
87  v1.x()*v2.x().conjugate()
88  + v1.y()*v2.y().conjugate()
89  + v1.z()*v2.z().conjugate()
90  );
91 }
92 
93 
94 // complexVector cross product
95 
96 inline complexVector operator^(const complexVector& v1, const complexVector& v2)
97 {
98  return complexVector
99  (
100  (v1.y()*v2.z() - v1.z()*v2.y()),
101  (v1.z()*v2.x() - v1.x()*v2.z()),
102  (v1.x()*v2.y() - v1.y()*v2.x())
103  );
104 }
105 
106 
107 // complexVector cross product
108 
109 inline complexVector operator^(const vector& v1, const complexVector& v2)
110 {
111  return complexVector
112  (
113  (v1.y()*v2.z() - v1.z()*v2.y()),
114  (v1.z()*v2.x() - v1.x()*v2.z()),
115  (v1.x()*v2.y() - v1.y()*v2.x())
116  );
117 }
118 
119 
120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
121 
122 } // End namespace Foam
123 
124 // ************************************************************************* //
HashSet< Key, Hash > operator^(const HashSet< Key, Hash > &hash1, const HashSet< Key, Hash > &hash2)
Create a HashSet that only contains unique entries (xor)
dimensionedScalar operator/(const scalar s1, const dimensionedScalar &ds2)
const Cmpt & z() const
Definition: VectorI.H:87
const Cmpt & y() const
Definition: VectorI.H:81
tmp< GeometricField< Type, fvPatchField, volMesh > > operator &(const fvMatrix< Type > &, const DimensionedField< Type, volMesh > &)
tmp< fvMatrix< Type > > operator*(const volScalarField::Internal &, const fvMatrix< Type > &)
Vector< complex > complexVector
complexVector obtained from generic Vector.
Definition: complexVector.H:46
const Cmpt & x() const
Definition: VectorI.H:75
Templated 3D Vector derived from VectorSpace adding construction from 3 components, element access using x(), y() and z() member functions and the inner-product (dot-product) and cross product operators.
Definition: Vector.H:57
Extension to the c++ complex library type.
Definition: complex.H:76
Namespace for OpenFOAM.