coordinateRotation.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 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  -# axesRotation
41  -# STARCDRotation
42  -# cylindrical
43  -# EulerCoordinateRotation
44 
45 SourceFiles
46  coordinateRotation.C
47  coordinateRotationNew.C
48 
49 \*---------------------------------------------------------------------------*/
50 
51 #ifndef coordinateRotation_H
52 #define coordinateRotation_H
53 
54 #include "vector.H"
55 #include "tensor.H"
56 #include "tensorField.H"
57 #include "dictionary.H"
58 #include "runTimeSelectionTables.H"
59 #include "objectRegistry.H"
60 #include "polyMesh.H"
61 
62 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
63 
64 namespace Foam
65 {
66 
67 /*---------------------------------------------------------------------------*\
68  Class coordinateRotation Declaration
69 \*---------------------------------------------------------------------------*/
70 
72 {
73 protected:
74 
75  // Protected member functions
76 
77  //- Transform principal
78  symmTensor transformPrincipal(const tensor&, const vector&) const;
79 
80 
81 public:
82 
83 
84  //- Runtime type information
85  TypeName("coordinateRotation");
86 
87 
88  // Declare run-time constructor selection table
89  // for constructors with dictionary and objectRegistry
91  (
92  autoPtr,
95  (
96  const dictionary& dict, const objectRegistry& obr
97  ),
98  (dict, obr)
99  );
100 
101 
102  // Declare run-time constructor selection table
103  // for constructors with dictionary
105  (
106  autoPtr,
108  dictionary,
109  (
110  const dictionary& dict
111  ),
112  (dict)
113  );
114 
115 
116  // Selectors
117 
118  //- Select constructed from dictionary and objectRegistry
120  (
121  const dictionary& dict, const objectRegistry& obr
122  );
123 
124  //- Select constructed from dictionary
126  (
127  const dictionary& dict
128  );
129 
130 
131  //- Destructor
132  virtual ~coordinateRotation()
133  {}
134 
135 
136  // Member Functions
137 
138  //- Reset rotation to an identity rotation
139  virtual void clear() = 0;
140 
141  //- Update the rotation for a list of cells
142  virtual void updateCells
143  (
144  const polyMesh& mesh,
145  const labelList& cells
146  ) = 0;
147 
148  //- Return local-to-global transformation tensor
149  virtual const tensor& R() const = 0;
150 
151  //- Return global-to-local transformation tensor
152  virtual const tensor& Rtr() const = 0;
153 
154  //- Return local Cartesian x-axis
155  virtual const vector e1() const = 0;
156 
157  //- Return local Cartesian y-axis
158  virtual const vector e2() const = 0;
159 
160  //- Return local Cartesian z-axis
161  virtual const vector e3() const = 0;
162 
163  //- Return local-to-global transformation tensor
164  virtual const tensorField& Tr() const = 0;
165 
166  //- Return true if the rotation tensor is uniform
167  virtual bool uniform() const
168  {
169  return true;
170  }
171 
172  //- Transform vectorField using transformation tensor field
173  virtual tmp<vectorField> transform(const vectorField& st) const = 0;
174 
175  //- Transform vector using transformation tensor
176  virtual vector transform(const vector& st) const = 0;
177 
178  //- Inverse transform vectorField using transformation tensor field
179  virtual tmp<vectorField> invTransform(const vectorField& st) const = 0;
180 
181  //- Inverse transform vector using transformation tensor
182  virtual vector invTransform(const vector& st) const = 0;
183 
184  //- Transform tensor field using transformation tensorField
186  (
187  const tensorField& st
188  ) const = 0;
189 
190  //- Transform tensor sub-field using transformation tensorField
192  (
193  const tensorField& st,
194  const labelList& cellMap
195  ) const = 0;
196 
197  //- Transform tensor using transformation tensorField
198  virtual tensor transformTensor(const tensor& st) const = 0;
199 
200  //- Transform vectorField using transformation tensorField and return
201  // symmetrical tensorField
203  (
204  const vectorField& st
205  ) const = 0;
206 
207  //- Transform vector using transformation tensor and return
208  // symmetrical tensor
209  virtual symmTensor transformVector(const vector& st) const = 0;
210 
211 
212  // Write
213 
214  //- Write
215  virtual void write(Ostream&) const = 0;
216 
217 };
218 
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 } // End namespace Foam
223 
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 
226 #endif
227 
228 // ************************************************************************* //
virtual tmp< vectorField > invTransform(const vectorField &st) const =0
Inverse transform vectorField using transformation tensor field.
Abstract base class for coordinate rotation.
dictionary dict
symmTensor transformPrincipal(const tensor &, const vector &) const
Transform principal.
declareRunTimeSelectionTable(autoPtr, coordinateRotation, objectRegistry,(const dictionary &dict, const objectRegistry &obr),(dict, obr))
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual const tensorField & Tr() const =0
Return local-to-global transformation tensor.
virtual ~coordinateRotation()
Destructor.
virtual const vector e1() const =0
Return local Cartesian x-axis.
virtual const tensor & Rtr() const =0
Return global-to-local transformation tensor.
virtual bool uniform() const
Return true if the rotation tensor is uniform.
dynamicFvMesh & mesh
const cellShapeList & cells
virtual tmp< symmTensorField > transformVector(const vectorField &st) const =0
Transform vectorField using transformation tensorField and return.
virtual void updateCells(const polyMesh &mesh, const labelList &cells)=0
Update the rotation for a list of cells.
virtual const vector e2() const =0
Return local Cartesian y-axis.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
TypeName("coordinateRotation")
Runtime type information.
virtual void write(Ostream &) const =0
Write.
virtual const tensor & R() const =0
Return local-to-global transformation tensor.
virtual tmp< tensorField > transformTensor(const tensorField &st) const =0
Transform tensor field using transformation tensorField.
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.
virtual const vector e3() const =0
Return local Cartesian z-axis.
virtual void clear()=0
Reset rotation to an identity rotation.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Macros to ease declaration of run-time selection tables.
A class for managing temporary objects.
Definition: PtrList.H:53
Registry of regIOobjects.
Namespace for OpenFOAM.