coordinateRotation.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-2016 OpenFOAM Foundation
9  Copyright (C) 2018-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 Namespace
28  Foam::coordinateRotations
29 
30 Description
31  Namespace for coordinate system rotations.
32 
33 Class
34  Foam::coordinateRotation
35 
36 Description
37  User specification of a coordinate rotation.
38 
39  \verbatim
40  rotation
41  {
42  type axes
43  e1 (1 0 0);
44  e2 (0 1 0);
45  }
46  \endverbatim
47 
48  Types of coordinateRotations:
49  -# \link coordinateRotations::identity none \endlink
50  -# \link coordinateRotations::axes axes \endlink
51  -# \link coordinateRotations::axisAngle axisAngle \endlink
52  -# \link coordinateRotations::cylindrical cylindrical \endlink
53  -# \link coordinateRotations::euler euler \endlink
54  -# \link coordinateRotations::starcd starcd \endlink
55 
56 SourceFiles
57  coordinateRotation.C
58 
59 \*---------------------------------------------------------------------------*/
60 
61 #ifndef Foam_coordinateRotation_H
62 #define Foam_coordinateRotation_H
63 
64 #include "autoPtr.H"
65 #include "vector.H"
66 #include "tensor.H"
67 #include "dictionary.H"
68 #include "IOobjectOption.H"
69 #include "runTimeSelectionTables.H"
70 
71 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
72 
73 namespace Foam
74 {
75 
76 /*---------------------------------------------------------------------------*\
77  Class coordinateRotation Declaration
78 \*---------------------------------------------------------------------------*/
79 
81 {
82 protected:
83 
84  // Protected Member Functions
85 
86  //- Determine best-guess for an orthogonal axis
87  static vector findOrthogonal(const vector& axis);
88 
89 
90 public:
91 
92  //- Runtime type information
93  TypeNameNoDebug("coordinateRotation");
94 
95  // Declare run-time constructor selection table from dictionary
97  (
98  autoPtr,
100  dictionary,
101  (
102  const dictionary& dict
103  ),
104  (dict)
105  );
106 
107 
108  // Constructors
109 
110  // Uses all default constructors
111 
112  //- Construct and return a clone
113  virtual autoPtr<coordinateRotation> clone() const = 0;
114 
115 
116  // Selectors
117 
118  //- Select construct the specified coordinate rotation type
119  //
120  // An empty modelType will be treated as "axes" (eg, e1/e3)
122  (
123  const word& modelType,
124  const dictionary& dict
125  );
126 
127  //- Select construct from dictionary (requires the "type" entry)
129 
130 
131  //- Destructor
132  virtual ~coordinateRotation() = default;
133 
134 
135  // Member Functions
136 
137  //- Reset specification
138  virtual void clear() = 0;
139 
140  //- Calculate and return the rotation tensor
141  virtual tensor R() const = 0;
142 
143 
144  // Write
145 
146  //- Write information
147  virtual void write(Ostream& os) const = 0;
148 
149  //- Write dictionary entry
150  virtual void writeEntry(const word& keyword, Ostream& os) const = 0;
151 };
152 
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 } // End namespace Foam
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 #endif
161 
162 // ************************************************************************* //
virtual autoPtr< coordinateRotation > clone() const =0
Construct and return a clone.
User specification of a coordinate rotation.
dictionary dict
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 =0
Write information.
virtual void writeEntry(const word &keyword, Ostream &os) const =0
Write dictionary entry.
A class for handling words, derived from Foam::string.
Definition: word.H:63
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)
declareRunTimeSelectionTable(autoPtr, coordinateRotation, dictionary,(const dictionary &dict),(dict))
TypeNameNoDebug("coordinateRotation")
Runtime type information.
static vector findOrthogonal(const vector &axis)
Determine best-guess for an orthogonal axis.
virtual void clear()=0
Reset specification.
virtual ~coordinateRotation()=default
Destructor.
virtual tensor R() const =0
Calculate and return the rotation tensor.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
Macros to ease declaration of run-time selection tables.
Tensor of scalars, i.e. Tensor<scalar>.
Namespace for OpenFOAM.
static autoPtr< coordinateRotation > New(const word &modelType, const dictionary &dict)
Select construct the specified coordinate rotation type.