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 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 indirectCS_H
46 #define 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  // Private Member Functions
72 
73  //- Construct null is disallowed
74  indirect() = delete;
75 
76 
77 protected:
78 
79  // Protected Member Functions
80 
81  //- Convert from local coordinate system to the global Cartesian system
82  //- with optional translation for the origin
83  virtual vector localToGlobal
84  (
85  const vector& local,
86  bool translate
87  ) const
88  {
89  return backend_->localToGlobal(local, translate);
90  }
91 
92  //- Convert from local coordinate system to the global Cartesian system
93  //- with optional translation for the origin
95  (
96  const vectorField& local,
97  bool translate
98  ) const
99  {
100  return backend_->localToGlobal(local, translate);
101  }
102 
103  //- Convert from global Cartesian system to the local coordinate system
104  //- with optional translation for the origin
105  virtual vector globalToLocal
106  (
107  const vector& global,
108  bool translate
109  ) const
110  {
111  return backend_->globalToLocal(global, translate);
112  }
113 
114  //- Convert from global Cartesian system to the local coordinate system
115  //- with optional translation for the origin
117  (
118  const vectorField& global,
119  bool translate
120  ) const
121  {
122  return backend_->globalToLocal(global, translate);
123  }
124 
125 
126 public:
127 
128  //- Runtime type information
129  TypeName("indirect");
130 
131 
132  // Constructors
133 
134  //- Copy construct
135  indirect(const indirect& csys);
136 
137  //- Move construct
138  indirect(indirect&& csys);
139 
140  //- Construct from global lookup
141  indirect(const objectRegistry& obr, const word& name);
142 
143  //- Construct from global lookup
144  indirect(const objectRegistry& obr, const dictionary& dict);
145 
146  //- Return clone
147  virtual autoPtr<coordinateSystem> clone() const
148  {
150  }
151 
152 
153  //- Destructor
154  virtual ~indirect() = default;
155 
156 
157  // Member Functions
158 
159  // Access
160 
161  //- Reference to the underlying coordinate system
162  virtual const coordinateSystem& cs() const
163  {
164  return *backend_;
165  }
166 
167  //- Is the coordinate system valid?
168  virtual bool valid() const
169  {
170  return backend_ && backend_->valid();
171  }
172 
173  //- True if the rotation tensor is uniform for all positions
174  virtual bool uniform() const
175  {
176  return backend_->uniform();
177  }
178 
179  //- The rotation specification
180  virtual const coordinateRotation& rotation() const
181  {
182  return backend_->rotation();
183  }
184 
185  //- Return the name
186  virtual const word& name() const
187  {
188  return backend_->name_;
189  }
190 
191  //- Return the optional note
192  virtual const string& note() const
193  {
194  return backend_->note();
195  }
196 
197  //- Return origin
198  virtual const point& origin() const
199  {
200  return backend_->origin();
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();
245  }
246 
247  //- Clear (ignored)
248  virtual void clear() {}
249 
250  //- Change the rotation (disallowed)
251  virtual void rotation(autoPtr<coordinateRotation>&& crot)
252  {
254  }
255 
256 
257  // Write
258 
259  //- Write
260  virtual void write(Ostream& os) const;
261 
262  //- Write dictionary entry
263  virtual void writeEntry(const word& keyword, Ostream& os) const;
264 
265 
266  // Member Operators
267 
268  //- No copy assignment
269  void operator=(const coordinateSystem& csys) = delete;
270 
271  //- No move assignment
272  void operator=(coordinateSystem&& csys) = delete;
273 
274 
275  // Rotations
276 
277  //- Position-dependent rotation tensor at a single point
278  virtual tensor R(const point& global) const
279  {
280  return backend_->R(global);
281  }
282 
283  //- Position-dependent rotation tensors at multiple points
284  virtual tmp<tensorField> R(const UList<point>& global) const
285  {
286  return backend_->R(global);
287  }
288 
289  //- Position-dependent rotation tensors at multiple points
290  virtual tmp<tensorField> R(const pointUIndList& global) const
291  {
292  return backend_->R(global);
293  }
294 };
295 
296 
297 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
298 
299 } // End namespace coordSystem
300 } // End namespace Foam
301 
302 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
303 
304 #endif
305 
306 // ************************************************************************* //
Foam::Tensor< scalar >
Foam::coordinateSystem::e3
virtual const vector e3() const
The local Cartesian z-axis in global coordinates.
Definition: coordinateSystem.H:493
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::coordSystem::indirect::writeEntry
virtual void writeEntry(const word &keyword, Ostream &os) const
Write dictionary entry.
Definition: indirectCS.C:91
Foam::coordSystem::indirect::uniform
virtual bool uniform() const
True if the rotation tensor is uniform for all positions.
Definition: indirectCS.H:188
Foam::coordSystem::indirect::rotation
virtual void rotation(autoPtr< coordinateRotation > &&crot)
Change the rotation (disallowed)
Definition: indirectCS.H:265
Foam::coordinateSystem::dummy_
static coordinateSystem dummy_
Dummy coordinate system for suppressed manipulation.
Definition: coordinateSystem.H:165
Foam::coordSystem::indirect::R
virtual const tensor & R() const
Return const reference to the rotation tensor.
Definition: indirectCS.H:218
Foam::coordSystem::indirect::clear
virtual void clear()
Clear (ignored)
Definition: indirectCS.H:262
coordinateSystem.H
Foam::coordinateSystem::rotation
virtual const coordinateRotation & rotation() const
The rotation specification.
Definition: coordinateSystem.H:451
Foam::coordSystem::indirect::localToGlobal
virtual vector localToGlobal(const vector &local, bool translate) const
Definition: indirectCS.H:98
Foam::coordSystem::indirect::origin
virtual point & origin()
Edit access to origin (disallowed)
Definition: indirectCS.H:255
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:60
Foam::coordSystem::indirect::operator=
void operator=(const coordinateSystem &csys)=delete
No copy assignment.
Foam::coordSystem::indirect::rotation
virtual const coordinateRotation & rotation() const
The rotation specification.
Definition: indirectCS.H:194
Foam::coordinateSystem::origin
virtual const point & origin() const
Return origin.
Definition: coordinateSystem.H:469
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
Foam::coordinateSystem::uniform
virtual bool uniform() const
True if the rotation tensor is uniform for all locations.
Definition: coordinateSystem.H:445
Foam::Field< vector >
Foam::coordinateSystem::e2
virtual const vector e2() const
The local Cartesian y-axis in global coordinates.
Definition: coordinateSystem.H:487
Foam::coordinateRotation
User specification of a coordinate rotation.
Definition: coordinateRotation.H:78
Foam::coordSystem::indirect::write
virtual void write(Ostream &os) const
Write.
Definition: indirectCS.C:84
Foam::coordinateSystem::valid
virtual bool valid() const
Considered valid if it has a specification.
Definition: coordinateSystem.H:439
Foam::coordSystem::indirect::clone
virtual autoPtr< coordinateSystem > clone() const
Return clone.
Definition: indirectCS.H:161
Foam::coordinateSystem::name_
word name_
The name of the coordinate system (optional)
Definition: coordinateSystem.H:159
Foam::coordSystem::indirect::e1
virtual const vector e1() const
The local Cartesian x-axis in global coordinates.
Definition: indirectCS.H:224
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::coordSystem::indirect::note
string & note()
Provide non-constant access to the optional note.
Definition: indirectCS.H:248
Foam::coordSystem::indirect::rename
void rename(const word &newName)
Rename (ignored)
Definition: indirectCS.H:245
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam::coordSystem::indirect::R
virtual tmp< tensorField > R(const UList< point > &global) const
Position-dependent rotation tensors at multiple points.
Definition: indirectCS.H:298
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::coordinateSystem::globalToLocal
virtual vector globalToLocal(const vector &global, bool translate) const
Definition: coordinateSystem.C:368
Foam::coordSystem::indirect::valid
virtual bool valid() const
Is the coordinate system valid?
Definition: indirectCS.H:182
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::Vector< scalar >
Foam::coordSystem::indirect::e3
virtual const vector e3() const
The local Cartesian z-axis in global coordinates.
Definition: indirectCS.H:236
Foam::coordinateSystem::coordinateSystem
coordinateSystem()
Default construct. This is an identity coordinate system.
Definition: coordinateSystem.C:117
Foam::UList
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:103
Foam::coordSystem::indirect::R
virtual tmp< tensorField > R(const pointUIndList &global) const
Position-dependent rotation tensors at multiple points.
Definition: indirectCS.H:304
Foam::coordSystem::indirect::name
virtual const word & name() const
Return the name.
Definition: indirectCS.H:200
Foam::coordinateSystem::localToGlobal
virtual vector localToGlobal(const vector &local, bool translate) const
Definition: coordinateSystem.C:338
Foam::UIndirectList
A List with indirect addressing.
Definition: faMatrix.H:60
Foam::coordinateSystem::e1
virtual const vector e1() const
The local Cartesian x-axis in global coordinates.
Definition: coordinateSystem.H:481
Foam::coordSystem::indirect::origin
virtual const point & origin() const
Return origin.
Definition: indirectCS.H:212
Foam::coordSystem::indirect::R
virtual tensor R(const point &global) const
Position-dependent rotation tensor at a single point.
Definition: indirectCS.H:292
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::coordSystem::indirect::e2
virtual const vector e2() const
The local Cartesian y-axis in global coordinates.
Definition: indirectCS.H:230
Foam::coordSystem::indirect::cs
virtual const coordinateSystem & cs() const
Reference to the underlying coordinate system.
Definition: indirectCS.H:176
Foam::coordSystem::indirect::note
virtual const string & note() const
Return the optional note.
Definition: indirectCS.H:206
Foam::coordSystem::indirect::globalToLocal
virtual vector globalToLocal(const vector &global, bool translate) const
Definition: indirectCS.H:120
Foam::coordinateSystem::note
virtual const string & note() const
Return the optional note.
Definition: coordinateSystem.H:463
Foam::coordSystem::indirect::~indirect
virtual ~indirect()=default
Destructor.
Foam::coordSystem::indirect
A coordinate system forward to a global coordinate system that is normally provided by the constant/c...
Definition: indirectCS.H:75
Foam::coordinateSystem
Base class for coordinate system specification, the default coordinate system type is cartesian .
Definition: coordinateSystem.H:132
Foam::coordinateSystem::R
virtual const tensor & R() const
Return const reference to the rotation tensor.
Definition: coordinateSystem.H:475
Foam::coordSystem::indirect::TypeName
TypeName("indirect")
Runtime type information.