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-2022 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& vf) const;
149 
150  //- Transform vector using transformation tensor
151  virtual vector transform(const vector& v) const;
152 
153  //- Inverse transform vectorField using transformation tensor field
154  virtual tmp<vectorField> invTransform(const vectorField& vf) const;
155 
156  //- Inverse transform vector using transformation tensor
157  virtual vector invTransform(const vector& v) const;
158 
159  //- Transform tensor field using transformation tensorField
160  virtual tmp<tensorField> transform(const tensorField& tf) const;
161 
162  //- Transform tensor using transformation tensorField
163  virtual tensor transform(const vector& p, const tensor& t) const;
164 
165  //- Transform diagTensor masquerading as a vector using transformation
166  // tensor and return symmTensor
168  (
169  const vector& p,
170  const vector& v
171  ) const;
172 
173  //- Transform diagTensorField masquerading as a vectorField
174  // using transformation tensorField and return symmTensorField
176  (
177  const vectorField& vf
178  ) const;
179 
180 
181  // Write
182 
183  //- Write
184  virtual void write(Ostream&) const;
185 };
186 
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 } // End namespace Foam
191 
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 
194 #endif
195 
196 // ************************************************************************* //
A coordinateRotation defined in the z-x-y Euler convention.
virtual const vector e2() const
Return local Cartesian y-axis in global coordinates.
TypeName("EulerRotation")
Runtime type information.
virtual void write(Ostream &) const
Write.
virtual autoPtr< coordinateRotation > clone() const
Construct and return a clone.
virtual const tensor & R() const
Return local-to-global transformation tensor.
EulerCoordinateRotation(const dictionary &)
Construct from dictionary.
virtual void updatePoints(const UList< vector > &points)
Update the rotation for a list of points.
virtual tmp< vectorField > invTransform(const vectorField &vf) const
Inverse transform vectorField using transformation tensor field.
virtual tmp< vectorField > transform(const vectorField &vf) const
Transform vectorField using transformation tensor field.
virtual const vector e1() const
Return local Cartesian x-axis in global coordinates.
virtual const vector e3() const
Return local Cartesian z-axis in global coordinates.
virtual symmTensor transformDiagTensor(const vector &p, const vector &v) const
Transform diagTensor masquerading as a vector using transformation.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
Vector< Cmpt > z() const
Definition: TensorI.H:303
Vector< Cmpt > y() const
Definition: TensorI.H:296
Vector< Cmpt > x() const
Definition: TensorI.H:289
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: UList.H:74
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Abstract base class for coordinate rotation.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
A class for managing temporary objects.
Definition: tmp.H:55
const tensorField & tf
const pointField & points
Namespace for OpenFOAM.
volScalarField & p