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-------------------------------------------------------------------------------
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
26\*---------------------------------------------------------------------------*/
27
28#include "transform.H"
29
30// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
31
32Foam::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
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
138(
139 const spatialTransform& X
140) const
141{
142 return spatialTransform(E_ & X.E_, X.r_ + (r_ & X.E_));
143}
144
145
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
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
182{
183 return spatialTensor
184 (
185 X_.E().T(), -X_.Erx().T(),
186 Zero, X_.E().T()
187 );
188}
189
190
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
207{
208 return spatialTensor
209 (
210 X_.E(), -X_.Erx(),
211 Zero, X_.E()
212 );
213}
214
215
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
238inline Foam::Ostream& Foam::operator<<
239(
241 const spatialTransform& X
242)
243{
244 os << X.E() << token::SPACE << X.r();
245 return os;
246}
247
248
249// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
250
251namespace Foam
252{
253
254// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
255
256//- Rotational spatial transformation tensor about the x-axis by omega radians
257inline 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
263inline 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
269inline 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
275inline 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
281inline spatialTransform Xt(const vector& r)
282{
283 return spatialTransform(tensor::I, r);
284}
285
286
287// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
288
289} // End namespace Foam
290
291// ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
static const Tensor I
Definition: Tensor.H:81
friend Ostream & operator(Ostream &, const faMatrix< Type > &)
Wrapper-class to provide dual functions and operators.
Wrapper-class to provide transpose functions and operators.
Compact representation of the Plücker spatial transformation tensor in terms of the rotation tensor E...
transpose T() const
Return the transpose transformation tensor ^A{X^*}_B.
const vector & r() const
Return the translation vector.
const tensor & E() const
Return the rotation tensor.
dual operator*() const
Return the dual transformation tensor ^B{X^*}_A.
vector transformPoint(const vector &p) const
Transform position p.
spatialTransform()
Construct null.
void operator&=(const spatialTransform &X)
Inner-product multiply with a transformation tensor.
spatialTransform inv() const
Return the inverse transformation tensor: X^-1.
@ SPACE
Space [isspace].
Definition: token.H:125
volScalarField & p
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
tensor Rx(const scalar omega)
Rotational transformation tensor about the x-axis by omega radians.
Definition: transform.H:85
tensor Ra(const vector &a, const scalar omega)
Rotational transformation tensor about axis a by omega radians.
Definition: transform.H:127
tensor Ry(const scalar omega)
Rotational transformation tensor about the y-axis by omega radians.
Definition: transform.H:99
SpatialTensor< scalar > spatialTensor
SpatialTensor of scalars.
Definition: spatialTensor.H:50
static const Identity< scalar > I
Definition: Identity.H:94
spatialTransform Xt(const vector &r)
Translational spatial transformation tensor for translation r.
SpatialVector< scalar > spatialVector
SpatialVector of scalars.
Definition: spatialVector.H:50
Istream & operator>>(Istream &, directionInfo &)
tensor Rz(const scalar omega)
Rotational transformation tensor about the z-axis by omega radians.
Definition: transform.H:113
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
spatialTransform Xrz(const scalar &omega)
Rotational spatial transformation tensor about the z-axis by omega radians.
spatialTransform Xrx(const scalar &omega)
Rotational spatial transformation tensor about the x-axis by omega radians.
spatialTransform Xr(const vector &a, const scalar omega)
Rotational spatial transformation tensor about axis a by omega radians.
spatialTransform Xry(const scalar &omega)
Rotational spatial transformation tensor about the y-axis by omega radians.
labelList f(nPoints)
3D tensor transformation operations.