Loading...
Searching...
No Matches
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 Declarations
61
63/*---------------------------------------------------------------------------*\
64 Class spatialTransform Declaration
65\*---------------------------------------------------------------------------*/
66
68{
69 // Private data
70
71 //- Rotation tensor
72 tensor E_;
73
74 //- Translation vector
75 vector r_;
76
77
78 // Private member functions
79
80 //- Return E . *r
81 inline tensor Erx() const;
82
83
84public:
85
86 //- Wrapper-class to provide transpose functions and operators
87 class transpose
88 {
89 const spatialTransform& X_;
91 public:
92
93 //- Construct from a spatialTransform
94 inline transpose(const spatialTransform& X);
95
96 //- Return the transpose transformation tensor ^A{X^*}_B
97 // X^T
98 inline operator spatialTensor() const;
99
100 //- Transpose transform dual f: ^A{X^*}_B & f
101 // X^T . f = (E^T . fl + r ^ E^T . fw, E^T . fl)
102 inline spatialVector operator&(const spatialVector& f) const;
103 };
104
105
106 //- Wrapper-class to provide dual functions and operators
107 class dual
108 {
109 const spatialTransform& X_;
110
111 public:
112
113 //- Construct from a spatialTransform
114 inline dual(const spatialTransform& X);
115
116 //- Return dual transformation tensor ^B{X^*}_A
117 inline operator spatialTensor() const;
118
119 //- Transform dual f: ^B{X^*}_A & f
120 // X^* . f = (E . fw - r ^ fl, E . fl)
121 inline spatialVector operator&(const spatialVector& f) const;
122 };
123
124
125 // Constructors
126
127 //- Construct null
128 inline spatialTransform();
129
130 //- Construct from components
131 inline spatialTransform(const tensor& E, const vector& r);
132
133 //- Construct from Istream
134 inline spatialTransform(Istream&);
135
136
137 // Member Functions
138
139 //- Return the rotation tensor
140 inline const tensor& E() const;
141
142 //- Return non-const access to the rotation tensor
143 inline tensor& E();
144
145 //- Return the translation vector
146 inline const vector& r() const;
147
148 //- Return non-const access to the translation vector
149 inline vector& r();
150
151 //- Return the transpose transformation tensor ^A{X^*}_B
152 // X^T
153 inline transpose T() const;
154
155 //- Return the inverse transformation tensor: X^-1
156 // X^-1 = (E^T, −E.r)
157 inline spatialTransform inv() const;
158
159
160 // Member Operators
161
162 //- Return the dual transformation tensor ^B{X^*}_A
163 inline dual operator*() const;
164
165 //- Return transformation tensor ^BX_A
166 // X
167 inline operator spatialTensor() const;
168
169 //- Inner-product multiply with a transformation tensor
170 inline void operator&=(const spatialTransform& X);
171
172 //- Return the inner-product of two transformation tensors
173 inline spatialTransform operator&(const spatialTransform& X) const;
174
175 //- Transform v: ^BX_A . v
176 // X.v = (E . vw, E . (vl - r^vw))
177 inline spatialVector operator&(const spatialVector& v) const;
178
179 //- Transform position p
180 // X:p = E . (pl - r)
181 inline vector transformPoint(const vector& p) const;
182
183 //- Transform position p
184 // X:p = (E . pw, E . (vl - r))
185 inline spatialVector operator&&(const spatialVector& v) const;
186
187
188 // IOstream Operators
189
191 friend Ostream& operator<<(Ostream&, const spatialTransform&);
192};
193
194
195// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196
197} // End namespace Foam
198
199// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200
201#include "spatialTransformI.H"
202
203// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204
205#endif
206
207// ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Wrapper-class to provide dual functions and operators.
dual(const spatialTransform &X)
Construct from a spatialTransform.
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.
transpose(const spatialTransform &X)
Construct from a spatialTransform.
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.
SpatialVector< scalar > spatialVector
SpatialVector of scalars.
Tensor< scalar > tensor
Definition symmTensor.H:57
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
Istream & operator>>(Istream &, directionInfo &)
SpatialTensor< scalar > spatialTensor
SpatialTensor of scalars.
Vector< scalar > vector
Definition vector.H:57
labelList f(nPoints)