coordinateRotation.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::coordinateRotation
26 
27 Description
28  Abstract base class for coordinate rotation
29 
30  \verbatim
31  coordinateRotation
32  {
33  type axesRotation
34  e1 (1 0 0);
35  e2 (0 1 0);
36  }
37  \endverbatim
38 
39  Types of coordinateRotation:
40  -# axesRotation
41  -# STARCDRotation
42  -# cylindrical
43  -# EulerCoordinateRotation
44 
45 SourceFiles
46  coordinateRotation.C
47  coordinateRotationNew.C
48 
49 \*---------------------------------------------------------------------------*/
50 
51 #ifndef coordinateRotation_H
52 #define coordinateRotation_H
53 
54 #include "vector.H"
55 #include "tensor.H"
56 #include "tensorField.H"
57 #include "dictionary.H"
58 #include "runTimeSelectionTables.H"
59 #include "objectRegistry.H"
60 #include "polyMesh.H"
61 
62 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
63 
64 namespace Foam
65 {
66 
67 /*---------------------------------------------------------------------------*\
68  Class coordinateRotation Declaration
69 \*---------------------------------------------------------------------------*/
70 
72 {
73 protected:
74 
75  // Protected member functions
76 
77  //- Transform principal
78  symmTensor transformPrincipal(const tensor&, const vector&) const;
79 
80 
81 public:
82 
83 
84  //- Runtime type information
85  TypeName("coordinateRotation");
86 
87 
88  // Declare run-time constructor selection table
89  // for constructors with dictionary
91  (
92  autoPtr,
94  dictionary,
95  (
96  const dictionary& dict
97  ),
98  (dict)
99  );
100 
101  // Declare run-time constructor selection table
102  // for constructors with dictionary and list of points
104  (
105  autoPtr,
107  points,
108  (
109  const dictionary& dict, const UList<vector>& points
110  ),
111  (dict, points)
112  );
113 
114 
115  // Constructors
116 
117  //- Construct and return a clone
118  virtual autoPtr<coordinateRotation> clone() const = 0;
119 
120 
121  // Selectors
122 
123  //- Select constructed from dictionary and list of points
125  (
126  const dictionary& dict, const UList<vector>& points
127  );
128 
129  //- Select constructed from dictionary
131  (
132  const dictionary& dict
133  );
134 
135 
136  //- Destructor
137  virtual ~coordinateRotation()
138  {}
139 
140 
141  // Member Functions
142 
143  //- Update the rotation for a list of points
144  virtual void updatePoints(const UList<vector>& points) = 0;
145 
146  //- Return local-to-global transformation tensor
147  virtual const tensor& R() const = 0;
148 
149  //- Return local Cartesian x-axis
150  virtual const vector e1() const = 0;
151 
152  //- Return local Cartesian y-axis
153  virtual const vector e2() const = 0;
154 
155  //- Return local Cartesian z-axis
156  virtual const vector e3() const = 0;
157 
158  //- Return true if the rotation tensor is uniform
159  virtual bool uniform() const
160  {
161  return true;
162  }
163 
164  //- Transform vector using transformation tensor
165  virtual vector transform(const vector& st) const = 0;
166 
167  //- Transform vectorField using transformation tensor field
168  virtual tmp<vectorField> transform(const vectorField& st) const = 0;
169 
170  //- Inverse transform vector using transformation tensor
171  virtual vector invTransform(const vector& st) const = 0;
172 
173  //- Inverse transform vectorField using transformation tensor field
174  virtual tmp<vectorField> invTransform(const vectorField& st) const = 0;
175 
176  //- Transform tensor using transformation tensorField
177  virtual tensor transformTensor(const tensor& st) const = 0;
178 
179  //- Transform tensor field using transformation tensorField
181  (
182  const tensorField& st
183  ) const = 0;
184 
185  //- Transform vector using transformation tensor and return
186  // symmetrical tensor
187  virtual symmTensor transformVector(const vector& st) const = 0;
188 
189  //- Transform vectorField using transformation tensorField and return
190  // symmetrical tensorField
192  (
193  const vectorField& st
194  ) const = 0;
195 
196 
197  // Write
198 
199  //- Write
200  virtual void write(Ostream&) const = 0;
201 };
202 
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 } // End namespace Foam
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 #endif
211 
212 // ************************************************************************* //
virtual autoPtr< coordinateRotation > clone() const =0
Construct and return a clone.
Abstract base class for coordinate rotation.
dictionary dict
symmTensor transformPrincipal(const tensor &, const vector &) const
Transform principal.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
virtual vector transform(const vector &st) const =0
Transform vector using transformation tensor.
virtual symmTensor transformVector(const vector &st) const =0
Transform vector using transformation tensor and return.
virtual ~coordinateRotation()
Destructor.
virtual const vector e1() const =0
Return local Cartesian x-axis.
virtual bool uniform() const
Return true if the rotation tensor is uniform.
static autoPtr< coordinateRotation > New(const dictionary &dict, const UList< vector > &points)
Select constructed from dictionary and list of points.
const pointField & points
virtual const vector e2() const =0
Return local Cartesian y-axis.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
TypeName("coordinateRotation")
Runtime type information.
virtual vector invTransform(const vector &st) const =0
Inverse transform vector using transformation tensor.
virtual void updatePoints(const UList< vector > &points)=0
Update the rotation for a list of points.
virtual void write(Ostream &) const =0
Write.
virtual const tensor & R() const =0
Return local-to-global transformation tensor.
declareRunTimeSelectionTable(autoPtr, coordinateRotation, dictionary,(const dictionary &dict),(dict))
virtual const vector e3() const =0
Return local Cartesian z-axis.
virtual tensor transformTensor(const tensor &st) const =0
Transform tensor using transformation tensorField.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Macros to ease declaration of run-time selection tables.
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.