ENH: RASModel.C: clipping input to log
[OpenFOAM-1.7.x.git] / src / meshTools / coordinateSystems / coordinateRotation / coordinateRotation.H
blob1ac4e79fb7015e16d22f411044020a30421bfc0b
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.
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.
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, see <http://www.gnu.org/licenses/>.
24 Class
25     Foam::coordinateRotation
27 Description
28     A coordinate rotation specified per local axes and the base class for
29     other rotation specifications
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.
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.
40     Specifying the rotation by an EulerCoordinateRotation
41     (type "EulerRotation") or by a STARCDCoordinateRotation
42     (type "STARCDRotation") requires the coordinateRotation sub-dictionary.
44     @verbatim
45         coordinateRotation
46         {
47             type        STARCDRotation
48             rotation    (0 0 90);
49         }
50     @endverbatim
52     - the rotation angles are in degrees, unless otherwise explictly specified:
54     @verbatim
55         coordinateRotation
56         {
57             type        STARCDRotation
58             degrees     false;
59             rotation    (0 0 3.141592654);
60         }
61     @endverbatim
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.
68 \*---------------------------------------------------------------------------*/
70 #ifndef coordinateRotation_H
71 #define coordinateRotation_H
73 #include "vector.H"
74 #include "tensor.H"
75 #include "dictionary.H"
76 #include "runTimeSelectionTables.H"
78 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
80 namespace Foam
83 /*---------------------------------------------------------------------------*\
84                     Class coordinateRotation Declaration
85 \*---------------------------------------------------------------------------*/
87 class coordinateRotation
89     public tensor
91     // Private data
93         //- the combination of local axes to be used
94         enum axisOrder
95         {
96             e1e2,
97             e2e3,
98             e3e1
99         };
101     // Private Member Functions
103         //- Calculate transformation tensor
104         void calcTransform
105         (
106             const vector& axis1,
107             const vector& axis2,
108             const axisOrder& order = e3e1
109         );
111 public:
113     //- Runtime type information
114     TypeName("coordinateRotation");
116     // Constructors
118         //- Construct null
119         coordinateRotation();
121         //- Construct from 2 axes
122         coordinateRotation
123         (
124             const vector& axis,
125             const vector& dir
126         );
128         //- Construct from dictionary
129         coordinateRotation(const dictionary&);
131         //- Return clone
132         autoPtr<coordinateRotation> clone() const
133         {
134             return autoPtr<coordinateRotation>(new coordinateRotation(*this));
135         }
137     // Declare run-time constructor selection table
139         declareRunTimeSelectionTable
140         (
141             autoPtr,
142             coordinateRotation,
143             dictionary,
144             (
145                 const dictionary& dict
146             ),
147             (dict)
148         );
151     // Selectors
153         //- Select constructed from Istream
154         static autoPtr<coordinateRotation> New
155         (
156             const dictionary& dict
157         );
160     // Destructor
162         virtual ~coordinateRotation()
163         {}
166     // Member Functions
168         //- Return local-to-global transformation tensor
169         const tensor& R() const
170         {
171             return (*this);
172         }
174         //- Return local Cartesian x-axis
175         const vector e1() const
176         {
177             return tensor::T().x();
178         }
180         //- Return local Cartesian y-axis
181         const vector e2() const
182         {
183             return tensor::T().y();
184         }
186         //- Return local Cartesian z-axis
187         const vector e3() const
188         {
189             return tensor::T().z();
190         }
193     // Member Operators
195         //- assign from dictionary
196         void operator=(const dictionary&);
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 } // End namespace Foam
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 #endif
209 // ************************************************************************* //