OpenFOAM logo
Open Source CFD Toolkit

EulerCoordinateRotation.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 Class
00026     EulerCoordinateRotation
00027 
00028 Description
00029     The 3 rotations are defined in the Euler convention
00030     (around Z, around X' and around Z').
00031     For reference and illustration, see
00032     http://mathworld.wolfram.com/EulerAngles.html
00033 
00034 
00035 \*---------------------------------------------------------------------------*/
00036 
00037 #ifndef EulerCoordinateRotation_H
00038 #define EulerCoordinateRotation_H
00039 
00040 #include "coordinateRotation.H"
00041 
00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00043 
00044 namespace Foam
00045 {
00046 
00047 /*---------------------------------------------------------------------------*\
00048                    Class EulerCoordinateRotation Declaration
00049 \*---------------------------------------------------------------------------*/
00050 
00051 class EulerCoordinateRotation
00052 :
00053     public coordinateRotation
00054 {
00055     // Private data
00056 
00057         //- Local-to-global transformation tensor
00058         tensor R_;
00059 
00060 
00061 public:
00062 
00063     // Constructors
00064 
00065         //- Construct from components
00066         EulerCoordinateRotation
00067         (
00068             const scalar phi,
00069             const scalar theta,
00070             const scalar psi
00071         )
00072         :
00073             R_
00074             (
00075                 cos(psi)*cos(phi) - cos(theta)*sin(phi)*sin(psi),
00076                 con(psi)*sin(phi) + cos(theta)*cos(phi)*sin(psi),
00077                 sin(psi)*sin(theta),
00078 
00079                -sin(psi)*cos(phi) - cos(theta)*sin(phi)*cos(psi),
00080                -sin(psi)*sin(phi) + cos(theta)*cos(phi)*cos(psi),
00081                 cos(psi)*sin(theta),
00082 
00083                 sin(theta)*sin(phi),
00084                -sin(theta)*cos(phi),
00085                 cos(theta)
00086             )
00087         {}
00088 
00089 
00090     // Destructor
00091 
00092         virtual ~EulerCoordinateRotation()
00093         {}
00094 
00095 
00096     // Return local-to-global transformation tensor
00097     virtual const tensor& R() const
00098     {
00099         return R_;
00100     }
00101 
00102 };
00103 
00104 
00105 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00106 
00107 } // End namespace Foam
00108 
00109 
00110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00111 
00112 #endif
00113 
00114 // ************************************************************************* //
For further information go to www.openfoam.org