EulerCoordinateRotation.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2017-2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::coordinateRotations::euler
29 
30 Description
31  A coordinateRotation defined in the z-x-z (intrinsic) Euler convention.
32 
33  The 3 rotations are defined in the Euler intrinsic convention
34  (around Z, around X' and around Z'').
35  The order of the parameter arguments matches this rotation order.
36 
37  For reference and illustration, see
38  https://en.wikipedia.org/wiki/Euler_angles
39 
40  \verbatim
41  rotation
42  {
43  type euler;
44  angles (0 0 180);
45  }
46  \endverbatim
47 
48  \heading Dictionary entries
49  \table
50  Property | Description | Required | Default
51  type | Type name: euler (or EulerRotation) | yes |
52  angles | The z-x-z rotation angles | yes |
53  degrees | Angles are in degrees | no | true
54  \endtable
55 
56 SourceFiles
57  EulerCoordinateRotation.C
58 
59 \*---------------------------------------------------------------------------*/
60 
61 #ifndef coordinateRotations_euler_H
62 #define coordinateRotations_euler_H
63 
64 #include "coordinateRotation.H"
65 #include "quaternion.H"
66 
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68 
69 namespace Foam
70 {
71 namespace coordinateRotations
72 {
73 
74 /*---------------------------------------------------------------------------*\
75  Class coordinateRotations::euler Declaration
76 \*---------------------------------------------------------------------------*/
77 
78 class euler
79 :
80  public coordinateRotation
81 {
82 public:
83 
84  // Public Types
85 
86  //- Euler-angle rotation order
88 
89 
90 private:
91 
92  // Private Data
93 
94  //- The rotation angles
95  vector angles_;
96 
97  //- Angles measured in degrees
98  bool degrees_;
99 
100  //- The Euler-angle rotation order (default: zxz)
101  eulerOrder order_;
102 
103 
104 public:
105 
106  //- Runtime type information
107  TypeNameNoDebug("euler");
108 
109 
110  // Constructors
111 
112  //- Default construct - an identity transform
113  euler();
114 
115  //- Copy construct
116  euler(const euler& crot);
117 
118  //- Construct from Euler intrinsic rotation angles (z-x-z)
119  euler(const vector& angles, bool degrees);
120 
121  //- Construct from Euler intrinsic rotation angles (z-x-z)
122  euler(scalar angle1, scalar angle2, scalar angle3, bool degrees);
123 
124  //- Construct from dictionary
125  explicit euler(const dictionary& dict);
126 
127  //- Return clone
129  {
130  return
133  }
134 
135 
136  //- Destructor
137  virtual ~euler() = default;
138 
139 
140  // Static Member Functions
141 
142  //- The rotation tensor calculated for the intrinsic Euler
143  //- angles in z-x-z order
144  static tensor rotation(const vector& angles, bool degrees=false);
145 
146  //- The rotation tensor calculated for given angles and order
148  (
149  const eulerOrder order,
150  const vector& angles,
151  bool degrees=false
152  );
153 
154 
155  // Member Functions
156 
157  //- Reset specification
158  virtual void clear();
159 
160  //- The rotation tensor calculated for the specified Euler angles.
161  virtual tensor R() const;
162 
163  //- Write information
164  virtual void write(Ostream& os) const;
165 
166  //- Write dictionary entry
167  virtual void writeEntry(const word& keyword, Ostream& os) const;
168 };
169 
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 } // End namespace coordinateRotations
174 
175 //- Compatibility typedef 1806
177 
178 } // End namespace Foam
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 #endif
183 
184 // ************************************************************************* //
Foam::coordinateRotations::euler
A coordinateRotation defined in the z-x-z (intrinsic) Euler convention.
Definition: EulerCoordinateRotation.H:97
Foam::Tensor< scalar >
Foam::coordinateRotations::euler::~euler
virtual ~euler()=default
Destructor.
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
quaternion.H
Foam::coordinateRotations::euler::writeEntry
virtual void writeEntry(const word &keyword, Ostream &os) const
Write dictionary entry.
Definition: EulerCoordinateRotation.C:335
Foam::coordinateRotations::euler::write
virtual void write(Ostream &os) const
Write information.
Definition: EulerCoordinateRotation.C:328
Foam::coordinateRotations::euler::clear
virtual void clear()
Reset specification.
Definition: EulerCoordinateRotation.C:315
Foam::coordinateRotation
User specification of a coordinate rotation.
Definition: coordinateRotation.H:78
Foam::EulerCoordinateRotation
coordinateRotations::euler EulerCoordinateRotation
Compatibility typedef 1806.
Definition: EulerCoordinateRotation.H:195
Foam::quaternion::eulerOrder
eulerOrder
Euler-angle rotation order.
Definition: quaternion.H:102
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam::coordinateRotations::euler::R
virtual tensor R() const
The rotation tensor calculated for the specified Euler angles.
Definition: EulerCoordinateRotation.C:322
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::vector
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:51
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::Vector< scalar >
Foam::coordinateRotations::euler::clone
autoPtr< coordinateRotation > clone() const
Return clone.
Definition: EulerCoordinateRotation.H:147
Foam::coordinateRotations::euler::eulerOrder
quaternion::eulerOrder eulerOrder
Euler-angle rotation order.
Definition: EulerCoordinateRotation.H:106
Foam::coordinateRotations::euler::euler
euler()
Default construct - an identity transform.
Definition: EulerCoordinateRotation.C:250
Foam::coordinateRotations::euler::rotation
static tensor rotation(const vector &angles, bool degrees=false)
Definition: EulerCoordinateRotation.C:239
coordinateRotation.H
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::coordinateRotations::euler::TypeNameNoDebug
TypeNameNoDebug("euler")
Runtime type information.