STARCDCoordinateRotation.C
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-2016 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 \*---------------------------------------------------------------------------*/
28 
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 namespace coordinateRotations
38 {
39 
40  defineTypeName(starcd);
41 
42  // Standard short name
44  (
45  coordinateRotation,
46  starcd,
47  dictionary,
48  starcd
49  );
50 
51  // Long name - Compat 1806
53  (
54  coordinateRotation,
55  starcd,
56  dictionary,
57  starcd,
58  STARCDRotation,
59  1806
60  );
61 
62 } // End namespace coordinateRotation
63 } // End namespace Foam
64 
65 
66 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
67 
69 (
70  const vector& angles,
71  bool degrees
72 )
73 {
74  return euler::rotation(euler::eulerOrder::ZXY, angles, degrees);
75 }
76 
77 
78 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
79 
81 :
83  angles_(Zero),
84  degrees_(true)
85 {}
86 
87 
89 :
91  angles_(crot.angles_),
92  degrees_(crot.degrees_)
93 {}
94 
95 
97 (
98  const vector& rotZrotXrotY,
99  bool degrees
100 )
101 :
103  angles_(rotZrotXrotY),
104  degrees_(degrees)
105 {}
106 
107 
109 (
110  scalar rotZ,
111  scalar rotX,
112  scalar rotY,
113  bool degrees
114 )
115 :
117  angles_(rotZ, rotX, rotY),
118  degrees_(degrees)
119 {}
120 
121 
123 :
125  angles_(dict.get<vector>("angles")),
126  degrees_(dict.getOrDefault("degrees", true))
127 {}
128 
129 
130 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
131 
133 {
134  angles_ = Zero;
135  degrees_ = true;
136 }
137 
140 {
141  return starcd::rotation(angles_, degrees_);
142 }
143 
144 
146 {
147  os << "starcd-angles(" << (degrees_ ? "deg" : "rad") << "): " << angles_;
148 }
149 
150 
152 (
153  const word& keyword,
154  Ostream& os
155 ) const
156 {
157  os.beginBlock(keyword);
158 
159  os.writeEntry("type", type());
160  os.writeEntry("angles", angles_);
161  if (!degrees_)
162  {
163  os.writeEntry("degrees", "false");
164  }
165 
166  os.endBlock();
167 }
168 
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
User specification of a coordinate rotation.
dictionary dict
virtual tensor R() const
The rotation tensor calculated for the specified STARCD angles.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual void write(Ostream &os) const
Write information.
starcd()
Default construct - an identity transform.
Macros for easy insertion into run-time selection tables.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: POSIX.C:799
static tensor rotation(const vector &angles, bool degrees)
Rotation tensor calculated for the specified STARCD angles interpreted as rotate-Z, rotate-X, rotate-Y.
A class for handling words, derived from Foam::string.
Definition: word.H:63
addAliasToRunTimeSelectionTable(coordinateRotation, axes, dictionary, axes, axesRotation, 1806)
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)
virtual void clear()
Reset specification.
A coordinateRotation defined by the STAR-CD convention.
virtual void writeEntry(const word &keyword, Ostream &os) const
Write dictionary entry.
static tensor rotation(const vector &angles, bool degrees=false)
Rotation tensor calculated for the intrinsic Euler angles in z-x-z order.
addNamedToRunTimeSelectionTable(coordinateRotation, axes, dictionary, axes)
Tensor of scalars, i.e. Tensor<scalar>.
Namespace for OpenFOAM.
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:127