EulerCoordinateRotation.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::EulerCoordinateRotation
26 
27 Description
28  A coordinateRotation defined in the z-x-y Euler convention.
29 
30  The 3 rotations are defined in the Euler convention
31  (around Z, around X' and around Z').
32  For reference and illustration, see
33  http://mathworld.wolfram.com/EulerAngles.html
34  Note, however, that it is the reverse transformation
35  (local->global) that is defined here.
36 
37  - the rotation angles are in degrees, unless otherwise explicitly specified:
38 
39  \verbatim
40  coordinateRotation
41  {
42  type EulerRotation;
43  degrees false;
44  rotation (0 0 3.141592654);
45  }
46  \endverbatim
47 
48 SourceFiles
49  EulerCoordinateRotation.C
50 
51 \*---------------------------------------------------------------------------*/
52 
53 #ifndef EulerCoordinateRotation_H
54 #define EulerCoordinateRotation_H
55 
56 #include "coordinateRotation.H"
57 
58 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59 
60 namespace Foam
61 {
62 
63 /*---------------------------------------------------------------------------*\
64  Class EulerCoordinateRotation Declaration
65 \*---------------------------------------------------------------------------*/
66 
68 :
69  public coordinateRotation
70 {
71 
72  // Private Member Data
73 
74  //- Local-to-global transformation tensor
75  tensor R_;
76 
77  //- Global-to-Local transformation tensor
78  tensor Rtr_;
79 
80 
81  // Private Member Functions
82 
83  //- Calculate transformation tensor
84  void calcTransform
85  (
86  const scalar phiAngle,
87  const scalar thetaAngle,
88  const scalar psiAngle,
89  const bool inDegrees=true
90  );
91 
92 
93 public:
94 
95  //- Runtime type information
96  TypeName("EulerRotation");
97 
98 
99  // Constructors
100 
101  //- Construct from dictionary
103 
104  //- Construct from dictionary and list of points
106 
107  //- Construct and return a clone
108  virtual autoPtr<coordinateRotation> clone() const
109  {
111  (
112  new EulerCoordinateRotation(*this)
113  );
114  }
115 
116 
117  // Member Functions
118 
119  //- Update the rotation for a list of points
120  virtual void updatePoints(const UList<vector>& points)
121  {}
122 
123  //- Return local-to-global transformation tensor
124  virtual const tensor& R() const
125  {
126  return R_;
127  }
128 
129  //- Return local Cartesian x-axis in global coordinates
130  virtual const vector e1() const
131  {
132  return Rtr_.x();
133  }
134 
135  //- Return local Cartesian y-axis in global coordinates
136  virtual const vector e2() const
137  {
138  return Rtr_.y();
139  }
140 
141  //- Return local Cartesian z-axis in global coordinates
142  virtual const vector e3() const
143  {
144  return Rtr_.z();
145  }
146 
147  //- Transform vectorField using transformation tensor field
148  virtual tmp<vectorField> transform(const vectorField& st) const;
149 
150  //- Transform vector using transformation tensor
151  virtual vector transform(const vector& st) const;
152 
153  //- Inverse transform vectorField using transformation tensor field
154  virtual tmp<vectorField> invTransform(const vectorField& st) const;
155 
156  //- Inverse transform vector using transformation tensor
157  virtual vector invTransform(const vector& st) const;
158 
159  //- Transform tensor field using transformation tensorField
160  virtual tmp<tensorField> transformTensor(const tensorField& st) const;
161 
162  //- Transform tensor using transformation tensorField
163  virtual tensor transformTensor(const tensor& st) const;
164 
165  //- Transform vectorField using transformation tensorField and return
166  // symmetrical tensorField
168  (
169  const vectorField& st
170  ) const;
171 
172  //- Transform vector using transformation tensor and return
173  // symmetrical tensor
174  virtual symmTensor transformVector(const vector& st) const;
175 
176 
177  // Write
178 
179  //- Write
180  virtual void write(Ostream&) const;
181 };
182 
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 } // End namespace Foam
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 #endif
191 
192 // ************************************************************************* //
virtual autoPtr< coordinateRotation > clone() const
Construct and return a clone.
Abstract base class for coordinate rotation.
A coordinateRotation defined in the z-x-y Euler convention.
virtual const vector e2() const
Return local Cartesian y-axis in global coordinates.
EulerCoordinateRotation(const dictionary &)
Construct from dictionary.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
virtual const vector e1() const
Return local Cartesian x-axis in global coordinates.
virtual void updatePoints(const UList< vector > &points)
Update the rotation for a list of points.
Vector< Cmpt > x() const
Definition: TensorI.H:289
virtual tmp< tensorField > transformTensor(const tensorField &st) const
Transform tensor field using transformation tensorField.
Vector< Cmpt > y() const
Definition: TensorI.H:296
virtual void write(Ostream &) const
Write.
virtual const vector e3() const
Return local Cartesian z-axis in global coordinates.
virtual const tensor & R() const
Return local-to-global transformation tensor.
TypeName("EulerRotation")
Runtime type information.
Vector< Cmpt > z() const
Definition: TensorI.H:303
const pointField & points
virtual tmp< vectorField > transform(const vectorField &st) const
Transform vectorField using transformation tensor field.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
virtual tmp< vectorField > invTransform(const vectorField &st) const
Inverse transform vectorField using transformation tensor field.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.
virtual tmp< symmTensorField > transformVector(const vectorField &st) const
Transform vectorField using transformation tensorField and return.