FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

coordinateRotation.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::coordinateRotation
00026 
00027 Description
00028     A coordinate rotation specified per local axes and the base class for
00029     other rotation specifications
00030 
00031     The rotation is defined by a combination of local vectors (e1/e2), (e2/e3)
00032     or (e3/e1). Any nonorthogonality will be absorbed into the second vector.
00033 
00034     For convenience, the dictionary constructor forms allow a few shortcuts:
00035     - if the @c type is not otherwise specified, the type @c axes
00036       is implicit
00037     - if an axes specification (eg, e3/e1) is used, the coordinateRotation
00038       sub-dictionary can be dropped.
00039 
00040     Specifying the rotation by an EulerCoordinateRotation
00041     (type "EulerRotation") or by a STARCDCoordinateRotation
00042     (type "STARCDRotation") requires the coordinateRotation sub-dictionary.
00043 
00044     @verbatim
00045         coordinateRotation
00046         {
00047             type        STARCDRotation
00048             rotation    (0 0 90);
00049         }
00050     @endverbatim
00051 
00052     - the rotation angles are in degrees, unless otherwise explictly specified:
00053 
00054     @verbatim
00055         coordinateRotation
00056         {
00057             type        STARCDRotation
00058             degrees     false;
00059             rotation    (0 0 3.141592654);
00060         }
00061     @endverbatim
00062 
00063 Deprecated
00064     Specifying the local vectors as an @c axis (corresponding to e3) and a
00065     @c direction (corresponding to e1), is allowed for backwards
00066     compatibility, but this terminology is generally a bit confusing.
00067 
00068 \*---------------------------------------------------------------------------*/
00069 
00070 #ifndef coordinateRotation_H
00071 #define coordinateRotation_H
00072 
00073 #include <OpenFOAM/vector.H>
00074 #include <OpenFOAM/tensor.H>
00075 #include <OpenFOAM/dictionary.H>
00076 #include <OpenFOAM/runTimeSelectionTables.H>
00077 
00078 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00079 
00080 namespace Foam
00081 {
00082 
00083 /*---------------------------------------------------------------------------*\
00084                     Class coordinateRotation Declaration
00085 \*---------------------------------------------------------------------------*/
00086 
00087 class coordinateRotation
00088 :
00089     public tensor
00090 {
00091     // Private data
00092 
00093         //- the combination of local axes to be used
00094         enum axisOrder
00095         {
00096             e1e2,
00097             e2e3,
00098             e3e1
00099         };
00100 
00101     // Private Member Functions
00102 
00103         //- Calculate transformation tensor
00104         void calcTransform
00105         (
00106             const vector& axis1,
00107             const vector& axis2,
00108             const axisOrder& order = e3e1
00109         );
00110 
00111 public:
00112 
00113     //- Runtime type information
00114     TypeName("coordinateRotation");
00115 
00116     // Constructors
00117 
00118         //- Construct null
00119         coordinateRotation();
00120 
00121         //- Construct from 2 axes
00122         coordinateRotation
00123         (
00124             const vector& axis,
00125             const vector& dir
00126         );
00127 
00128         //- Construct from dictionary
00129         coordinateRotation(const dictionary&);
00130 
00131         //- Return clone
00132         autoPtr<coordinateRotation> clone() const
00133         {
00134             return autoPtr<coordinateRotation>(new coordinateRotation(*this));
00135         }
00136 
00137     // Declare run-time constructor selection table
00138 
00139         declareRunTimeSelectionTable
00140         (
00141             autoPtr,
00142             coordinateRotation,
00143             dictionary,
00144             (
00145                 const dictionary& dict
00146             ),
00147             (dict)
00148         );
00149 
00150 
00151     // Selectors
00152 
00153         //- Select constructed from Istream
00154         static autoPtr<coordinateRotation> New
00155         (
00156             const dictionary& dict
00157         );
00158 
00159 
00160     // Destructor
00161 
00162         virtual ~coordinateRotation()
00163         {}
00164 
00165 
00166     // Member Functions
00167 
00168         //- Return local-to-global transformation tensor
00169         const tensor& R() const
00170         {
00171             return (*this);
00172         }
00173 
00174         //- Return local Cartesian x-axis
00175         const vector e1() const
00176         {
00177             return tensor::T().x();
00178         }
00179 
00180         //- Return local Cartesian y-axis
00181         const vector e2() const
00182         {
00183             return tensor::T().y();
00184         }
00185 
00186         //- Return local Cartesian z-axis
00187         const vector e3() const
00188         {
00189             return tensor::T().z();
00190         }
00191 
00192 
00193     // Member Operators
00194 
00195         //- assign from dictionary
00196         void operator=(const dictionary&);
00197 
00198 };
00199 
00200 
00201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00202 
00203 } // End namespace Foam
00204 
00205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00206 
00207 #endif
00208 
00209 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines