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-2024 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  );
90 
91 
92 public:
93 
94  //- Runtime type information
95  TypeName("EulerRotation");
96 
97 
98  // Constructors
99 
100  //- Construct from dictionary
102 
103  //- Construct from dictionary and list of points
105 
106  //- Construct and return a clone
107  virtual autoPtr<coordinateRotation> clone() const
108  {
110  (
111  new EulerCoordinateRotation(*this)
112  );
113  }
114 
115 
116  // Member Functions
117 
118  //- Update the rotation for a list of points
119  virtual void updatePoints(const UList<vector>& points)
120  {}
121 
122  //- Return local-to-global transformation tensor
123  virtual const tensor& R() const
124  {
125  return R_;
126  }
127 
128  //- Return local Cartesian x-axis in global coordinates
129  virtual const vector e1() const
130  {
131  return Rtr_.x();
132  }
133 
134  //- Return local Cartesian y-axis in global coordinates
135  virtual const vector e2() const
136  {
137  return Rtr_.y();
138  }
139 
140  //- Return local Cartesian z-axis in global coordinates
141  virtual const vector e3() const
142  {
143  return Rtr_.z();
144  }
145 
146  //- Transform vectorField using transformation tensor field
147  virtual tmp<vectorField> transform(const vectorField& vf) const;
148 
149  //- Transform vector using transformation tensor
150  virtual vector transform(const vector& v) const;
151 
152  //- Inverse transform vectorField using transformation tensor field
153  virtual tmp<vectorField> invTransform(const vectorField& vf) const;
154 
155  //- Inverse transform vector using transformation tensor
156  virtual vector invTransform(const vector& v) const;
157 
158  //- Transform tensor field using transformation tensorField
159  virtual tmp<tensorField> transform(const tensorField& tf) const;
160 
161  //- Transform tensor using transformation tensorField
162  virtual tensor transform(const vector& p, const tensor& t) const;
163 
164  //- Transform diagTensor masquerading as a vector using transformation
165  // tensor and return symmTensor
167  (
168  const vector& p,
169  const vector& v
170  ) const;
171 
172  //- Transform diagTensorField masquerading as a vectorField
173  // using transformation tensorField and return symmTensorField
175  (
176  const vectorField& vf
177  ) const;
178 
179 
180  // Write
181 
182  //- Write
183  virtual void write(Ostream&) const;
184 };
185 
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 } // End namespace Foam
190 
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 
193 #endif
194 
195 // ************************************************************************* //
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:162
A class for managing temporary objects.
Definition: tmp.H:55
const tensorField & tf
const pointField & points
Namespace for OpenFOAM.
volScalarField & p