indirectCS.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) 2018-2022 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::coordSystem::indirect
28
29Description
30 A coordinate system forward to a global coordinate system that is
31 normally provided by the constant/coordinateSystems file.
32
33 \heading Dictionary entries
34 \table
35 Property | Description | Required | Default
36 type | Type name: indirect | yes |
37 name | Name of the referenced system | yes |
38 \endtable
39
40SourceFiles
41 indirectCS.C
42
43\*---------------------------------------------------------------------------*/
44
45#ifndef indirectCS_H
46#define indirectCS_H
47
48#include "coordinateSystem.H"
49
50// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51
52namespace Foam
53{
54namespace coordSystem
55{
56
57/*---------------------------------------------------------------------------*\
58 Class coordSystem::indirect Declaration
59\*---------------------------------------------------------------------------*/
60
61class indirect
62:
63 public coordinateSystem
64{
65 // Private Data
66
67 //- The real coordinate system
68 const coordinateSystem* backend_;
69
70
71protected:
72
73 // Protected Member Functions
74
75 //- Convert from local coordinate system to the global Cartesian system
76 //- with optional translation for the origin
77 virtual vector localToGlobal
78 (
79 const vector& local,
80 bool translate
81 ) const
82 {
83 return backend_->localToGlobal(local, translate);
84 }
85
86 //- Convert from local coordinate system to the global Cartesian system
87 //- with optional translation for the origin
89 (
90 const vectorField& local,
91 bool translate
92 ) const
93 {
94 return backend_->localToGlobal(local, translate);
95 }
96
97 //- Convert from global Cartesian system to the local coordinate system
98 //- with optional translation for the origin
99 virtual vector globalToLocal
100 (
101 const vector& global,
102 bool translate
103 ) const
104 {
105 return backend_->globalToLocal(global, translate);
106 }
107
108 //- Convert from global Cartesian system to the local coordinate system
109 //- with optional translation for the origin
111 (
112 const vectorField& global,
113 bool translate
114 ) const
115 {
116 return backend_->globalToLocal(global, translate);
117 }
118
119
120public:
121
122 //- Runtime type information
123 TypeName("indirect");
125
126 // Constructors
127
128 //- Default construct is disallowed
129 indirect() = delete;
130
131 //- Copy construct
132 indirect(const indirect& csys);
133
134 //- Move construct
135 indirect(indirect&& csys);
136
137 //- Construct from global lookup
138 indirect(const objectRegistry& obr, const word& name);
139
140 //- Construct from global lookup
141 indirect(const objectRegistry& obr, const dictionary& dict);
142
143 //- Return clone
144 virtual autoPtr<coordinateSystem> clone() const
145 {
147 }
148
149
150 //- Destructor
151 virtual ~indirect() = default;
152
153
154 // Member Functions
155
156 // Characteristics
157
158 //- Is coordinate system valid?
159 virtual bool valid() const
160 {
161 return backend_ && backend_->valid();
162 }
163
164 //- True if the rotation tensor is uniform for all positions
165 virtual bool uniform() const
166 {
167 return backend_->uniform();
168 }
169
170
171 // Access
172
173 //- Reference to the underlying coordinate system
174 virtual const coordinateSystem& cs() const
175 {
176 return *backend_;
177 }
178
179 //- Return origin
180 virtual const point& origin() const
181 {
182 return backend_->origin();
183 }
184
185 //- The rotation specification
186 virtual const coordinateRotation& rotation() const
187 {
188 return backend_->rotation();
189 }
190
191 //- Return the name
192 virtual const word& name() const
193 {
194 return backend_->name_;
195 }
196
197 //- Return the optional note
198 virtual const string& note() const
199 {
200 return backend_->note();
201 }
202
203 //- Return const reference to the rotation tensor
204 virtual const tensor& R() const
205 {
206 return backend_->R();
207 }
208
209 //- The local Cartesian x-axis in global coordinates
210 virtual const vector e1() const
211 {
212 return backend_->e1();
213 }
214
215 //- The local Cartesian y-axis in global coordinates
216 virtual const vector e2() const
217 {
218 return backend_->e2();
219 }
220
221 //- The local Cartesian z-axis in global coordinates
222 virtual const vector e3() const
223 {
224 return backend_->e3();
225 }
226
227
228 // Edit
229
230 //- Rename (ignored)
231 void rename(const word& newName) {}
232
233 //- Provide non-constant access to the optional note
234 string& note()
235 {
237 return dummy_.note();
238 }
239
240 //- Edit access to origin (disallowed)
241 virtual point& origin()
242 {
244 return dummy_.origin();
246
247 //- Clear (ignored)
248 virtual void clear() {}
249
250 //- Change the rotation (disallowed)
251 virtual void rotation(autoPtr<coordinateRotation>&& crot)
252 {
254 }
256
257 // Write
258
259 //- Write
260 virtual void write(Ostream& os) const;
261
262 //- Write 'coordinateSystem' dictionary entry
263 virtual void writeEntry(Ostream& os) const;
264
265 //- Write dictionary entry
266 virtual void writeEntry(const word& keyword, Ostream& os) const;
267
268
269 // Member Operators
270
271 //- No copy assignment
272 void operator=(const coordinateSystem& csys) = delete;
273
274 //- No move assignment
275 void operator=(coordinateSystem&& csys) = delete;
276
277
278 // Rotations
279
280 //- Position-dependent rotation tensor at a single point
281 virtual tensor R(const point& global) const
282 {
283 return backend_->R(global);
284 }
285
286 //- Position-dependent rotation tensors at multiple points
287 virtual tmp<tensorField> R(const UList<point>& global) const
288 {
289 return backend_->R(global);
290 }
291
292 //- Position-dependent rotation tensors at multiple points
293 virtual tmp<tensorField> R(const pointUIndList& global) const
294 {
295 return backend_->R(global);
296 }
297};
298
299
300// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
302} // End namespace coordSystem
303} // End namespace Foam
304
305// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
306
307#endif
308
309// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A List with indirect addressing. Like IndirectList but does not store addressing.
Definition: IndirectList.H:79
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: UList.H:94
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A coordinate system forward to a global coordinate system that is normally provided by the constant/c...
Definition: indirectCS.H:78
string & note()
Provide non-constant access to the optional note.
Definition: indirectCS.H:248
virtual const word & name() const
Return the name.
Definition: indirectCS.H:206
virtual bool uniform() const
True if the rotation tensor is uniform for all positions.
Definition: indirectCS.H:179
virtual const coordinateRotation & rotation() const
The rotation specification.
Definition: indirectCS.H:200
indirect()=delete
Default construct is disallowed.
virtual const vector e2() const
The local Cartesian y-axis in global coordinates.
Definition: indirectCS.H:230
void operator=(coordinateSystem &&csys)=delete
No move assignment.
virtual tensor R(const point &global) const
Position-dependent rotation tensor at a single point.
Definition: indirectCS.H:295
virtual bool valid() const
Is coordinate system valid?
Definition: indirectCS.H:173
virtual tmp< vectorField > localToGlobal(const vectorField &local, bool translate) const
Definition: indirectCS.H:103
virtual const coordinateSystem & cs() const
Reference to the underlying coordinate system.
Definition: indirectCS.H:188
virtual ~indirect()=default
Destructor.
virtual tmp< vectorField > globalToLocal(const vectorField &global, bool translate) const
Definition: indirectCS.H:125
virtual const point & origin() const
Return origin.
Definition: indirectCS.H:194
virtual tmp< tensorField > R(const pointUIndList &global) const
Position-dependent rotation tensors at multiple points.
Definition: indirectCS.H:307
virtual void rotation(autoPtr< coordinateRotation > &&crot)
Change the rotation (disallowed)
Definition: indirectCS.H:265
virtual const string & note() const
Return the optional note.
Definition: indirectCS.H:212
virtual vector globalToLocal(const vector &global, bool translate) const
Definition: indirectCS.H:114
virtual const tensor & R() const
Return const reference to the rotation tensor.
Definition: indirectCS.H:218
virtual point & origin()
Edit access to origin (disallowed)
Definition: indirectCS.H:255
virtual void clear()
Clear (ignored)
Definition: indirectCS.H:262
virtual void writeEntry(Ostream &os) const
Write 'coordinateSystem' dictionary entry.
Definition: indirectCS.C:90
virtual const vector e1() const
The local Cartesian x-axis in global coordinates.
Definition: indirectCS.H:224
virtual const vector e3() const
The local Cartesian z-axis in global coordinates.
Definition: indirectCS.H:236
void operator=(const coordinateSystem &csys)=delete
No copy assignment.
virtual autoPtr< coordinateSystem > clone() const
Return clone.
Definition: indirectCS.H:158
virtual vector localToGlobal(const vector &local, bool translate) const
Definition: indirectCS.H:92
virtual tmp< tensorField > R(const UList< point > &global) const
Position-dependent rotation tensors at multiple points.
Definition: indirectCS.H:301
void rename(const word &newName)
Rename (ignored)
Definition: indirectCS.H:245
TypeName("indirect")
Runtime type information.
User specification of a coordinate rotation.
Base class for coordinate system specification, the default coordinate system type is cartesian .
virtual bool uniform() const
True if the rotation tensor is uniform for all locations.
virtual const coordinateRotation & rotation() const
The rotation specification.
virtual const vector e2() const
The local Cartesian y-axis in global coordinates.
virtual bool valid() const
Consider valid if it has a specification.
virtual vector globalToLocal(const vector &global, bool translate) const
virtual vector localToGlobal(const vector &local, bool translate) const
word name_
The name of the coordinate system (optional)
static coordinateSystem dummy_
Dummy coordinate system for suppressed manipulation.
virtual const point & origin() const
Return origin.
virtual const string & note() const
Return the optional note.
virtual const tensor & R() const
Return const reference to the rotation tensor.
coordinateSystem()
Default construct. This is an identity coordinate system.
virtual const vector e1() const
The local Cartesian x-axis in global coordinates.
virtual const vector e3() const
The local Cartesian z-axis in global coordinates.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Registry of regIOobjects.
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
runTime write()
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73