axesRotation.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::axesRotation
26 
27 Description
28  A coordinate rotation specified using global axis
29 
30  The rotation is defined by a combination of vectors (e1/e2), (e2/e3)
31  or (e3/e1). Any nonorthogonality will be absorbed into the second
32  vector.
33 
34  \verbatim
35  axesRotation
36  {
37  type axesRotation;
38  e1 (1 0 0);
39  e2 (0 1 0);
40  }
41  \endverbatim
42 
43 SourceFiles
44  axesRotation.C
45 
46 \*---------------------------------------------------------------------------*/
47 
48 #ifndef axesRotation_H
49 #define axesRotation_H
50 
51 #include "vector.H"
52 #include "coordinateRotation.H"
53 #include "dictionary.H"
54 #include "runTimeSelectionTables.H"
55 
56 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 
58 namespace Foam
59 {
60 
61 /*---------------------------------------------------------------------------*\
62  Class axesRotation Declaration
63 \*---------------------------------------------------------------------------*/
64 
65 class axesRotation
66 :
67  public coordinateRotation
68 {
69  // Private Data
70 
71  //- Local-to-Global transformation tensor
72  tensor R_;
73 
74  //- Global-to-Local transformation tensor
75  tensor Rtr_;
76 
77  //- The combination of local axes to be used
78  enum axisOrder
79  {
80  e1e2,
81  e2e3,
82  e3e1
83  };
84 
85  // Private Member Functions
86 
87  //- Calculate transformation tensor
88  void calcTransform
89  (
90  const vector& axis1,
91  const vector& axis2,
92  const axisOrder& order = e3e1
93  );
94 
95 
96 public:
97 
98  //- Runtime type information
99  TypeName("axesRotation");
100 
101  // Constructors
102 
103  //- Construct from 2 axes
104  axesRotation(const vector& axis, const vector& dir);
105 
106  //- Construct from components
107  axesRotation(const tensor& R);
108 
109  //- Construct from dictionary
110  axesRotation(const dictionary&);
111 
112  //- Construct from dictionary and list of points
114 
115  //- Construct and return a clone
116  virtual autoPtr<coordinateRotation> clone() const
117  {
118  return autoPtr<coordinateRotation>(new axesRotation(*this));
119  }
120 
121 
122  //- Destructor
123  virtual ~axesRotation()
124  {}
125 
126 
127  // Member Functions
128 
129  //- Update the rotation for a list of points
130  virtual void updatePoints(const UList<vector>& points)
131  {}
132 
133  //- Return local-to-global transformation tensor
134  virtual const tensor& R() const
135  {
136  return R_;
137  }
138 
139  //- Return local Cartesian x-axis in global coordinates
140  virtual const vector e1() const
141  {
142  return Rtr_.x();
143  }
144 
145  //- Return local Cartesian y-axis in global coordinates
146  virtual const vector e2() const
147  {
148  return Rtr_.y();
149  }
150 
151  //- Return local Cartesian z-axis in global coordinates
152  virtual const vector e3() const
153  {
154  return Rtr_.z();
155  }
156 
157  //- Transform vectorField using transformation tensor field
158  virtual tmp<vectorField> transform(const vectorField& st) const;
159 
160  //- Transform vector using transformation tensor
161  virtual vector transform(const vector& st) const;
162 
163  //- Inverse transform vectorField using transformation tensor field
164  virtual tmp<vectorField> invTransform(const vectorField& st) const;
165 
166  //- Inverse transform vector using transformation tensor
167  virtual vector invTransform(const vector& st) const;
168 
169  //- Transform tensor field using transformation tensorField
170  virtual tmp<tensorField> transformTensor(const tensorField& st) const;
171 
172  //- Transform tensor using transformation tensorField
173  virtual tensor transformTensor(const tensor& st) const;
174 
175  //- Transform vectorField using transformation tensorField and return
176  // symmetric tensorField
178  (
179  const vectorField& st
180  ) const;
181 
182  //- Transform vector using transformation tensor and return
183  // symmetric tensor
184  virtual symmTensor transformVector(const vector& st) const;
185 
186 
187  // Member Operators
188 
189  //- Assign from dictionary
190  void operator=(const dictionary&);
191 
192 
193  // Write
194 
195  //- Write
196  virtual void write(Ostream&) const;
197 };
198 
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 } // End namespace Foam
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 #endif
207 
208 // ************************************************************************* //
Abstract base class for coordinate rotation.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
Vector< Cmpt > x() const
Definition: TensorI.H:289
virtual ~axesRotation()
Destructor.
Definition: axesRotation.H:122
Vector< Cmpt > y() const
Definition: TensorI.H:296
virtual const vector e2() const
Return local Cartesian y-axis in global coordinates.
Definition: axesRotation.H:145
virtual tmp< vectorField > invTransform(const vectorField &st) const
Inverse transform vectorField using transformation tensor field.
Definition: axesRotation.C:163
virtual tmp< symmTensorField > transformVector(const vectorField &st) const
Transform vectorField using transformation tensorField and return.
Definition: axesRotation.C:197
virtual const tensor & R() const
Return local-to-global transformation tensor.
Definition: axesRotation.H:133
virtual void updatePoints(const UList< vector > &points)
Update the rotation for a list of points.
Definition: axesRotation.H:129
Vector< Cmpt > z() const
Definition: TensorI.H:303
TypeName("axesRotation")
Runtime type information.
const pointField & points
virtual autoPtr< coordinateRotation > clone() const
Construct and return a clone.
Definition: axesRotation.H:115
virtual const vector e3() const
Return local Cartesian z-axis in global coordinates.
Definition: axesRotation.H:151
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
virtual tmp< vectorField > transform(const vectorField &st) const
Transform vectorField using transformation tensor field.
Definition: axesRotation.C:148
virtual const vector e1() const
Return local Cartesian x-axis in global coordinates.
Definition: axesRotation.H:139
void operator=(const dictionary &)
Assign from dictionary.
Definition: axesRotation.C:231
virtual void write(Ostream &) const
Write.
Definition: axesRotation.C:221
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
axesRotation(const vector &axis, const vector &dir)
Construct from 2 axes.
Definition: axesRotation.C:104
Macros to ease declaration of run-time selection tables.
A coordinate rotation specified using global axis.
Definition: axesRotation.H:64
A class for managing temporary objects.
Definition: PtrList.H:53
virtual tmp< tensorField > transformTensor(const tensorField &st) const
Transform tensor field using transformation tensorField.
Definition: axesRotation.C:178
Namespace for OpenFOAM.