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-2024 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  //- Return a clone
113  virtual autoPtr<coordinateRotation> clone() const = 0;
114 
115 
116  // Factory Methods
117 
118  //- Clone a coordinate rotation
119  template<class Derived>
120  static autoPtr<coordinateRotation> Clone(const Derived& crot)
121  {
122  return autoPtr<coordinateRotation>(new Derived(crot));
123  }
125  //- Select construct the specified coordinate rotation type
126  //
127  // An empty modelType will be treated as "axes" (eg, e1/e3)
129  (
130  const word& modelType,
131  const dictionary& dict
132  );
133 
134  //- Select construct from dictionary (requires the "type" entry)
136 
137 
138  //- Destructor
139  virtual ~coordinateRotation() = default;
140 
141 
142  // Member Functions
143 
144  //- Reset specification
145  virtual void clear() = 0;
146 
147  //- Calculate and return the rotation tensor
148  virtual tensor R() const = 0;
149 
150 
151  // Write
152 
153  //- Write information
154  virtual void write(Ostream& os) const = 0;
155 
156  //- Write dictionary entry
157  virtual void writeEntry(const word& keyword, Ostream& os) const = 0;
158 };
159 
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 } // End namespace Foam
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 #endif
168 
169 // ************************************************************************* //
virtual autoPtr< coordinateRotation > clone() const =0
Return a clone.
User specification of a coordinate rotation.
dictionary dict
static autoPtr< coordinateRotation > Clone(const Derived &crot)
Clone a coordinate rotation.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:130
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...
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.