OpenFOAM logo
Open Source CFD Toolkit

complexVectorI.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2005 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Description
00026     complexVector specific part of 3D complexVector obtained from
00027     generic Vector.
00028 
00029 \*---------------------------------------------------------------------------*/
00030 
00031 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00032 
00033 namespace Foam
00034 {
00035 
00036 // * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
00037 
00038 inline complexVector operator*(const complex& v1, const complexVector& v2)
00039 {
00040     return complexVector
00041     (
00042         v1*v2.x(),
00043         v1*v2.y(),
00044         v1*v2.z()
00045     );
00046 }
00047 
00048 
00049 inline complexVector operator*(const complexVector& v2, const complex& v1)
00050 {
00051     return complexVector
00052     (
00053         v1*v2.x(),
00054         v1*v2.y(),
00055         v1*v2.z()
00056     );
00057 }
00058 
00059 
00060 inline complexVector operator/(const complexVector& v1, const complex& v2)
00061 {
00062     return complexVector
00063     (
00064         v1.x()/v2,
00065         v1.y()/v2,
00066         v1.z()/v2
00067     );
00068 }
00069 
00070 
00071 inline complexVector operator/(const complex& v1, const complexVector& v2)
00072 {
00073     return complexVector
00074     (
00075         v1/v2.x(),
00076         v1/v2.y(),
00077         v1/v2.z()
00078     );
00079 }
00080 
00081 
00082 // complexVector dot product
00083 
00084 inline complex operator&(const complexVector& v1, const complexVector& v2)
00085 {
00086     return complex
00087     (
00088         v1.x()*v2.x().conjugate()
00089       + v1.y()*v2.y().conjugate()
00090       + v1.z()*v2.z().conjugate()
00091     );
00092 }
00093 
00094 
00095 // complexVector cross product
00096 
00097 inline complexVector operator^(const complexVector& v1, const complexVector& v2)
00098 {
00099     return complexVector
00100     (
00101         (v1.y()*v2.z() - v1.z()*v2.y()),
00102         (v1.z()*v2.x() - v1.x()*v2.z()),
00103         (v1.x()*v2.y() - v1.y()*v2.x())
00104     );
00105 }
00106 
00107 
00108 // complexVector cross product
00109 
00110 inline complexVector operator^(const vector& v1, const complexVector& v2)
00111 {
00112     return complexVector
00113     (
00114         (v1.y()*v2.z() - v1.z()*v2.y()),
00115         (v1.z()*v2.x() - v1.x()*v2.z()),
00116         (v1.x()*v2.y() - v1.y()*v2.x())
00117     );
00118 }
00119 
00120 
00121 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00122 
00123 } // End namespace Foam
00124 
00125 // ************************************************************************* //
For further information go to www.openfoam.org