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 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::coordSystem::indirect
28 
29 Description
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 
40 SourceFiles
41  indirectCS.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef Foam_indirectCS_H
46 #define Foam_indirectCS_H
47 
48 #include "coordinateSystem.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 namespace coordSystem
55 {
56 
57 /*---------------------------------------------------------------------------*\
58  Class coordSystem::indirect Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 class indirect
62 :
63  public coordinateSystem
64 {
65  // Private Data
66 
67  //- The real coordinate system
68  const coordinateSystem* backend_;
69 
70 
71 protected:
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  }
119 
120 public:
121 
122  //- Runtime type information
123  TypeName("indirect");
124 
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  // The readOrigin is unused.
142  indirect
143  (
144  const objectRegistry& obr,
145  const dictionary& dict,
147  );
148 
149  //- Return clone
150  virtual autoPtr<coordinateSystem> clone() const
151  {
153  }
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
217  {
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();
225  }
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()
241  {
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
300  {
301  return backend_->R(global);
302  }
303 };
304 
306 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
307 
308 } // End namespace coordSystem
309 } // End namespace Foam
310 
311 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
312 
313 #endif
315 // ************************************************************************* //
Base class for coordinate system specification, the default coordinate system type is cartesian ...
void operator=(const coordinateSystem &csys)=delete
No copy assignment.
virtual bool good() const
Is coordinate system good/valid?
Definition: indirectCS.H:204
User specification of a coordinate rotation.
dictionary dict
virtual bool uniform() const
True if the rotation tensor is uniform for all positions.
Definition: indirectCS.H:209
TypeName("indirect")
Runtime type information.
virtual const vector e1() const
The local Cartesian x-axis in global coordinates.
Definition: indirectCS.H:273
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual const point & origin() const
Return origin.
Definition: indirectCS.H:233
virtual const vector e2() const
The local Cartesian y-axis in global coordinates.
Definition: indirectCS.H:281
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 ~indirect()=default
Destructor.
indirect()=delete
Default construct is disallowed.
virtual void writeEntry(Ostream &os) const
Write &#39;coordinateSystem&#39; dictionary entry.
Definition: indirectCS.C:84
virtual const word & name() const
Return the name.
Definition: indirectCS.H:249
coordinateSystem()
Default construct. This is an identity coordinate system.
virtual const point & origin() const
Return origin.
virtual void write(Ostream &os) const
Write.
Definition: indirectCS.C:78
A class for handling words, derived from Foam::string.
Definition: word.H:63
virtual bool valid() const
Same as good() - 2023-07.
Definition: indirectCS.H:217
bool local
Definition: EEqn.H:20
virtual void clear()
Clear (ignored)
Definition: indirectCS.H:323
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:105
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
OBJstream os(runTime.globalPath()/outputName)
virtual const vector e3() const
The local Cartesian z-axis in global coordinates.
Definition: indirectCS.H:289
virtual const tensor & R() const
Return const reference to the rotation tensor.
Definition: indirectCS.H:265
virtual const coordinateRotation & rotation() const
The rotation specification.
Definition: indirectCS.H:241
void rename(const word &newName)
Rename (ignored)
Definition: indirectCS.H:300
virtual const coordinateSystem & cs() const
Reference to the underlying coordinate system.
Definition: indirectCS.H:225
static coordinateSystem dummy_
Dummy coordinate system for suppressed manipulation.
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
A List with indirect addressing. Like IndirectList but does not store addressing. ...
Definition: faMatrix.H:56
virtual const string & note() const
Return the optional note.
Definition: indirectCS.H:257
A coordinate system forward to a global coordinate system that is normally provided by the constant/c...
Definition: indirectCS.H:71
Nothing to be read.
virtual autoPtr< coordinateSystem > clone() const
Return clone.
Definition: indirectCS.H:185
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
Registry of regIOobjects.
virtual const string & note() const
Return the optional note.
Tensor of scalars, i.e. Tensor<scalar>.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:686
Namespace for OpenFOAM.
readOption
Enumeration defining read preferences.