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-2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::coordinateRotations::axes
29 
30 Description
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 | Required | Default
48  type | type name: axes (previously axesRotation) | yes |
49  e1 | local x-axis | partly |
50  e2 | local y-axis | partly |
51  e3 | local z-axis | partly |
52  \endtable
53 
54 Note
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 
59 SourceFiles
60  axesRotation.C
61 
62 \*---------------------------------------------------------------------------*/
63 
64 #ifndef coordinateRotations_axes_H
65 #define coordinateRotations_axes_H
66 
67 #include "coordinateRotation.H"
68 
69 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
70 
71 namespace Foam
72 {
73 namespace coordinateRotations
74 {
75 
76 /*---------------------------------------------------------------------------*\
77  Class coordinateRotations::axes Declaration
78 \*---------------------------------------------------------------------------*/
79 
80 class axes
81 :
82  public coordinateRotation
83 {
84 public:
85 
86  //- The order/combination of local axes for the axes-rotation definition
87  // Note that these follow the right-hand rule.
88  enum axisOrder
89  {
90  E1_E2,
91  E2_E3,
92  E3_E1,
94  };
95 
96 
97 protected:
98 
99  // Protected Data
100 
101  //- The primary axis
102  vector axis1_;
103 
104  //- The secondary axis
105  vector axis2_;
106 
107  //- The axis order
109 
110 
111  // Protected Member Functions
112 
113  //- Read from dictionary
114  void read(const dictionary& dict);
115 
116 
117 public:
118 
119  //- Runtime type information
120  TypeNameNoDebug("axes");
121 
122 
123  // Constructors
124 
125  //- Default construct - an identity transform
126  axes();
127 
128  //- Copy construct
129  axes(const axes& crot);
130 
131  //- Construct from two axes
132  axes(const vector& axis1, const vector& axis2, axisOrder order=E3_E1);
133 
134  //- Construct from a single axis (as e3) using a best-guess for the
135  //- second axis.
136  // The largest component and its sign are used when guessing
137  // an appropriate orientation (direction).
138  explicit axes(const vector& axis);
139 
140  //- Construct from dictionary
141  explicit axes(const dictionary& dict);
142 
143  //- Return clone
145  {
146  return
148  <coordinateRotations::axes>(*this);
149  }
150 
151 
152  //- Destructor
153  virtual ~axes() = default;
154 
155 
156  // Static Member Functions
157 
158  //- The rotation tensor calculated from two axes and their order.
159  // The input axes will be normalised.
160  // If axis2 is zero, an axis orthogonal to axis1 will be guessed.
161  // The largest component and its sign are used when guessing
162  // an appropriate orientation (direction).
163  static tensor rotation
164  (
165  const vector& axis1,
166  const vector& axis2,
167  axisOrder order = E3_E1
168  );
169 
170 
171  // Member Functions
172 
173  //- Reset specification
174  virtual void clear();
175 
176  //- The rotation tensor calculated from the specified axes and order
177  virtual tensor R() const;
178 
179  //- Write information
180  virtual void write(Ostream& os) const;
181 
182  //- Write dictionary entry
183  virtual void writeEntry(const word& keyword, Ostream& os) const;
184 };
185 
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 } // End namespace coordinateRotations
190 
191 // Compatibility typedef 1806
193 
194 } // End namespace Foam
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 #endif
199 
200 // ************************************************************************* //
Foam::Tensor< scalar >
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::coordinateRotations::axes::TypeNameNoDebug
TypeNameNoDebug("axes")
Runtime type information.
Foam::coordinateRotations::axes::axis1_
vector axis1_
The primary axis.
Definition: axesRotation.H:126
Foam::coordinateRotations::axes::read
void read(const dictionary &dict)
Read from dictionary.
Definition: axesRotation.C:158
Foam::coordinateRotations::axes::axis2_
vector axis2_
The secondary axis.
Definition: axesRotation.H:129
Foam::coordinateRotations::axes::order_
axisOrder order_
The axis order.
Definition: axesRotation.H:132
Foam::coordinateRotations::axes::R
virtual tensor R() const
The rotation tensor calculated from the specified axes and order.
Definition: axesRotation.C:259
Foam::coordinateRotations::axes
A coordinateRotation specified using global axes.
Definition: axesRotation.H:104
Foam::coordinateRotations::axes::write
virtual void write(Ostream &os) const
Write information.
Definition: axesRotation.C:267
Foam::coordinateRotations::axes::clear
virtual void clear()
Reset specification.
Definition: axesRotation.C:251
Foam::coordinateRotations::axes::~axes
virtual ~axes()=default
Destructor.
Foam::coordinateRotations::axes::axes
axes()
Default construct - an identity transform.
Definition: axesRotation.C:203
Foam::coordinateRotations::axes::axisOrder
axisOrder
The order/combination of local axes for the axes-rotation definition.
Definition: axesRotation.H:112
Foam::coordinateRotation
User specification of a coordinate rotation.
Definition: coordinateRotation.H:78
Foam::coordinateRotations::axes::writeEntry
virtual void writeEntry(const word &keyword, Ostream &os) const
Write dictionary entry.
Definition: axesRotation.C:288
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam::coordinateRotations::axes::E1_E2
The axis1 (dominant) is local X, axis2 is local Y.
Definition: axesRotation.H:114
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::coordinateRotations::axes::E2_E3
The axis1 (dominant) is local Y, axis2 is local Z.
Definition: axesRotation.H:115
Foam::vector
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:51
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::coordinateRotations::axes::E3_E1_COMPAT
E3_E1 specified as axis/direction.
Definition: axesRotation.H:117
Foam::Vector< scalar >
coordinateRotation.H
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::coordinateRotations::axes::E3_E1
The axis1 (dominant) is local Z, axis2 is local X.
Definition: axesRotation.H:116
Foam::coordinateRotations::axes::rotation
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:65
Foam::coordinateRotations::axes::clone
autoPtr< coordinateRotation > clone() const
Return clone.
Definition: axesRotation.H:168
Foam::axesRotation
coordinateRotations::axes axesRotation
Definition: axesRotation.H:216