initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / src / meshTools / coordinateSystems / coordinateRotation / coordinateRotation.H
blob2d36e2cdef1fe2ef5b1fbc8c1a1179dce137af96
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
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.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::coordinateRotation
28 Description
29     A coordinate rotation specified per local axes and the base class for
30     other rotation specifications
32     The rotation is defined by a combination of local vectors (e1/e2), (e2/e3)
33     or (e3/e1). Any nonorthogonality will be absorbed into the second vector.
35     For convenience, the dictionary constructor forms allow a few shortcuts:
36     - if the @c type is not otherwise specified, the type @c axes
37       is implicit
38     - if an axes specification (eg, e3/e1) is used, the coordinateRotation
39       sub-dictionary can be dropped.
41     Specifying the rotation by an EulerCoordinateRotation
42     (type "EulerRotation") or by a STARCDCoordinateRotation
43     (type "STARCDRotation") requires the coordinateRotation sub-dictionary.
45     @verbatim
46         coordinateRotation
47         {
48             type        STARCDRotation
49             rotation    (0 0 90);
50         }
51     @endverbatim
53     - the rotation angles are in degrees, unless otherwise explictly specified:
55     @verbatim
56         coordinateRotation
57         {
58             type        STARCDRotation
59             degrees     false;
60             rotation    (0 0 3.141592654);
61         }
62     @endverbatim
64 Deprecated
65     Specifying the local vectors as an @c axis (corresponding to e3) and a
66     @c direction (corresponding to e1), is allowed for backwards
67     compatibility, but this terminology is generally a bit confusing.
69 \*---------------------------------------------------------------------------*/
71 #ifndef coordinateRotation_H
72 #define coordinateRotation_H
74 #include "vector.H"
75 #include "tensor.H"
76 #include "runTimeSelectionTables.H"
78 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
80 namespace Foam
83 class dictionary;
85 /*---------------------------------------------------------------------------*\
86                     Class coordinateRotation Declaration
87 \*---------------------------------------------------------------------------*/
89 class coordinateRotation
91     public tensor
93     // Private data
95         //- the combination of local axes to be used
96         enum axisOrder {
97             e1e2,
98             e2e3,
99             e3e1
100         };
102     // Private Member Functions
104         //- Calculate transformation tensor
105         void calcTransform
106         (
107             const vector& axis1,
108             const vector& axis2,
109             const axisOrder& order = e3e1
110         );
112 public:
114     //- Runtime type information
115     TypeName("coordinateRotation");
117     // Constructors
119         //- Construct null
120         coordinateRotation();
122         //- Construct from 2 axes
123         coordinateRotation
124         (
125             const vector& axis,
126             const vector& dir
127         );
129         //- Construct from dictionary
130         coordinateRotation(const dictionary&);
133     // Declare run-time constructor selection table
135         declareRunTimeSelectionTable
136         (
137             autoPtr,
138             coordinateRotation,
139             dictionary,
140             (
141                 const dictionary& dict
142             ),
143             (dict)
144         );
147     // Selectors
149         //- Select constructed from Istream
150         static autoPtr<coordinateRotation> New
151         (
152             const dictionary& dict
153         );
156     // Destructor
158         virtual ~coordinateRotation()
159         {}
162     // Member Functions
164         //- Return local-to-global transformation tensor
165         const tensor& R() const
166         {
167             return (*this);
168         }
170         //- Return local Cartesian x-axis
171         vector& e1() const
172         {
173             return tensor::T().x();
174         }
176         //- Return local Cartesian y-axis
177         vector& e2() const
178         {
179             return tensor::T().y();
180         }
182         //- Return local Cartesian z-axis
183         vector& e3() const
184         {
185             return tensor::T().z();
186         }
189     // Member Operators
191         //- assign from dictionary
192         void operator=(const dictionary&);
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199 } // End namespace Foam
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 #endif
205 // ************************************************************************* //