axesRotation.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) 2011-2017 OpenFOAM Foundation
9 Copyright (C) 2017-2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::coordinateRotations::axes
29
30Description
31 A coordinateRotation specified using global axes.
32
33 The rotation is defined by a combination of vectors (e1/e2), (e2/e3)
34 or (e3/e1). Any nonorthogonality is absorbed into the second vector.
35
36 \verbatim
37 rotation
38 {
39 type axes;
40 e1 (1 0 0);
41 e2 (0 1 0);
42 }
43 \endverbatim
44
45 \heading Dictionary entries
46 \table
47 Property | Description | Reqd | Default
48 type | Type name: axes | yes |
49 e1 | local x-axis | partly |
50 e2 | local y-axis | partly |
51 e3 | local z-axis | partly |
52 \endtable
53
54Note
55 It is also possible to specify in terms of \c axis and \c direction.
56 For cylindrical coordinates, the \c axis would correspond to the
57 \a z-axis and the \c direction to the \a r-axis.
58 Also accepts "axesRotation" (OpenFOAM-v1806) for the type.
59
60SourceFiles
61 axesRotation.C
62
63\*---------------------------------------------------------------------------*/
64
65#ifndef Foam_coordinateRotations_axes_H
66#define Foam_coordinateRotations_axes_H
67
68#include "coordinateRotation.H"
69
70// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
71
72namespace Foam
73{
74namespace coordinateRotations
75{
76
77/*---------------------------------------------------------------------------*\
78 Class coordinateRotations::axes Declaration
79\*---------------------------------------------------------------------------*/
80
81class axes
82:
83 public coordinateRotation
84{
85public:
86
87 //- The order/combination of local axes for the axes-rotation definition
88 // Note that these follow the right-hand rule.
89 enum axisOrder
90 {
91 E1_E2,
92 E2_E3,
93 E3_E1,
95 };
96
97
98protected:
99
100 // Protected Data
101
102 //- The primary axis
104
105 //- The secondary axis
107
108 //- The axis order
110
111
112 // Protected Member Functions
114 //- Read from dictionary
115 void read(const dictionary& dict);
118public:
120 //- Runtime type information
121 TypeNameNoDebug("axes");
122
123
124 // Constructors
125
126 //- Default construct - an identity transform
128
129 //- Copy construct
130 axes(const axes& crot);
131
132 //- Construct from two axes
133 axes(const vector& axis1, const vector& axis2, axisOrder order=E3_E1);
134
135 //- Construct from a single axis (as e3) using a best-guess for the
136 //- second axis.
137 // The largest component and its sign are used when guessing
138 // an appropriate orientation (direction).
139 explicit axes(const vector& axis);
140
141 //- Construct from dictionary
142 explicit axes(const dictionary& dict);
143
144 //- Return clone
146 {
147 return
150 }
151
152
153 //- Destructor
154 virtual ~axes() = default;
155
156
157 // Static Member Functions
158
159 //- The rotation tensor calculated from two axes and their order.
160 // The input axes will be normalised.
161 // If axis2 is zero, an axis orthogonal to axis1 will be guessed.
162 // The largest component and its sign are used when guessing
163 // an appropriate orientation (direction).
164 static tensor rotation
165 (
166 const vector& axis1,
167 const vector& axis2,
168 axisOrder order = E3_E1
169 );
170
171
172 // Member Functions
173
174 //- Reset specification
175 virtual void clear();
176
177 //- The rotation tensor calculated from the specified axes and order
178 virtual tensor R() const;
179
180 //- Write information
181 virtual void write(Ostream& os) const;
182
183 //- Write dictionary entry
184 virtual void writeEntry(const word& keyword, Ostream& os) const;
185};
186
187
188// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189
190} // End namespace coordinateRotations
191
192// Compatibility typedef 1806
194
195} // End namespace Foam
196
197// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198
199#endif
200
201// ************************************************************************* //
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 using global axes.
Definition: axesRotation.H:108
axes()
Default construct - an identity transform.
Definition: axesRotation.C:205
virtual tensor R() const
The rotation tensor calculated from the specified axes and order.
Definition: axesRotation.C:261
void read(const dictionary &dict)
Read from dictionary.
Definition: axesRotation.C:160
virtual void writeEntry(const word &keyword, Ostream &os) const
Write dictionary entry.
Definition: axesRotation.C:290
virtual ~axes()=default
Destructor.
axisOrder order_
The axis order.
Definition: axesRotation.H:133
vector axis1_
The primary axis.
Definition: axesRotation.H:127
axisOrder
The order/combination of local axes for the axes-rotation definition.
Definition: axesRotation.H:114
@ E2_E3
The axis1 (dominant) is local Y, axis2 is local Z.
Definition: axesRotation.H:116
@ E1_E2
The axis1 (dominant) is local X, axis2 is local Y.
Definition: axesRotation.H:115
@ E3_E1_COMPAT
E3_E1 specified as axis/direction.
Definition: axesRotation.H:118
@ E3_E1
The axis1 (dominant) is local Z, axis2 is local X.
Definition: axesRotation.H:117
TypeNameNoDebug("axes")
Runtime type information.
virtual void clear()
Reset specification.
Definition: axesRotation.C:253
vector axis2_
The secondary axis.
Definition: axesRotation.H:130
autoPtr< coordinateRotation > clone() const
Return clone.
Definition: axesRotation.H:169
static tensor rotation(const vector &axis1, const vector &axis2, axisOrder order=E3_E1)
The rotation tensor calculated from two axes and their order.
Definition: axesRotation.C:69
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
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.
coordinateRotations::axes axesRotation
Definition: axesRotation.H:217
runTime write()
dictionary dict
#define TypeNameNoDebug(TypeNameString)
Declare a ClassNameNoDebug() with extra virtual type info.
Definition: typeInfo.H:68