|
|
|
coordinateRotation.HGo 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-2009 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 Foam::coordinateRotation 00027 00028 Description 00029 A coordinate rotation specified per local axes and the base class for 00030 other rotation specifications 00031 00032 The rotation is defined by a combination of local vectors (e1/e2), (e2/e3) 00033 or (e3/e1). Any nonorthogonality will be absorbed into the second vector. 00034 00035 For convenience, the dictionary constructor forms allow a few shortcuts: 00036 - if the @c type is not otherwise specified, the type @c axes 00037 is implicit 00038 - if an axes specification (eg, e3/e1) is used, the coordinateRotation 00039 sub-dictionary can be dropped. 00040 00041 Specifying the rotation by an EulerCoordinateRotation 00042 (type "EulerRotation") or by a STARCDCoordinateRotation 00043 (type "STARCDRotation") requires the coordinateRotation sub-dictionary. 00044 00045 @verbatim 00046 coordinateRotation 00047 { 00048 type STARCDRotation 00049 rotation (0 0 90); 00050 } 00051 @endverbatim 00052 00053 - the rotation angles are in degrees, unless otherwise explictly specified: 00054 00055 @verbatim 00056 coordinateRotation 00057 { 00058 type STARCDRotation 00059 degrees false; 00060 rotation (0 0 3.141592654); 00061 } 00062 @endverbatim 00063 00064 Deprecated 00065 Specifying the local vectors as an @c axis (corresponding to e3) and a 00066 @c direction (corresponding to e1), is allowed for backwards 00067 compatibility, but this terminology is generally a bit confusing. 00068 00069 \*---------------------------------------------------------------------------*/ 00070 00071 #ifndef coordinateRotation_H 00072 #define coordinateRotation_H 00073 00074 #include "vector.H" 00075 #include "tensor.H" 00076 #include "dictionary.H" 00077 #include "runTimeSelectionTables.H" 00078 00079 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00080 00081 namespace Foam 00082 { 00083 00084 /*---------------------------------------------------------------------------*\ 00085 Class coordinateRotation Declaration 00086 \*---------------------------------------------------------------------------*/ 00087 00088 class coordinateRotation 00089 : 00090 public tensor 00091 { 00092 // Private data 00093 00094 //- the combination of local axes to be used 00095 enum axisOrder 00096 { 00097 e1e2, 00098 e2e3, 00099 e3e1 00100 }; 00101 00102 // Private Member Functions 00103 00104 //- Calculate transformation tensor 00105 void calcTransform 00106 ( 00107 const vector& axis1, 00108 const vector& axis2, 00109 const axisOrder& order = e3e1 00110 ); 00111 00112 public: 00113 00114 //- Runtime type information 00115 TypeName("coordinateRotation"); 00116 00117 // Constructors 00118 00119 //- Construct null 00120 coordinateRotation(); 00121 00122 //- Construct from 2 axes 00123 coordinateRotation 00124 ( 00125 const vector& axis, 00126 const vector& dir 00127 ); 00128 00129 //- Construct from dictionary 00130 coordinateRotation(const dictionary&); 00131 00132 //- Return clone 00133 autoPtr<coordinateRotation> clone() const 00134 { 00135 return autoPtr<coordinateRotation>(new coordinateRotation(*this)); 00136 } 00137 00138 // Declare run-time constructor selection table 00139 00140 declareRunTimeSelectionTable 00141 ( 00142 autoPtr, 00143 coordinateRotation, 00144 dictionary, 00145 ( 00146 const dictionary& dict 00147 ), 00148 (dict) 00149 ); 00150 00151 00152 // Selectors 00153 00154 //- Select constructed from Istream 00155 static autoPtr<coordinateRotation> New 00156 ( 00157 const dictionary& dict 00158 ); 00159 00160 00161 // Destructor 00162 00163 virtual ~coordinateRotation() 00164 {} 00165 00166 00167 // Member Functions 00168 00169 //- Return local-to-global transformation tensor 00170 const tensor& R() const 00171 { 00172 return (*this); 00173 } 00174 00175 //- Return local Cartesian x-axis 00176 vector& e1() const 00177 { 00178 return tensor::T().x(); 00179 } 00180 00181 //- Return local Cartesian y-axis 00182 vector& e2() const 00183 { 00184 return tensor::T().y(); 00185 } 00186 00187 //- Return local Cartesian z-axis 00188 vector& e3() const 00189 { 00190 return tensor::T().z(); 00191 } 00192 00193 00194 // Member Operators 00195 00196 //- assign from dictionary 00197 void operator=(const dictionary&); 00198 00199 }; 00200 00201 00202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00203 00204 } // End namespace Foam 00205 00206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00207 00208 #endif 00209 00210 // ************************************************************************* // |