coordinateRotation.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 Class
25  Foam::coordinateRotation
26 
27 Description
28  Abstract base class for coordinate rotation
29 
30  \verbatim
31  coordinateRotation
32  {
33  type axesRotation
34  e1 (1 0 0);
35  e2 (0 1 0);
36  }
37  \endverbatim
38 
39  Types of coordinateRotation:
40  1) axesRotation
41  2) STARCDRotation
42  3) cylindrical
43  4) EulerCoordinateRotation
44 
45 
46 
47 \*---------------------------------------------------------------------------*/
48 
49 #ifndef coordinateRotation_H
50 #define coordinateRotation_H
51 
52 #include "vector.H"
53 #include "tensor.H"
54 #include "tensorField.H"
55 #include "dictionary.H"
56 #include "runTimeSelectionTables.H"
57 #include "objectRegistry.H"
58 #include "polyMesh.H"
59 
60 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61 
62 namespace Foam
63 {
64 
65 /*---------------------------------------------------------------------------*\
66  Class coordinateRotation Declaration
67 \*---------------------------------------------------------------------------*/
68 
70 {
71 protected:
72 
73  // Protected member functions
74 
75  //- Transform principal
76  symmTensor transformPrincipal(const tensor&, const vector&) const;
77 
78 
79 public:
80 
81 
82  //- Runtime type information
83  TypeName("coordinateRotation");
84 
85 
86  // Declare run-time constructor selection table
87  // for constructors with dictionary and objectRegistry
89  (
90  autoPtr,
93  (
94  const dictionary& dict, const objectRegistry& obr
95  ),
96  (dict, obr)
97  );
98 
99 
100  // Declare run-time constructor selection table
101  // for constructors with dictionary
103  (
104  autoPtr,
106  dictionary,
107  (
108  const dictionary& dict
109  ),
110  (dict)
111  );
112 
113  // Constructors
114 
115  //- Construct and return a clone
116  virtual autoPtr<coordinateRotation> clone() const = 0;
117 
118 
119  // Selectors
120 
121  //- Select constructed from dictionary and objectRegistry
123  (
124  const dictionary& dict, const objectRegistry& obr
125  );
126 
127  //- Select constructed from dictionary
129  (
130  const dictionary& dict
131  );
132 
133 
134  //- Destructor
135  virtual ~coordinateRotation()
136  {}
137 
138 
139  // Member Functions
140 
141  //- Reset rotation to an identity rotation
142  virtual void clear() = 0;
143 
144  //- Update the rotation for a list of cells
145  virtual void updateCells
146  (
147  const polyMesh& mesh,
148  const labelList& cells
149  ) = 0;
150 
151  //- Return local-to-global transformation tensor
152  virtual const tensor& R() const = 0;
153 
154  //- Return global-to-local transformation tensor
155  virtual const tensor& Rtr() const = 0;
156 
157  //- Return local Cartesian x-axis
158  virtual const vector e1() const = 0;
159 
160  //- Return local Cartesian y-axis
161  virtual const vector e2() const = 0;
162 
163  //- Return local Cartesian z-axis
164  virtual const vector e3() const = 0;
165 
166  //- Return local-to-global transformation tensor
167  virtual const tensorField& Tr() const = 0;
168 
169  //- Return true if the rotation tensor is uniform
170  virtual bool uniform() const
171  {
172  return true;
173  }
174 
175  //- Transform vectorField using transformation tensor field
176  virtual tmp<vectorField> transform(const vectorField& st) const = 0;
177 
178  //- Transform vector using transformation tensor
179  virtual vector transform(const vector& st) const = 0;
180 
181  //- Inverse transform vectorField using transformation tensor field
182  virtual tmp<vectorField> invTransform(const vectorField& st) const = 0;
183 
184  //- Inverse transform vector using transformation tensor
185  virtual vector invTransform(const vector& st) const = 0;
186 
187  //- Transform tensor field using transformation tensorField
189  (
190  const tensorField& st
191  ) const = 0;
192 
193  //- Transform tensor sub-field using transformation tensorField
195  (
196  const tensorField& st,
197  const labelList& cellMap
198  ) const = 0;
199 
200  //- Transform tensor using transformation tensorField
201  virtual tensor transformTensor(const tensor& st) const = 0;
202 
203  //- Transform vectorField using transformation tensorField and return
204  // symmetrical tensorField
206  (
207  const vectorField& st
208  ) const = 0;
209 
210  //- Transform vector using transformation tensor and return
211  // symmetrical tensor
212  virtual symmTensor transformVector(const vector& st) const = 0;
213 
214 
215  // Write
216 
217  //- Write
218  virtual void write(Ostream&) const = 0;
219 
220 };
221 
222 
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 
225 } // End namespace Foam
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 #endif
230 
231 // ************************************************************************* //
Foam::Tensor
Templated 3D tensor derived from VectorSpace adding construction from 9 components,...
Definition: complexI.H:224
Foam::SymmTensor< scalar >
Foam::coordinateRotation::Rtr
virtual const tensor & Rtr() const =0
Return global-to-local transformation tensor.
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
objectRegistry.H
Foam::coordinateRotation::TypeName
TypeName("coordinateRotation")
Runtime type information.
Foam::coordinateRotation::e2
virtual const vector e2() const =0
Return local Cartesian y-axis.
polyMesh.H
Foam::coordinateRotation::transformTensor
virtual tmp< tensorField > transformTensor(const tensorField &st) const =0
Transform tensor field using transformation tensorField.
tensor.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::coordinateRotation::transformPrincipal
symmTensor transformPrincipal(const tensor &, const vector &) const
Transform principal.
Definition: coordinateRotation.C:43
Foam::coordinateRotation::transform
virtual tmp< vectorField > transform(const vectorField &st) const =0
Transform vectorField using transformation tensor field.
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:50
Foam::coordinateRotation::New
static autoPtr< coordinateRotation > New(const dictionary &dict, const objectRegistry &obr)
Select constructed from dictionary and objectRegistry.
Definition: coordinateRotationNew.C:32
Foam::coordinateRotation::e3
virtual const vector e3() const =0
Return local Cartesian z-axis.
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::coordinateRotation::updateCells
virtual void updateCells(const polyMesh &mesh, const labelList &cells)=0
Update the rotation for a list of cells.
Foam::coordinateRotation
Abstract base class for coordinate rotation.
Definition: coordinateRotation.H:68
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::coordinateRotation::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, coordinateRotation, objectRegistry,(const dictionary &dict, const objectRegistry &obr),(dict, obr))
tensorField.H
Foam::coordinateRotation::~coordinateRotation
virtual ~coordinateRotation()
Destructor.
Definition: coordinateRotation.H:134
Foam::coordinateRotation::clear
virtual void clear()=0
Reset rotation to an identity rotation.
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::coordinateRotation::e1
virtual const vector e1() const =0
Return local Cartesian x-axis.
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::Vector< scalar >
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::coordinateRotation::Tr
virtual const tensorField & Tr() const =0
Return local-to-global transformation tensor.
Foam::coordinateRotation::invTransform
virtual tmp< vectorField > invTransform(const vectorField &st) const =0
Inverse transform vectorField using transformation tensor field.
dictionary.H
vector.H
cells
const cellShapeList & cells
Definition: gmvOutputHeader.H:3
Foam::coordinateRotation::clone
virtual autoPtr< coordinateRotation > clone() const =0
Construct and return a clone.
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::coordinateRotation::uniform
virtual bool uniform() const
Return true if the rotation tensor is uniform.
Definition: coordinateRotation.H:169
Foam::coordinateRotation::write
virtual void write(Ostream &) const =0
Write.
Foam::coordinateRotation::transformVector
virtual tmp< symmTensorField > transformVector(const vectorField &st) const =0
Transform vectorField using transformation tensorField and return.
Foam::coordinateRotation::R
virtual const tensor & R() const =0
Return local-to-global transformation tensor.