FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Description
00025     complexVector specific part of 3D complexVector obtained from
00026     generic Vector.
00027 
00028 \*---------------------------------------------------------------------------*/
00029 
00030 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00031 
00032 namespace Foam
00033 {
00034 
00035 // * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
00036 
00037 inline complexVector operator*(const complex& v1, const complexVector& v2)
00038 {
00039     return complexVector
00040     (
00041         v1*v2.x(),
00042         v1*v2.y(),
00043         v1*v2.z()
00044     );
00045 }
00046 
00047 
00048 inline complexVector operator*(const complexVector& v2, const complex& v1)
00049 {
00050     return complexVector
00051     (
00052         v1*v2.x(),
00053         v1*v2.y(),
00054         v1*v2.z()
00055     );
00056 }
00057 
00058 
00059 inline complexVector operator/(const complexVector& v1, const complex& v2)
00060 {
00061     return complexVector
00062     (
00063         v1.x()/v2,
00064         v1.y()/v2,
00065         v1.z()/v2
00066     );
00067 }
00068 
00069 
00070 inline complexVector operator/(const complex& v1, const complexVector& v2)
00071 {
00072     return complexVector
00073     (
00074         v1/v2.x(),
00075         v1/v2.y(),
00076         v1/v2.z()
00077     );
00078 }
00079 
00080 
00081 // complexVector dot product
00082 
00083 inline complex operator&(const complexVector& v1, const complexVector& v2)
00084 {
00085     return complex
00086     (
00087         v1.x()*v2.x().conjugate()
00088       + v1.y()*v2.y().conjugate()
00089       + v1.z()*v2.z().conjugate()
00090     );
00091 }
00092 
00093 
00094 // complexVector cross product
00095 
00096 inline complexVector operator^(const complexVector& v1, const complexVector& v2)
00097 {
00098     return complexVector
00099     (
00100         (v1.y()*v2.z() - v1.z()*v2.y()),
00101         (v1.z()*v2.x() - v1.x()*v2.z()),
00102         (v1.x()*v2.y() - v1.y()*v2.x())
00103     );
00104 }
00105 
00106 
00107 // complexVector cross product
00108 
00109 inline complexVector operator^(const vector& v1, const complexVector& v2)
00110 {
00111     return complexVector
00112     (
00113         (v1.y()*v2.z() - v1.z()*v2.y()),
00114         (v1.z()*v2.x() - v1.x()*v2.z()),
00115         (v1.x()*v2.y() - v1.y()*v2.x())
00116     );
00117 }
00118 
00119 
00120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00121 
00122 } // End namespace Foam
00123 
00124 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines