spatialTransform.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::spatialTransform
26 
27 Description
28  Compact representation of the Plücker spatial transformation tensor
29  in terms of the rotation tensor \c E and translation vector \c r .
30 
31  See Chapter 2 and Appendix A in reference:
32  \verbatim
33  Featherstone, R. (2008).
34  Rigid body dynamics algorithms.
35  Springer.
36  \endverbatim
37 
38 SourceFiles
39  spatialTransformI.H
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef spatialTransform_H
44 #define spatialTransform_H
45 
46 #include "tensor.H"
47 #include "spatialVector.H"
48 #include "spatialTensor.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 // Forward declaration of classes
56 class Istream;
57 class Ostream;
58 
59 // Forward declaration of friend functions and operators
60 class spatialTransform;
61 Istream& operator>>(Istream&, spatialTransform&);
62 Ostream& operator<<(Ostream&, const spatialTransform&);
63 
64 
65 /*---------------------------------------------------------------------------*\
66  Class spatialTransform Declaration
67 \*---------------------------------------------------------------------------*/
68 
69 class spatialTransform
70 {
71  // Private Data
72 
73  //- Rotation tensor
74  tensor E_;
75 
76  //- Translation vector
77  vector r_;
78 
79 
80  // Private Member Functions
81 
82  //- Return E . *r
83  inline tensor Erx() const;
84 
85 
86 public:
87 
88  //- Wrapper-class to provide transpose functions and operators
89  class transpose
90  {
91  const spatialTransform& X_;
92 
93  public:
94 
95  //- Construct from a spatialTransform
96  inline transpose(const spatialTransform& X);
97 
98  //- Return the transpose transformation tensor ^A{X^*}_B
99  // X^T
100  inline operator spatialTensor() const;
101 
102  //- Transpose transform dual f: ^A{X^*}_B & f
103  // X^T . f = (E^T . fl + r ^ E^T . fw, E^T . fl)
104  inline spatialVector operator&(const spatialVector& f) const;
105  };
106 
107 
108  //- Wrapper-class to provide dual functions and operators
109  class dual
110  {
111  const spatialTransform& X_;
112 
113  public:
114 
115  //- Construct from a spatialTransform
116  inline dual(const spatialTransform& X);
117 
118  //- Return dual transformation tensor ^B{X^*}_A
119  inline operator spatialTensor() const;
120 
121  //- Transform dual f: ^B{X^*}_A & f
122  // X^* . f = (E . fw - r ^ fl, E . fl)
123  inline spatialVector operator&(const spatialVector& f) const;
124  };
125 
126 
127  // Constructors
128 
129  //- Construct null
130  inline spatialTransform();
131 
132  //- Construct from components
133  inline spatialTransform(const tensor& E, const vector& r);
134 
135  //- Construct from Istream
136  inline spatialTransform(Istream&);
137 
138 
139  // Member Functions
140 
141  //- Return the rotation tensor
142  inline const tensor& E() const;
143 
144  //- Return non-const access to the rotation tensor
145  inline tensor& E();
146 
147  //- Return the translation vector
148  inline const vector& r() const;
149 
150  //- Return non-const access to the translation vector
151  inline vector& r();
152 
153  //- Return the transpose transformation tensor ^A{X^*}_B
154  // X^T
155  inline transpose T() const;
156 
157  //- Return the inverse transformation tensor: X^-1
158  // X^-1 = (E^T, −E.r)
159  inline spatialTransform inv() const;
160 
161 
162  // Member Operators
163 
164  //- Return the dual transformation tensor ^B{X^*}_A
165  inline dual operator*() const;
166 
167  //- Return transformation tensor ^BX_A
168  // X
169  inline operator spatialTensor() const;
170 
171  //- Inner-product multiply with a transformation tensor
172  inline void operator&=(const spatialTransform& X);
173 
174  //- Return the inner-product of two transformation tensors
175  inline spatialTransform operator&(const spatialTransform& X) const;
176 
177  //- Transform v: ^BX_A . v
178  // X.v = (E . vw, E . (vl - r^vw))
179  inline spatialVector operator&(const spatialVector& v) const;
180 
181  //- Transform position p
182  // X:p = E . (pl - r)
183  inline vector transformPoint(const vector& p) const;
184 
185  //- Transform position p
186  // X:p = (E . pw, E . (vl - r))
187  inline spatialVector operator&&(const spatialVector& v) const;
188 
189 
190  // IOstream Operators
191 
193  friend Ostream& operator<<(Ostream&, const spatialTransform&);
194 };
195 
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 } // End namespace Foam
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 #include "spatialTransformI.H"
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 #endif
208 
209 // ************************************************************************* //
transpose T() const
Return the transpose transformation tensor ^A{X^*}_B.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
vector transformPoint(const vector &p) const
Transform position p.
transpose(const spatialTransform &X)
Construct from a spatialTransform.
const vector & r() const
Return the translation vector.
void operator &=(const spatialTransform &X)
Inner-product multiply with a transformation tensor.
spatialVector operator &(const spatialVector &f) const
Transpose transform dual f: ^A{X^*}_B & f.
SpatialTensor< scalar > spatialTensor
SpatialTensor of scalars.
Definition: spatialTensor.H:47
Istream & operator>>(Istream &, directionInfo &)
friend Ostream & operator<<(Ostream &, const spatialTransform &)
Wrapper-class to provide transpose functions and operators.
dual operator*() const
Return the dual transformation tensor ^B{X^*}_A.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
labelList f(nPoints)
Wrapper-class to provide dual functions and operators.
const tensor & E() const
Return the rotation tensor.
Ostream & operator<<(Ostream &, const ensightPart &)
friend Istream & operator>>(Istream &, spatialTransform &)
Compact representation of the Plücker spatial transformation tensor in terms of the rotation tensor E...
spatialVector operator &&(const spatialVector &v) const
Transform position p.
volScalarField & p
spatialTransform()
Construct null.
spatialTransform inv() const
Return the inverse transformation tensor: X^-1.
Namespace for OpenFOAM.