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 | Reqd | Default
51  type | Type name: euler | yes |
52  angles | Rotation angles (usually z-x-z order) | yes |
53  degrees | Angles are in degrees | no | true
54  order | Rotation order | no | zxz
55  \endtable
56 
57 Note
58  The rotation order is usually z-x-z, but can also be something like
59  "rollPitchYaw" etc.
60  Also accepts "EulerRotation" (OpenFOAM-v1806) for the type.
61 
62 SourceFiles
63  EulerCoordinateRotation.C
64 
65 \*---------------------------------------------------------------------------*/
66 
67 #ifndef Foam_coordinateRotations_euler_H
68 #define Foam_coordinateRotations_euler_H
69 
70 #include "coordinateRotation.H"
71 #include "quaternion.H"
72 
73 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
74 
75 namespace Foam
76 {
77 namespace coordinateRotations
78 {
79 
80 /*---------------------------------------------------------------------------*\
81  Class coordinateRotations::euler Declaration
82 \*---------------------------------------------------------------------------*/
83 
84 class euler
85 :
86  public coordinateRotation
87 {
88 public:
89 
90  // Public Types
91 
92  //- Euler-angle rotation order
94 
95 
96 private:
97 
98  // Private Data
99 
100  //- The rotation angles
101  vector angles_;
102 
103  //- Angles measured in degrees
104  bool degrees_;
105 
106  //- The Euler-angle rotation order (default: zxz)
107  eulerOrder order_;
108 
109 
110 public:
111 
112  //- Runtime type information
113  TypeNameNoDebug("euler");
114 
116  // Constructors
117 
118  //- Default construct - an identity transform
119  euler();
120 
121  //- Copy construct
122  euler(const euler& crot);
123 
124  //- Construct from Euler intrinsic rotation angles (z-x-z)
125  euler(const vector& angles, bool degrees);
126 
127  //- Construct from Euler intrinsic rotation angles (z-x-z)
128  euler(scalar angle1, scalar angle2, scalar angle3, bool degrees);
129 
130  //- Construct from dictionary
131  explicit euler(const dictionary& dict);
132 
133  //- Return clone
135  {
136  return
139  }
140 
141 
142  //- Destructor
143  virtual ~euler() = default;
144 
145 
146  // Static Member Functions
147 
148  //- Rotation tensor calculated for the intrinsic Euler
149  //- angles in z-x-z order
150  static tensor rotation(const vector& angles, bool degrees=false);
151 
152  //- Rotation tensor calculated for given order and angles
153  static tensor rotation
154  (
155  const eulerOrder order,
156  const vector& angles,
157  bool degrees=false
158  );
159 
160 
161  // Member Functions
162 
163  //- Reset specification
164  virtual void clear();
165 
166  //- The rotation tensor calculated for the specified Euler angles.
167  virtual tensor R() const;
168 
169  //- Write information
170  virtual void write(Ostream& os) const;
171 
172  //- Write dictionary entry
173  virtual void writeEntry(const word& keyword, Ostream& os) const;
174 };
175 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 } // End namespace coordinateRotations
180 
181 //- Compatibility typedef 1806
183 
184 } // End namespace Foam
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 #endif
189 
190 // ************************************************************************* //
dictionary dict
coordinateRotations::euler EulerCoordinateRotation
Compatibility typedef 1806.
TypeNameNoDebug("euler")
Runtime type information.
virtual tensor R() const
The rotation tensor calculated for the specified Euler angles.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
quaternion::eulerOrder eulerOrder
Euler-angle rotation order.
virtual ~euler()=default
Destructor.
virtual void clear()
Reset specification.
A coordinateRotation defined in the z-x-z (intrinsic) Euler convention.
A class for handling words, derived from Foam::string.
Definition: word.H:63
virtual void writeEntry(const word &keyword, Ostream &os) const
Write dictionary entry.
Vector< scalar > vector
Definition: vector.H:57
eulerOrder
Euler-angle rotation order.
Definition: quaternion.H:115
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
OBJstream os(runTime.globalPath()/outputName)
static tensor rotation(const vector &angles, bool degrees=false)
Rotation tensor calculated for the intrinsic Euler angles in z-x-z order.
euler()
Default construct - an identity transform.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
Tensor of scalars, i.e. Tensor<scalar>.
virtual void write(Ostream &os) const
Write information.
autoPtr< coordinateRotation > clone() const
Return clone.
Namespace for OpenFOAM.