1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "EulerCoordinateRotation.H"
30 #include "mathematicalConstants.H"
31 #include "dictionary.H"
32 #include "addToRunTimeSelectionTable.H"
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
38 defineTypeNameAndDebug(EulerCoordinateRotation, 0);
39 addToRunTimeSelectionTable
42 EulerCoordinateRotation,
47 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
49 void Foam::EulerCoordinateRotation::calcTransform
51 const scalar phiAngle,
52 const scalar thetaAngle,
53 const scalar psiAngle,
57 scalar phi = phiAngle;
58 scalar theta = thetaAngle;
59 scalar psi = psiAngle;
63 phi *= mathematicalConstant::pi/180.0;
64 theta *= mathematicalConstant::pi/180.0;
65 psi *= mathematicalConstant::pi/180.0;
72 cos(phi)*cos(psi) - sin(phi)*sin(psi)*cos(theta),
73 -sin(phi)*cos(psi)*cos(theta) - cos(phi)*sin(psi),
76 cos(phi)*sin(psi)*cos(theta) + sin(phi)*cos(psi),
77 cos(phi)*cos(psi)*cos(theta) - sin(phi)*sin(psi),
88 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
90 Foam::EulerCoordinateRotation::EulerCoordinateRotation()
96 Foam::EulerCoordinateRotation::EulerCoordinateRotation
98 const vector& phiThetaPsi,
106 phiThetaPsi.component(vector::X),
107 phiThetaPsi.component(vector::Y),
108 phiThetaPsi.component(vector::Z),
114 Foam::EulerCoordinateRotation::EulerCoordinateRotation
116 const scalar phiAngle,
117 const scalar thetaAngle,
118 const scalar psiAngle,
124 calcTransform(phiAngle, thetaAngle, psiAngle, inDegrees);
128 Foam::EulerCoordinateRotation::EulerCoordinateRotation
130 const dictionary& dict
135 vector rotation(dict.lookup("rotation"));
139 rotation.component(vector::X),
140 rotation.component(vector::Y),
141 rotation.component(vector::Z),
142 dict.lookupOrDefault<Switch>("degrees", true)
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //