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 
114  // Selectors
115 
116  //- Select constructed from dictionary and objectRegistry
118  (
119  const dictionary& dict, const objectRegistry& obr
120  );
121 
122  //- Select constructed from dictionary
124  (
125  const dictionary& dict
126  );
127 
128 
129  //- Destructor
130  virtual ~coordinateRotation()
131  {}
132 
133 
134  // Member Functions
135 
136  //- Reset rotation to an identity rotation
137  virtual void clear() = 0;
138 
139  //- Update the rotation for a list of cells
140  virtual void updateCells
141  (
142  const polyMesh& mesh,
143  const labelList& cells
144  ) = 0;
145 
146  //- Return local-to-global transformation tensor
147  virtual const tensor& R() const = 0;
148 
149  //- Return global-to-local transformation tensor
150  virtual const tensor& Rtr() const = 0;
151 
152  //- Return local Cartesian x-axis
153  virtual const vector e1() const = 0;
154 
155  //- Return local Cartesian y-axis
156  virtual const vector e2() const = 0;
157 
158  //- Return local Cartesian z-axis
159  virtual const vector e3() const = 0;
160 
161  //- Return local-to-global transformation tensor
162  virtual const tensorField& Tr() const = 0;
163 
164  //- Return true if the rotation tensor is uniform
165  virtual bool uniform() const
166  {
167  return true;
168  }
169 
170  //- Transform vectorField using transformation tensor field
171  virtual tmp<vectorField> transform(const vectorField& st) const = 0;
172 
173  //- Transform vector using transformation tensor
174  virtual vector transform(const vector& st) const = 0;
175 
176  //- Inverse transform vectorField using transformation tensor field
177  virtual tmp<vectorField> invTransform(const vectorField& st) const = 0;
178 
179  //- Inverse transform vector using transformation tensor
180  virtual vector invTransform(const vector& st) const = 0;
181 
182  //- Transform tensor field using transformation tensorField
184  (
185  const tensorField& st
186  ) const = 0;
187 
188  //- Transform tensor sub-field using transformation tensorField
190  (
191  const tensorField& st,
192  const labelList& cellMap
193  ) const = 0;
194 
195  //- Transform tensor using transformation tensorField
196  virtual tensor transformTensor(const tensor& st) const = 0;
197 
198  //- Transform vectorField using transformation tensorField and return
199  // symmetrical tensorField
201  (
202  const vectorField& st
203  ) const = 0;
204 
205  //- Transform vector using transformation tensor and return
206  // symmetrical tensor
207  virtual symmTensor transformVector(const vector& st) const = 0;
208 
209 
210  // Write
211 
212  //- Write
213  virtual void write(Ostream&) const = 0;
214 
215 };
216 
217 
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 } // End namespace Foam
221 
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 
224 #endif
225 
226 // ************************************************************************* //
virtual const tensor & R() const =0
Return local-to-global transformation tensor.
virtual const vector e3() const =0
Return local Cartesian z-axis.
Templated 3D symmetric tensor derived from VectorSpace adding construction from 6 components...
Definition: SymmTensor.H:53
virtual const vector e2() const =0
Return local Cartesian y-axis.
Macros to ease declaration of run-time selection tables.
virtual void write(Ostream &) const =0
Write.
dynamicFvMesh & mesh
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual tmp< tensorField > transformTensor(const tensorField &st) const =0
Transform tensor field using transformation tensorField.
Namespace for OpenFOAM.
virtual tmp< symmTensorField > transformVector(const vectorField &st) const =0
Transform vectorField using transformation tensorField and return.
virtual const tensorField & Tr() const =0
Return local-to-global transformation tensor.
TypeName("coordinateRotation")
Runtime type information.
dictionary dict
virtual void clear()=0
Reset rotation to an identity rotation.
Abstract base class for coordinate rotation.
virtual const vector e1() const =0
Return local Cartesian x-axis.
virtual const tensor & Rtr() const =0
Return global-to-local transformation tensor.
const cellShapeList & cells
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
symmTensor transformPrincipal(const tensor &, const vector &) const
Transform principal.
virtual ~coordinateRotation()
Destructor.
Registry of regIOobjects.
virtual void updateCells(const polyMesh &mesh, const labelList &cells)=0
Update the rotation for a list of cells.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual bool uniform() const
Return true if the rotation tensor is uniform.
static autoPtr< coordinateRotation > New(const dictionary &dict, const objectRegistry &obr)
Select constructed from dictionary and objectRegistry.
virtual tmp< vectorField > transform(const vectorField &st) const =0
Transform vectorField using transformation tensor field.
declareRunTimeSelectionTable(autoPtr, coordinateRotation, objectRegistry,( const dictionary &dict, const objectRegistry &obr ),(dict, obr))
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
A class for managing temporary objects.
Definition: PtrList.H:118
virtual tmp< vectorField > invTransform(const vectorField &st) const =0
Inverse transform vectorField using transformation tensor field.