cylindricalCS.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2014 OpenFOAM Foundation
9  Copyright (C) 2018-2022 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::coordSystem::cylindrical
29 
30 Description
31  A cylindrical coordinate system (r-theta-z).
32  The coordinate system angle theta is always in radians.
33 
34  \heading Dictionary entries
35  \table
36  Property | Description | Required | Default
37  type | type name: cylindrical | yes |
38  \endtable
39 
40 SourceFiles
41  cylindricalCS.C
42  cylindricalCSTransform.C
43 
44 \*---------------------------------------------------------------------------*/
45 
46 #ifndef Foam_cylindricalCS_H
47 #define Foam_cylindricalCS_H
48 
49 #include "coordinateSystem.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 namespace coordSystem
56 {
57 
58 /*---------------------------------------------------------------------------*\
59  Class coordSystem::cylindrical Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 class cylindrical
63 :
64  public coordinateSystem
65 {
66 protected:
67 
68  // Protected Member Functions
69 
70  //- From local coordinate system to the global Cartesian system
71  //- with optional translation for the origin
72  virtual vector localToGlobal
73  (
74  const vector& local,
75  bool translate
76  ) const;
77 
78  //- From local coordinate system to the global Cartesian system
79  //- with optional translation for the origin
81  (
82  const vectorField& local,
83  bool translate
84  ) const;
85 
86  //- From global Cartesian system to the local coordinate system
87  //- with optional translation for the origin
88  virtual vector globalToLocal
89  (
90  const vector& global,
91  bool translate
92  ) const;
93 
94  //- Convert from global Cartesian system to the local coordinate system
95  //- with optional translation for the origin
97  (
98  const vectorField& global,
99  bool translate
100  ) const;
101 
102 
103 public:
104 
105  //- Runtime type information
106  TypeNameNoDebug("cylindrical");
107 
108 
109  // Static Members
110 
111  //- Global (identity) cylindrical coordinate system
112  static const cylindrical null;
113 
114 
115  // Constructors
116 
117  //- Default construct. Identity coordinate system.
118  cylindrical() = default;
119 
120  //- Copy construct
121  cylindrical(const cylindrical& csys) = default;
122 
123  //- Move construct
124  cylindrical(cylindrical&& csys) = default;
125 
126  //- Copy construct from another coordinateSystem type
127  explicit cylindrical(const coordinateSystem& csys);
128 
129  //- Move construct from another coordinateSystem type
130  explicit cylindrical(coordinateSystem&& csys);
131 
132  //- Move construct from autoPtr of another coordinateSystem type
133  explicit cylindrical(autoPtr<coordinateSystem>&& csys);
134 
135  //- Copy construct from rotation with origin=0
136  explicit cylindrical(const coordinateRotation& crot);
137 
138  //- Construct from origin and rotation
139  cylindrical(const point& origin, const coordinateRotation& crot);
140 
141  //- Construct from origin and single axis
142  cylindrical(const point& origin, const vector& axis);
143 
144  //- Construct named from origin and single axis
145  cylindrical(const word& name, const point& origin, const vector& axis);
146 
147  //- Construct from origin and two axes
149  (
150  const point& origin,
151  const vector& axis,
152  const vector& dirn
153  );
154 
155  //- Construct named from origin and two axes
157  (
158  const word& name,
159  const point& origin,
160  const vector& axis,
161  const vector& dirn
162  );
163 
164  //- Construct from dictionary with optional
165  //- read handling for the 'origin' entry (default: MUST_READ).
166  //
167  // \note The readOrigin is downgraded to READ_IF_PRESENT
168  // if the dictionary itself is "coordinateSystem"
169  explicit cylindrical
170  (
171  const dictionary& dict,
173  );
174 
175  //- Construct from dictionary with optional subDict lookup and optional
176  //- read handling for the 'origin' entry (default: MUST_READ).
177  //
178  // \param dictName If non-empty, mandatory sub-dictionary to use.
179  //
180  // \note The readOrigin is downgraded to READ_IF_PRESENT
181  // if the dictionary itself is "coordinateSystem"
182  // or if a sub-dictionary is being used
184  (
185  const dictionary& dict,
186  const word& dictName,
188  );
189 
190 
191  //- Return clone
192  virtual autoPtr<coordinateSystem> clone() const
193  {
195  }
196 
197 
198  //- Destructor
199  virtual ~cylindrical() = default;
200 
201 
202  // Member Functions
203 
204  //- Treat the rotation tensor as non-uniform
205  virtual bool uniform() const
206  {
207  return false;
208  }
209 
210 
211  // Rotations
212 
213  //- Position-dependent rotation tensors at multiple points
214  using coordinateSystem::R;
215 
216  //- Position-dependent rotation tensor at a single point
217  //- \return tensor
218  virtual tensor R(const point& global) const;
219 
220 
221  // Member Operators
222 
223  //- Copy assignment
224  cylindrical& operator=(const cylindrical&) = default;
225 
226  //- Move assignment
227  cylindrical& operator=(cylindrical&&) = default;
228 };
229 
230 
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 
233 } // End namespace coordSystem
234 
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 
237 //- Compatibility typedef 1806
238 typedef coordSystem::cylindrical cylindricalCS;
239 
240 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 } // End namespace Foam
243 
244 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245 
246 #endif
247 
248 // ************************************************************************* //
Base class for coordinate system specification, the default coordinate system type is cartesian ...
virtual autoPtr< coordinateSystem > clone() const
Return clone.
User specification of a coordinate rotation.
dictionary dict
static const cylindrical null
Global (identity) cylindrical coordinate system.
A cylindrical coordinate system (r-theta-z). The coordinate system angle theta is always in radians...
Definition: cylindricalCS.H:67
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
const word dictName("faMeshDefinition")
TypeNameNoDebug("cylindrical")
Runtime type information.
cylindrical()=default
Default construct. Identity coordinate system.
virtual const point & origin() const
Return origin.
virtual const tensor & R() const
Return const reference to the rotation tensor.
virtual vector globalToLocal(const vector &global, bool translate) const
From global Cartesian system to the local coordinate system with optional translation for the origin...
virtual ~cylindrical()=default
Destructor.
A class for handling words, derived from Foam::string.
Definition: word.H:63
bool local
Definition: EEqn.H:20
virtual vector localToGlobal(const vector &local, bool translate) const
From local coordinate system to the global Cartesian system with optional translation for the origin...
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
cylindrical & operator=(const cylindrical &)=default
Copy assignment.
virtual bool uniform() const
Treat the rotation tensor as non-uniform.
virtual const word & name() const
Return the name.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Tensor of scalars, i.e. Tensor<scalar>.
coordSystem::cylindrical cylindricalCS
Compatibility typedef 1806.
Namespace for OpenFOAM.
readOption
Enumeration defining read preferences.