spatialTransformI.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) 2016 OpenFOAM Foundation
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 \*---------------------------------------------------------------------------*/
27 
28 #include "transform.H"
29 
30 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
31 
32 Foam::tensor Foam::spatialTransform::Erx() const
33 {
34  return E_ & *r_;
35 }
36 
37 
38 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
39 
41 :
42  E_(tensor::I),
43  r_(Zero)
44 {}
45 
46 
48 (
49  const tensor& E,
50  const vector& r
51 )
52 :
53  E_(E),
54  r_(r)
55 {}
56 
57 
59 :
60  E_(is),
61  r_(is)
62 {}
63 
64 
66 :
67  X_(X)
68 {}
69 
70 
72 :
73  X_(X)
74 {}
75 
76 
77 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
78 
80 {
81  return E_;
82 }
83 
85 {
86  return E_;
87 }
88 
90 {
91  return r_;
92 }
93 
95 {
96  return r_;
97 }
98 
99 
101 {
102  return transpose(*this);
103 }
104 
105 
107 {
108  return spatialTransform(E_.T(), -(E_ & r_));
109 }
110 
111 
112 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
113 
115 {
116  return dual(*this);
117 }
118 
119 
120 inline Foam::spatialTransform::operator spatialTensor() const
121 {
122  return spatialTensor
123  (
124  E_, Zero,
125  -Erx(), E_
126  );
127 }
128 
129 
131 {
132  E_ &= X.E_;
133  r_ = X.r_ + (r_ & X.E_);
134 }
135 
136 
137 inline Foam::spatialTransform Foam::spatialTransform::operator&
138 (
139  const spatialTransform& X
140 ) const
141 {
142  return spatialTransform(E_ & X.E_, X.r_ + (r_ & X.E_));
143 }
144 
145 
146 inline Foam::spatialVector Foam::spatialTransform::operator&
147 (
148  const spatialVector& v
149 ) const
150 {
151  return spatialVector
152  (
153  E_ & v.w(),
154  E_ & (v.l() - (r_ ^ v.w()))
155  );
156 }
157 
158 
159 inline Foam::spatialVector Foam::spatialTransform::operator&&
160 (
161  const spatialVector& v
162 ) const
163 {
164  return spatialVector
165  (
166  E_ & v.w(),
167  E_ & (v.l() - r_)
168  );
169 }
170 
171 
173 (
174  const vector& p
175 ) const
176 {
177  return E_ & (p - r_);
178 }
179 
180 
181 inline Foam::spatialTransform::transpose::operator spatialTensor() const
182 {
183  return spatialTensor
184  (
185  X_.E().T(), -X_.Erx().T(),
186  Zero, X_.E().T()
187  );
188 }
189 
190 
191 inline Foam::spatialVector Foam::spatialTransform::transpose::operator&
192 (
193  const spatialVector& f
194 ) const
195 {
196  vector ETfl(X_.E().T() & f.l());
197 
198  return spatialVector
199  (
200  (X_.E().T() & f.w()) + (X_.r() ^ ETfl),
201  ETfl
202  );
203 }
204 
205 
206 inline Foam::spatialTransform::dual::operator spatialTensor() const
207 {
208  return spatialTensor
209  (
210  X_.E(), -X_.Erx(),
211  Zero, X_.E()
212  );
213 }
214 
215 
216 inline Foam::spatialVector Foam::spatialTransform::dual::operator&
217 (
218  const spatialVector& f
219 ) const
220 {
221  return spatialVector
222  (
223  X_.E() & (f.w() - (X_.r() ^ f.l())),
224  X_.E() & f.l()
225  );
226 }
227 
228 
229 // * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * //
230 
232 {
233  is >> X.E() >> X.r();
234  return is;
235 }
236 
237 
238 inline Foam::Ostream& Foam::operator<<
239 (
240  Foam::Ostream& os,
241  const spatialTransform& X
242 )
243 {
244  os << X.E() << token::SPACE << X.r();
245  return os;
246 }
247 
248 
249 // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
250 
251 namespace Foam
252 {
253 
254 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
255 
256 //- Rotational spatial transformation tensor about the x-axis by omega radians
257 inline spatialTransform Xrx(const scalar& omega)
258 {
259  return spatialTransform(Rx(omega), Zero);
260 }
261 
262 //- Rotational spatial transformation tensor about the y-axis by omega radians
263 inline spatialTransform Xry(const scalar& omega)
264 {
265  return spatialTransform(Ry(omega), Zero);
266 }
267 
268 //- Rotational spatial transformation tensor about the z-axis by omega radians
269 inline spatialTransform Xrz(const scalar& omega)
270 {
271  return spatialTransform(Rz(omega), Zero);
272 }
273 
274 //- Rotational spatial transformation tensor about axis a by omega radians
275 inline spatialTransform Xr(const vector& a, const scalar omega)
276 {
277  return spatialTransform(Ra(a, omega), Zero);
278 }
279 
280 //- Translational spatial transformation tensor for translation r
281 inline spatialTransform Xt(const vector& r)
282 {
283  return spatialTransform(tensor::I, r);
284 }
285 
286 
287 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
288 
289 } // End namespace Foam
290 
291 // ************************************************************************* //
Foam::Tensor
A templated (3 x 3) tensor of objects of <T> derived from MatrixSpace.
Definition: complexI.H:275
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::Tensor< scalar >::I
static const Tensor I
Definition: Tensor.H:85
Foam::spatialTransform
Compact representation of the Pl├╝cker spatial transformation tensor in terms of the rotation tensor E...
Definition: spatialTransform.H:70
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::Ry
tensor Ry(const scalar &omega)
Rotational transformation tensor about the y-axis by omega radians.
Definition: transform.H:99
Foam::spatialTransform::operator&=
void operator&=(const spatialTransform &X)
Inner-product multiply with a transformation tensor.
Definition: spatialTransformI.H:130
Foam::spatialTransform::dual::dual
dual(const spatialTransform &X)
Construct from a spatialTransform.
Definition: spatialTransformI.H:71
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:230
Foam::Xrx
spatialTransform Xrx(const scalar &omega)
Rotational spatial transformation tensor about the x-axis by omega radians.
Definition: spatialTransformI.H:257
Foam::Rz
tensor Rz(const scalar &omega)
Rotational transformation tensor about the z-axis by omega radians.
Definition: transform.H:113
Foam::Rx
tensor Rx(const scalar &omega)
Rotational transformation tensor about the x-axis by omega radians.
Definition: transform.H:85
Foam::spatialTransform::transpose::transpose
transpose(const spatialTransform &X)
Construct from a spatialTransform.
Definition: spatialTransformI.H:65
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::spatialTransform::r
const vector & r() const
Return the translation vector.
Definition: spatialTransformI.H:89
Foam::spatialTransform::T
transpose T() const
Return the transpose transformation tensor ^A{X^*}_B.
Definition: spatialTransformI.H:100
Foam::SpatialVector< scalar >
Foam::Xt
spatialTransform Xt(const vector &r)
Translational spatial transformation tensor for translation r.
Definition: spatialTransformI.H:281
Foam::spatialTransform::operator*
dual operator*() const
Return the dual transformation tensor ^B{X^*}_A.
Definition: spatialTransformI.H:114
Foam::spatialTransform::E
const tensor & E() const
Return the rotation tensor.
Definition: spatialTransformI.H:79
Foam::spatialTransform::transformPoint
vector transformPoint(const vector &p) const
Transform position p.
Definition: spatialTransformI.H:173
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::Xr
spatialTransform Xr(const vector &a, const scalar omega)
Rotational spatial transformation tensor about axis a by omega radians.
Definition: spatialTransformI.H:275
Foam::spatialTransform::inv
spatialTransform inv() const
Return the inverse transformation tensor: X^-1.
Definition: spatialTransformI.H:106
Foam::spatialTransform::transpose
Wrapper-class to provide transpose functions and operators.
Definition: spatialTransform.H:90
Foam::Xry
spatialTransform Xry(const scalar &omega)
Rotational spatial transformation tensor about the y-axis by omega radians.
Definition: spatialTransformI.H:263
f
labelList f(nPoints)
Foam::spatialTensor
SpatialTensor< scalar > spatialTensor
SpatialTensor of scalars.
Definition: spatialTensor.H:50
Foam::Vector< scalar >
Foam::token::SPACE
Space [isspace].
Definition: token.H:118
Foam::Ra
tensor Ra(const vector &a, const scalar omega)
Rotational transformation tensor about axis a by omega radians.
Definition: transform.H:127
Foam::Tensor::T
Tensor< Cmpt > T() const
Return non-Hermitian transpose.
Definition: TensorI.H:504
Foam::spatialVector
SpatialVector< scalar > spatialVector
SpatialVector of scalars.
Definition: spatialVector.H:50
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
transform.H
3D tensor transformation operations.
Foam::Xrz
spatialTransform Xrz(const scalar &omega)
Rotational spatial transformation tensor about the z-axis by omega radians.
Definition: spatialTransformI.H:269
Foam::spatialTransform::dual
Wrapper-class to provide dual functions and operators.
Definition: spatialTransform.H:110
Foam::I
static const Identity< scalar > I
Definition: Identity.H:95
Foam::spatialTransform::spatialTransform
spatialTransform()
Construct null.
Definition: spatialTransformI.H:40