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 -------------------------------------------------------------------------------
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 | 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 
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  Also accepts "axesRotation" (OpenFOAM-v1806) for the type.
59 
60 SourceFiles
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 
72 namespace Foam
73 {
74 namespace coordinateRotations
75 {
76 
77 /*---------------------------------------------------------------------------*\
78  Class coordinateRotations::axes Declaration
79 \*---------------------------------------------------------------------------*/
80 
81 class axes
82 :
83  public coordinateRotation
84 {
85 public:
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 
98 protected:
99 
100  // Protected Data
102  //- The primary axis
103  vector axis1_;
104 
105  //- The secondary axis
106  vector axis2_;
107 
108  //- The axis order
110 
111 
112  // Protected Member Functions
113 
114  //- Read from dictionary
115  void read(const dictionary& dict);
118 public:
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
149  <coordinateRotations::axes>(*this);
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
192 // Compatibility typedef 1806
194 
195 } // End namespace Foam
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 #endif
200 
201 // ************************************************************************* //
virtual ~axes()=default
Destructor.
E3_E1 specified as axis/direction.
Definition: axesRotation.H:117
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
coordinateRotations::axes axesRotation
Definition: axesRotation.H:252
The axis1 (dominant) is local Y, axis2 is local Z.
Definition: axesRotation.H:115
TypeNameNoDebug("axes")
Runtime type information.
vector axis1_
The primary axis.
Definition: axesRotation.H:128
The axis1 (dominant) is local Z, axis2 is local X.
Definition: axesRotation.H:116
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:62
A class for handling words, derived from Foam::string.
Definition: word.H:63
autoPtr< coordinateRotation > clone() const
Return clone.
Definition: axesRotation.H:191
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
OBJstream os(runTime.globalPath()/outputName)
axisOrder order_
The axis order.
Definition: axesRotation.H:138
vector axis2_
The secondary axis.
Definition: axesRotation.H:133
void read(const dictionary &dict)
Read from dictionary.
Definition: axesRotation.C:153
virtual void writeEntry(const word &keyword, Ostream &os) const
Write dictionary entry.
Definition: axesRotation.C:283
A coordinateRotation specified using global axes.
Definition: axesRotation.H:101
axisOrder
The order/combination of local axes for the axes-rotation definition.
Definition: axesRotation.H:112
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
The axis1 (dominant) is local X, axis2 is local Y.
Definition: axesRotation.H:114
Tensor of scalars, i.e. Tensor<scalar>.
virtual void write(Ostream &os) const
Write information.
Definition: axesRotation.C:262
virtual void clear()
Reset specification.
Definition: axesRotation.C:246
axes()
Default construct - an identity transform.
Definition: axesRotation.C:198
Namespace for OpenFOAM.
virtual tensor R() const
The rotation tensor calculated from the specified axes and order.
Definition: axesRotation.C:254