spatialTransform.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
26Class
27 Foam::spatialTransform
28
29Description
30 Compact representation of the Plücker spatial transformation tensor
31 in terms of the rotation tensor \c E and translation vector \c r .
32
33 See Chapter 2 and Appendix A in reference:
34 \verbatim
35 Featherstone, R. (2008).
36 Rigid body dynamics algorithms.
37 Springer.
38 \endverbatim
39
40SourceFiles
41 spatialTransformI.H
42
43\*---------------------------------------------------------------------------*/
44
45#ifndef spatialTransform_H
46#define spatialTransform_H
47
48#include "tensor.H"
49#include "spatialVector.H"
50#include "spatialTensor.H"
51
52// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53
54namespace Foam
55{
56
57// Forward declaration of classes
58class Istream;
59class Ostream;
60
61// Forward declaration of friend functions and operators
62class spatialTransform;
63Istream& operator>>(Istream&, spatialTransform&);
64Ostream& operator<<(Ostream&, const spatialTransform&);
65
66
67/*---------------------------------------------------------------------------*\
68 Class spatialTransform Declaration
69\*---------------------------------------------------------------------------*/
72{
73 // Private data
74
75 //- Rotation tensor
76 tensor E_;
77
78 //- Translation vector
79 vector r_;
80
81
82 // Private member functions
83
84 //- Return E . *r
85 inline tensor Erx() const;
86
87
88public:
89
90 //- Wrapper-class to provide transpose functions and operators
91 class transpose
92 {
93 const spatialTransform& X_;
94
95 public:
96
97 //- Construct from a spatialTransform
98 inline transpose(const spatialTransform& X);
99
100 //- Return the transpose transformation tensor ^A{X^*}_B
101 // X^T
102 inline operator spatialTensor() const;
103
104 //- Transpose transform dual f: ^A{X^*}_B & f
105 // X^T . f = (E^T . fl + r ^ E^T . fw, E^T . fl)
106 inline spatialVector operator&(const spatialVector& f) const;
107 };
108
109
110 //- Wrapper-class to provide dual functions and operators
111 class dual
112 {
113 const spatialTransform& X_;
114
115 public:
116
117 //- Construct from a spatialTransform
118 inline dual(const spatialTransform& X);
119
120 //- Return dual transformation tensor ^B{X^*}_A
121 inline operator spatialTensor() const;
122
123 //- Transform dual f: ^B{X^*}_A & f
124 // X^* . f = (E . fw - r ^ fl, E . fl)
125 inline spatialVector operator&(const spatialVector& f) const;
126 };
127
128
129 // Constructors
130
131 //- Construct null
132 inline spatialTransform();
133
134 //- Construct from components
135 inline spatialTransform(const tensor& E, const vector& r);
136
137 //- Construct from Istream
138 inline spatialTransform(Istream&);
139
140
141 // Member Functions
142
143 //- Return the rotation tensor
144 inline const tensor& E() const;
145
146 //- Return non-const access to the rotation tensor
147 inline tensor& E();
148
149 //- Return the translation vector
150 inline const vector& r() const;
151
152 //- Return non-const access to the translation vector
153 inline vector& r();
154
155 //- Return the transpose transformation tensor ^A{X^*}_B
156 // X^T
157 inline transpose T() const;
158
159 //- Return the inverse transformation tensor: X^-1
160 // X^-1 = (E^T, −E.r)
161 inline spatialTransform inv() const;
162
163
164 // Member Operators
165
166 //- Return the dual transformation tensor ^B{X^*}_A
167 inline dual operator*() const;
168
169 //- Return transformation tensor ^BX_A
170 // X
171 inline operator spatialTensor() const;
172
173 //- Inner-product multiply with a transformation tensor
174 inline void operator&=(const spatialTransform& X);
175
176 //- Return the inner-product of two transformation tensors
177 inline spatialTransform operator&(const spatialTransform& X) const;
178
179 //- Transform v: ^BX_A . v
180 // X.v = (E . vw, E . (vl - r^vw))
181 inline spatialVector operator&(const spatialVector& v) const;
182
183 //- Transform position p
184 // X:p = E . (pl - r)
185 inline vector transformPoint(const vector& p) const;
186
187 //- Transform position p
188 // X:p = (E . pw, E . (vl - r))
189 inline spatialVector operator&&(const spatialVector& v) const;
190
191
192 // IOstream Operators
195 friend Ostream& operator<<(Ostream&, const spatialTransform&);
196};
197
198
199// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200
201} // End namespace Foam
202
203// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204
205#include "spatialTransformI.H"
206
207// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208
209#endif
210
211// ************************************************************************* //
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
Wrapper-class to provide dual functions and operators.
spatialVector operator&(const spatialVector &f) const
Transform dual f: ^B{X^*}_A & f.
Wrapper-class to provide transpose functions and operators.
spatialVector operator&(const spatialVector &f) const
Transpose transform dual f: ^A{X^*}_B & f.
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.
spatialTransform operator&(const spatialTransform &X) const
Return the inner-product of two transformation tensors.
dual operator*() const
Return the dual transformation tensor ^B{X^*}_A.
vector transformPoint(const vector &p) const
Transform position p.
friend Istream & operator>>(Istream &, spatialTransform &)
spatialTransform()
Construct null.
spatialVector operator&&(const spatialVector &v) const
Transform position p.
void operator&=(const spatialTransform &X)
Inner-product multiply with a transformation tensor.
spatialTransform inv() const
Return the inverse transformation tensor: X^-1.
friend Ostream & operator<<(Ostream &, const spatialTransform &)
volScalarField & p
Namespace for OpenFOAM.
SpatialTensor< scalar > spatialTensor
SpatialTensor of scalars.
Definition: spatialTensor.H:50
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Istream & operator>>(Istream &, directionInfo &)
labelList f(nPoints)