Loading...
Searching...
No Matches
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-2024 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 Foam_indirectCS_H
46#define Foam_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
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);
118
119
120public:
121
122 //- Runtime type information
123 TypeName("indirect");
124
125
126 // Constructors
127
128 //- Default construct is disallowed
129 indirect() = delete;
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 // The readOrigin is unused.
143 (
144 const objectRegistry& obr,
147 );
148
149 //- Return clone
150 virtual autoPtr<coordinateSystem> clone() const
151 {
152 return coordinateSystem::Clone(*this);
154
155
156 //- Destructor
157 virtual ~indirect() = default;
158
159
160 // Member Functions
161
162 // Characteristics
163
164 //- Is coordinate system good/valid?
165 virtual bool good() const { return backend_ && backend_->good(); }
166
167 //- True if the rotation tensor is uniform for all positions
168 virtual bool uniform() const
169 {
170 return !backend_ || backend_->uniform();
171 }
172
173 //- Same as good() - 2023-07
174 virtual bool valid() const { return this->good(); }
175
176
177 // Access
178
179 //- Reference to the underlying coordinate system
180 virtual const coordinateSystem& cs() const
181 {
182 return *backend_;
183 }
184
185 //- Return origin
186 virtual const point& origin() const
187 {
188 return backend_->origin();
189 }
190
191 //- The rotation specification
192 virtual const coordinateRotation& rotation() const
193 {
194 return backend_->rotation();
195 }
196
197 //- Return the name
198 virtual const word& name() const
199 {
200 return backend_->name_;
201 }
202
203 //- Return the optional note
204 virtual const string& note() const
205 {
206 return backend_->note();
207 }
208
209 //- Return const reference to the rotation tensor
210 virtual const tensor& R() const
211 {
212 return backend_->R();
213 }
214
215 //- The local Cartesian x-axis in global coordinates
216 virtual const vector e1() const
218 return backend_->e1();
219 }
220
221 //- The local Cartesian y-axis in global coordinates
222 virtual const vector e2() const
223 {
224 return backend_->e2();
226
227 //- The local Cartesian z-axis in global coordinates
228 virtual const vector e3() const
229 {
230 return backend_->e3();
231 }
232
234 // Edit
235
236 //- Rename (ignored)
237 void rename(const word& newName) {}
238
239 //- Provide non-constant access to the optional note
240 string& note()
243 return dummy_.note();
244 }
245
246 //- Edit access to origin (disallowed)
247 virtual point& origin()
248 {
250 return dummy_.origin();
251 }
252
253 //- Clear (ignored)
254 virtual void clear() {}
255
256 //- Change the rotation (disallowed)
258 {
260 }
261
262
263 // Write
264
265 //- Write
266 virtual void write(Ostream& os) const;
267
268 //- Write 'coordinateSystem' dictionary entry
269 virtual void writeEntry(Ostream& os) const;
270
271 //- Write dictionary entry
272 virtual void writeEntry(const word& keyword, Ostream& os) const;
274
275 // Member Operators
276
277 //- No copy assignment
278 void operator=(const coordinateSystem& csys) = delete;
279
280 //- No move assignment
281 void operator=(coordinateSystem&& csys) = delete;
282
283
284 // Rotations
285
286 //- Position-dependent rotation tensor at a single point
287 virtual tensor R(const 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 UList<point>& global) const
294 {
295 return backend_->R(global);
296 }
297
298 //- Position-dependent rotation tensors at multiple points
299 virtual tmp<tensorField> R(const pointUIndList& global) const
301 return backend_->R(global);
302 }
303};
304
306// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
307
308} // End namespace coordSystem
309} // End namespace Foam
310
311// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
312
313#endif
315// ************************************************************************* //
readOption
Enumeration defining read preferences.
@ NO_READ
Nothing to be read.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
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:89
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A coordinate system forward to a global coordinate system that is normally provided by the constant/c...
Definition indirectCS.H:74
string & note()
Provide non-constant access to the optional note.
Definition indirectCS.H:305
virtual const word & name() const
Return the name.
Definition indirectCS.H:249
virtual bool uniform() const
True if the rotation tensor is uniform for all positions.
Definition indirectCS.H:209
virtual const coordinateRotation & rotation() const
The rotation specification.
Definition indirectCS.H:241
indirect()=delete
Default construct is disallowed.
virtual const vector e2() const
The local Cartesian y-axis in global coordinates.
Definition indirectCS.H:281
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:370
virtual bool valid() const
Same as good() - 2023-07.
Definition indirectCS.H:217
virtual tmp< vectorField > localToGlobal(const vectorField &local, bool translate) const
Convert from local coordinate system to the global Cartesian system with optional translation for the...
Definition indirectCS.H:105
virtual const coordinateSystem & cs() const
Reference to the underlying coordinate system.
Definition indirectCS.H:225
virtual ~indirect()=default
Destructor.
virtual tmp< vectorField > globalToLocal(const vectorField &global, bool translate) const
Convert from global Cartesian system to the local coordinate system with optional translation for the...
Definition indirectCS.H:131
virtual const point & origin() const
Return origin.
Definition indirectCS.H:233
virtual tmp< tensorField > R(const pointUIndList &global) const
Position-dependent rotation tensors at multiple points.
Definition indirectCS.H:386
virtual void rotation(autoPtr< coordinateRotation > &&crot)
Change the rotation (disallowed).
Definition indirectCS.H:328
virtual bool good() const
Is coordinate system good/valid?
Definition indirectCS.H:204
virtual const string & note() const
Return the optional note.
Definition indirectCS.H:257
virtual vector globalToLocal(const vector &global, bool translate) const
Convert from global Cartesian system to the local coordinate system with optional translation for the...
Definition indirectCS.H:118
virtual const tensor & R() const
Return const reference to the rotation tensor.
Definition indirectCS.H:265
virtual point & origin()
Edit access to origin (disallowed).
Definition indirectCS.H:314
virtual void clear()
Clear (ignored).
Definition indirectCS.H:323
virtual void writeEntry(Ostream &os) const
Write 'coordinateSystem' dictionary entry.
Definition indirectCS.C:84
virtual const vector e1() const
The local Cartesian x-axis in global coordinates.
Definition indirectCS.H:273
virtual const vector e3() const
The local Cartesian z-axis in global coordinates.
Definition indirectCS.H:289
void operator=(const coordinateSystem &csys)=delete
No copy assignment.
virtual autoPtr< coordinateSystem > clone() const
Return clone.
Definition indirectCS.H:185
virtual vector localToGlobal(const vector &local, bool translate) const
Convert from local coordinate system to the global Cartesian system with optional translation for the...
Definition indirectCS.H:92
virtual tmp< tensorField > R(const UList< point > &global) const
Position-dependent rotation tensors at multiple points.
Definition indirectCS.H:378
void rename(const word &newName)
Rename (ignored).
Definition indirectCS.H:300
TypeName("indirect")
Runtime type information.
User specification of a coordinate rotation.
static autoPtr< coordinateSystem > Clone(const Derived &csys)
Clone a coordinate system.
coordinateSystem(std::nullptr_t)
Construct null, without allocating a coordinateRotation specification.
static coordinateSystem dummy_
Dummy coordinate system for suppressed manipulation.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Registry of regIOobjects.
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
bool local
Definition EEqn.H:20
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition error.H:688
OBJstream os(runTime.globalPath()/outputName)
Namespace for coordinate systems.
Definition cartesianCS.C:30
Namespace for OpenFOAM.
UIndirectList< point > pointUIndList
UIndirectList of point.
Tensor< scalar > tensor
Definition symmTensor.H:57
Field< vector > vectorField
Specialisation of Field<T> for vector.
vector point
Point is a vector.
Definition point.H:37
Vector< scalar > vector
Definition vector.H:57
runTime write()
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68