axisAngleRotation.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) 2018-2022 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::coordinateRotations::axisAngle
28
29Description
30 A coordinateRotation specified by a rotation axis and a rotation angle
31 about that axis.
32
33 \verbatim
34 rotation
35 {
36 type axisAngle;
37 axis (1 0 0);
38 angle 90;
39 }
40 \endverbatim
41
42 \heading Dictionary entries
43 \table
44 Property | Description | Reqd | Default
45 type | Type name: axisAngle | yes |
46 axis | Axis of rotation (vector) | yes |
47 angle | Rotation angle | yes |
48 degrees | The angle is in degrees | no | true
49 \endtable
50
51Note
52 The rotation axis is normalized internally.
53
54SourceFiles
55 axisAngleRotation.C
56
57\*---------------------------------------------------------------------------*/
58
59#ifndef Foam_coordinateRotations_axisAngle_H
60#define Foam_coordinateRotations_axisAngle_H
61
62#include "coordinateRotation.H"
63
64// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
65
66namespace Foam
67{
68namespace coordinateRotations
69{
70
71/*---------------------------------------------------------------------------*\
72 Class coordinateRotations::axisAngle Declaration
73\*---------------------------------------------------------------------------*/
74
75class axisAngle
76:
77 public coordinateRotation
78{
79 // Private Data
80
81 //- The rotation axis
82 vector axis_;
83
84 //- The rotation angle
85 scalar angle_;
86
87 //- Angle measured in degrees
88 bool degrees_;
89
90
91 // Private Member Functions
92
93 //- Check specification for an identity rotation
94 void checkSpec();
95
96
97public:
98
99 //- Runtime type information
100 TypeNameNoDebug("axisAngle");
101
102
103 // Constructors
104
105 //- Default construct. Axis = Z, angle = 0.
106 axisAngle();
107
108 //- Copy construct
109 axisAngle(const axisAngle& crot);
110
111 //- Construct from axis and angle
112 axisAngle(const vector& axis, scalar angle, bool degrees);
113
114 //- Construct from x/y/z axis enumeration and angle
115 axisAngle(const vector::components axis, scalar angle, bool degrees);
116
117 //- Construct from dictionary
118 explicit axisAngle(const dictionary& dict);
119
120 //- Return clone
122 {
123 return
126 }
127
128
129 //- Destructor
130 virtual ~axisAngle() = default;
131
132
133 // Static Member Functions
134
135 //- The rotation tensor for given axis/angle
136 static tensor rotation
137 (
138 const vector& axis,
139 const scalar angle,
140 bool degrees=false
141 );
142
143 //- Rotation tensor calculated for given axis and angle
144 static tensor rotation
146 const vector::components axis,
147 const scalar angle,
148 bool degrees=false
149 );
150
151
152 // Member Functions
153
154 //- Reset specification
155 virtual void clear();
156
157 //- Calculate and return the rotation tensor
158 //- calculated from axis and angle
159 virtual tensor R() const;
160
161 //- Write information
162 virtual void write(Ostream& os) const;
163
164 //- Write dictionary entry
165 virtual void writeEntry(const word& keyword, Ostream& os) const;
166};
167
168
169// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170
171} // End namespace coordinateRotations
172} // End namespace Foam
173
174// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175
176#endif
177
178// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
User specification of a coordinate rotation.
A coordinateRotation specified by a rotation axis and a rotation angle about that axis.
axisAngle()
Default construct. Axis = Z, angle = 0.
virtual void writeEntry(const word &keyword, Ostream &os) const
Write dictionary entry.
virtual ~axisAngle()=default
Destructor.
static tensor rotation(const vector &axis, const scalar angle, bool degrees=false)
The rotation tensor for given axis/angle.
virtual void clear()
Reset specification.
TypeNameNoDebug("axisAngle")
Runtime type information.
autoPtr< coordinateRotation > clone() const
Return clone.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Extracts the components of elements of a field and outputs the result into new fields,...
Definition: components.H:188
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A class for handling words, derived from Foam::string.
Definition: word.H:68
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
runTime write()
dictionary dict
#define TypeNameNoDebug(TypeNameString)
Declare a ClassNameNoDebug() with extra virtual type info.
Definition: typeInfo.H:68