Loading...
Searching...
No Matches
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-2024 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
102 //- The primary axis
104
105 //- The secondary axis
107
108 //- The axis order
110
111
112 // Protected Member Functions
113
114 //- Read from dictionary
115 void read(const dictionary& dict);
118public:
119
120 //- Runtime type information
121 TypeNameNoDebug("axes");
122
123
124 // Constructors
125
126 //- Default construct - an identity transform
127 axes();
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 coordinateRotation::Clone(*this);
148 }
149
150
151 //- Destructor
152 virtual ~axes() = default;
153
155 // Static Member Functions
156
157 //- The rotation tensor calculated from two axes and their order.
158 // The input axes will be normalised.
159 // If axis2 is zero, an axis orthogonal to axis1 will be guessed.
160 // The largest component and its sign are used when guessing
161 // an appropriate orientation (direction).
162 static tensor rotation
163 (
164 const vector& axis1,
165 const vector& axis2,
166 axisOrder order = E3_E1
167 );
168
169
170 // Member Functions
171
172 //- Reset specification
173 virtual void clear();
174
175 //- The rotation tensor calculated from the specified axes and order
176 virtual tensor R() const;
177
178 //- Write information
179 virtual void write(Ostream& os) const;
180
181 //- Write dictionary entry
182 virtual void writeEntry(const word& keyword, Ostream& os) const;
183};
184
185
186// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187
188} // End namespace coordinateRotations
189
190// Compatibility typedef 1806
192
193} // End namespace Foam
194
195// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196
197#endif
198
199// ************************************************************************* //
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 using global axes.
axes()
Default construct - an identity transform.
virtual tensor R() const
The rotation tensor calculated from the specified axes and order.
void read(const dictionary &dict)
Read from dictionary.
virtual void writeEntry(const word &keyword, Ostream &os) const
Write dictionary entry.
virtual ~axes()=default
Destructor.
axisOrder order_
The axis order.
vector axis1_
The primary axis.
axisOrder
The order/combination of local axes for the axes-rotation definition.
@ E2_E3
The axis1 (dominant) is local Y, axis2 is local Z.
@ E1_E2
The axis1 (dominant) is local X, axis2 is local Y.
@ E3_E1_COMPAT
E3_E1 specified as axis/direction.
@ E3_E1
The axis1 (dominant) is local Z, axis2 is local X.
TypeNameNoDebug("axes")
Runtime type information.
virtual void clear()
Reset specification.
vector axis2_
The secondary axis.
autoPtr< coordinateRotation > clone() const
Return clone.
static tensor rotation(const vector &axis1, const vector &axis2, axisOrder order=E3_E1)
The rotation tensor calculated from two axes and their order.
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.
coordinateRotations::axes axesRotation
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