Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
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
27\*---------------------------------------------------------------------------*/
28
32
33// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34
35namespace Foam
37namespace coordinateRotations
38{
39
41
42 // Standard short name
44 (
46 starcd,
48 starcd
49 );
50
51 // Long name - Compat 1806
53 (
55 starcd,
57 starcd,
58 STARCDRotation,
59 1806
60 );
62} // End namespace coordinateRotation
63} // End namespace Foam
64
65
66// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
67
69(
70 const vector& angles,
71 bool degrees
72)
74 return euler::rotation(euler::eulerOrder::ZXY, angles, degrees);
75}
76
77
78// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
79
83 angles_(Zero),
84 degrees_(true)
85{}
86
87
91 angles_(crot.angles_),
92 degrees_(crot.degrees_)
93{}
94
95
97(
98 const vector& rotZrotXrotY,
99 bool degrees
100)
103 angles_(rotZrotXrotY),
104 degrees_(degrees)
105{}
106
107
109(
110 scalar rotZ,
111 scalar rotX,
112 scalar rotY,
113 bool degrees
114)
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
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// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Macros for easy insertion into run-time selection tables.
#define addAliasToRunTimeSelectionTable(baseType, thisType, argNames, lookup, other, ver)
Add lookup alias for runTime selection.
#define addNamedToRunTimeSelectionTable(baseType, thisType, argNames, lookupName)
Add to construction table with 'lookupName' as the key.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
User specification of a coordinate rotation.
static tensor rotation(const vector &angles, bool degrees=false)
Rotation tensor calculated for the intrinsic Euler angles in z-x-z order.
A coordinateRotation defined by the STAR-CD convention.
starcd()
Default construct - an identity transform.
virtual tensor R() const
The rotation tensor calculated for the specified STARCD angles.
virtual void write(Ostream &os) const
Write information.
virtual void writeEntry(const word &keyword, Ostream &os) const
Write dictionary entry.
virtual void clear()
Reset specification.
static tensor rotation(const vector &angles, bool degrees)
Rotation tensor calculated for the specified STARCD angles interpreted as rotate-Z,...
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
#define defineTypeName(Type)
Define the typeName.
Definition className.H:113
OBJstream os(runTime.globalPath()/outputName)
Namespace for coordinate system rotations.
Namespace for OpenFOAM.
Tensor< scalar > tensor
Definition symmTensor.H:57
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition POSIX.C:801
static constexpr const zero Zero
Global zero (0).
Definition zero.H:127
Vector< scalar > vector
Definition vector.H:57
dictionary dict