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 -------------------------------------------------------------------------------
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::spatialTransform
28 
29 Description
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 
40 SourceFiles
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 
54 namespace Foam
55 {
56 
57 // Forward declaration of classes
58 class Istream;
59 class Ostream;
60 
61 // Forward declaration of friend functions and operators
62 class spatialTransform;
63 Istream& operator>>(Istream&, spatialTransform&);
64 Ostream& operator<<(Ostream&, const spatialTransform&);
65 
66 
67 /*---------------------------------------------------------------------------*\
68  Class spatialTransform Declaration
69 \*---------------------------------------------------------------------------*/
70 
71 class spatialTransform
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 
88 public:
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
193 
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 // ************************************************************************* //
Foam::Tensor< scalar >
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::spatialTransform::operator&
spatialTransform operator&(const spatialTransform &X) const
Return the inner-product of two transformation tensors.
Definition: spatialTransformI.H:138
Foam::spatialTransform
Compact representation of the Plücker spatial transformation tensor in terms of the rotation tensor E...
Definition: spatialTransform.H:70
Foam::spatialTransform::transpose::operator&
spatialVector operator&(const spatialVector &f) const
Transpose transform dual f: ^A{X^*}_B & f.
Definition: spatialTransformI.H:192
spatialTensor.H
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::spatialTransform::operator<<
friend Ostream & operator<<(Ostream &, const spatialTransform &)
Foam::spatialTransform::operator&&
spatialVector operator&&(const spatialVector &v) const
Transform position p.
Definition: spatialTransformI.H:160
spatialVector.H
tensor.H
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
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 >
spatialTransformI.H
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::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
f
labelList f(nPoints)
Foam::spatialTensor
SpatialTensor< scalar > spatialTensor
SpatialTensor of scalars.
Definition: spatialTensor.H:50
Foam::Vector< scalar >
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::spatialTransform::dual::operator&
spatialVector operator&(const spatialVector &f) const
Transform dual f: ^B{X^*}_A & f.
Definition: spatialTransformI.H:217
Foam::spatialTransform::dual
Wrapper-class to provide dual functions and operators.
Definition: spatialTransform.H:110
Foam::spatialTransform::spatialTransform
spatialTransform()
Construct null.
Definition: spatialTransformI.H:40
Foam::spatialTransform::operator>>
friend Istream & operator>>(Istream &, spatialTransform &)