Loading...
Searching...
No Matches
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-2024 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();
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 coordinateRotation::Clone(*this);
124 }
125
126
127 //- Destructor
128 virtual ~axisAngle() = default;
129
131 // Static Member Functions
132
133 //- The rotation tensor for given axis/angle
134 static tensor rotation
135 (
136 const vector& axis,
137 const scalar angle,
138 bool degrees=false
139 );
140
141 //- Rotation tensor calculated for given axis and angle
142 static tensor rotation
143 (
144 const vector::components axis,
145 const scalar angle,
146 bool degrees=false
147 );
148
149
150 // Member Functions
151
152 //- Reset specification
153 virtual void clear();
154
155 //- Calculate and return the rotation tensor
156 //- calculated from axis and angle
157 virtual tensor R() const;
158
159 //- Write information
160 virtual void write(Ostream& os) const;
161
162 //- Write dictionary entry
163 virtual void writeEntry(const word& keyword, Ostream& os) const;
164};
165
166
167// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168
169} // End namespace coordinateRotations
170} // End namespace Foam
171
172// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173
174#endif
175
176// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
User specification of a coordinate rotation.
static autoPtr< coordinateRotation > Clone(const Derived &crot)
Clone 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 tensor R() const
Calculate and return the rotation tensor calculated from axis and angle.
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:133
A class for handling words, derived from Foam::string.
Definition word.H:66
OBJstream os(runTime.globalPath()/outputName)
Namespace for coordinate system rotations.
Namespace for OpenFOAM.
Tensor< scalar > tensor
Definition symmTensor.H:57
Vector< scalar > vector
Definition vector.H:57
runTime write()
dictionary dict
#define TypeNameNoDebug(TypeNameString)
Declare a ClassNameNoDebug() with extra virtual type info.
Definition typeInfo.H:61