OpenFOAM logo
The Open Source CFD Toolbox
  Programmer’s C++ Doxygen OpenCFD Solutions Contact OpenFOAM

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-2007 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 the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     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, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     coordinateRotation
00027 
00028 Description
00029     Base class for coordinate rotation.
00030 
00031     The rotation is defined by a combination of local vectors.
00032     The local vectors can be specified by an 'axis' (usually the z-axis)
00033     and a 'direction' (effectively the x-axis), or by another combination
00034     of local vectors (e1/e2), (e2/e3) or (e3/e1).
00035     Any nonorthogonality will absorbed into the second vector.
00036 
00037 \*---------------------------------------------------------------------------*/
00038 
00039 #ifndef coordinateRotation_H
00040 #define coordinateRotation_H
00041 
00042 #include "vector.H"
00043 #include "tensor.H"
00044 #include "runTimeSelectionTables.H"
00045 
00046 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00047 
00048 namespace Foam
00049 {
00050 
00051 class dictionary;
00052 
00053 /*---------------------------------------------------------------------------*\
00054                     Class coordinateRotation Declaration
00055 \*---------------------------------------------------------------------------*/
00056 
00057 class coordinateRotation
00058 :
00059     public tensor
00060 {
00061     // Private data
00062 
00063         //- the combination of local axes to be used
00064         enum axisOrder {
00065             e1e2,
00066             e2e3,
00067             e3e1
00068         };
00069 
00070     // Private Member Functions
00071 
00072         //- Calculate transformation tensor
00073         void calcTransform
00074         (
00075             const vector& axis1,
00076             const vector& axis2,
00077             const axisOrder& order = e3e1
00078         );
00079 
00080 public:
00081 
00082     //- Runtime type information
00083     TypeName("coordinateRotation");
00084 
00085     // Constructors
00086 
00087         //- Construct null
00088         coordinateRotation();
00089 
00090         //- Construct from 2 axes
00091         coordinateRotation
00092         (
00093             const vector& axis,
00094             const vector& dir
00095         );
00096 
00097         //- Construct from dictionary
00098         coordinateRotation(const dictionary&);
00099 
00100 
00101     // Declare run-time constructor selection table
00102 
00103         declareRunTimeSelectionTable
00104         (
00105             autoPtr,
00106             coordinateRotation,
00107             dictionary,
00108             (
00109                 const dictionary& dict
00110             ),
00111             (dict)
00112         );
00113 
00114 
00115     // Selectors
00116 
00117         //- Select constructed from Istream
00118         static autoPtr<coordinateRotation> New
00119         (
00120             const dictionary& dict
00121         );
00122 
00123 
00124     // Destructor
00125 
00126         virtual ~coordinateRotation()
00127         {}
00128 
00129 
00130     // Member Functions
00131 
00132         //- Return local-to-global transformation tensor
00133         const tensor& R() const
00134         {
00135             return (*this);
00136         }
00137 
00138         //- Return local Cartesian x-axis
00139         vector& e1() const
00140         {
00141             return tensor::T().x();
00142         }
00143 
00144         //- Return local Cartesian y-axis
00145         vector& e2() const
00146         {
00147             return tensor::T().y();
00148         }
00149 
00150         //- Return local Cartesian z-axis
00151         vector& e3() const
00152         {
00153             return tensor::T().z();
00154         }
00155 
00156 
00157     // Member Operators
00158 
00159         //- assign from dictionary
00160         void operator=(const dictionary&);
00161 
00162 };
00163 
00164 
00165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00166 
00167 } // End namespace Foam
00168 
00169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00170 
00171 #endif
00172 
00173 // ************************************************************************* //
Copyright © 2000-2007 OpenCFD Ltd