FreeFOAM The Cross-Platform CFD Toolkit
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 | Copyright (C) 1991-2010 OpenCFD Ltd.
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  A coordinate rotation specified per local axes and the base class for
29  other rotation specifications
30 
31  The rotation is defined by a combination of local vectors (e1/e2), (e2/e3)
32  or (e3/e1). Any nonorthogonality will be absorbed into the second vector.
33 
34  For convenience, the dictionary constructor forms allow a few shortcuts:
35  - if the @c type is not otherwise specified, the type @c axes
36  is implicit
37  - if an axes specification (eg, e3/e1) is used, the coordinateRotation
38  sub-dictionary can be dropped.
39 
40  Specifying the rotation by an EulerCoordinateRotation
41  (type "EulerRotation") or by a STARCDCoordinateRotation
42  (type "STARCDRotation") requires the coordinateRotation sub-dictionary.
43 
44  @verbatim
45  coordinateRotation
46  {
47  type STARCDRotation
48  rotation (0 0 90);
49  }
50  @endverbatim
51 
52  - the rotation angles are in degrees, unless otherwise explictly specified:
53 
54  @verbatim
55  coordinateRotation
56  {
57  type STARCDRotation
58  degrees false;
59  rotation (0 0 3.141592654);
60  }
61  @endverbatim
62 
63 Deprecated
64  Specifying the local vectors as an @c axis (corresponding to e3) and a
65  @c direction (corresponding to e1), is allowed for backwards
66  compatibility, but this terminology is generally a bit confusing.
67 
68 \*---------------------------------------------------------------------------*/
69 
70 #ifndef coordinateRotation_H
71 #define coordinateRotation_H
72 
73 #include <OpenFOAM/vector.H>
74 #include <OpenFOAM/tensor.H>
75 #include <OpenFOAM/dictionary.H>
77 
78 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
79 
80 namespace Foam
81 {
82 
83 /*---------------------------------------------------------------------------*\
84  Class coordinateRotation Declaration
85 \*---------------------------------------------------------------------------*/
86 
88 :
89  public tensor
90 {
91  // Private data
92 
93  //- the combination of local axes to be used
94  enum axisOrder
95  {
96  e1e2,
97  e2e3,
98  e3e1
99  };
100 
101  // Private Member Functions
102 
103  //- Calculate transformation tensor
104  void calcTransform
105  (
106  const vector& axis1,
107  const vector& axis2,
108  const axisOrder& order = e3e1
109  );
110 
111 public:
112 
113  //- Runtime type information
114  TypeName("coordinateRotation");
115 
116  // Constructors
117 
118  //- Construct null
120 
121  //- Construct from 2 axes
123  (
124  const vector& axis,
125  const vector& dir
126  );
127 
128  //- Construct from dictionary
130 
131  //- Return clone
133  {
135  }
136 
137  // Declare run-time constructor selection table
138 
140  (
141  autoPtr,
143  dictionary,
144  (
145  const dictionary& dict
146  ),
147  (dict)
148  );
149 
150 
151  // Selectors
152 
153  //- Select constructed from Istream
155  (
156  const dictionary& dict
157  );
158 
159 
160  // Destructor
161 
163  {}
164 
165 
166  // Member Functions
167 
168  //- Return local-to-global transformation tensor
169  const tensor& R() const
170  {
171  return (*this);
172  }
173 
174  //- Return local Cartesian x-axis
175  const vector e1() const
176  {
177  return tensor::T().x();
178  }
179 
180  //- Return local Cartesian y-axis
181  const vector e2() const
182  {
183  return tensor::T().y();
184  }
185 
186  //- Return local Cartesian z-axis
187  const vector e3() const
188  {
189  return tensor::T().z();
190  }
191 
192 
193  // Member Operators
194 
195  //- assign from dictionary
196  void operator=(const dictionary&);
197 
198 };
199 
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 } // End namespace Foam
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 #endif
208 
209 // ************************ vim: set sw=4 sts=4 et: ************************ //