rigidBodyInertia.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::rigidBodyInertia
28
29Description
30 This class represents the linear and angular inertia of a rigid body
31 by the mass, centre of mass and moment of inertia tensor about the
32 centre of mass.
33
34 Reference:
35 \verbatim
36 Featherstone, R. (2008).
37 Rigid body dynamics algorithms.
38 Springer.
39 \endverbatim
40
41SourceFiles
42 rigidBodyInertiaI.H
43 rigidBodyInertia.C
44 rigidBodyInertiaIO.C
45
46\*---------------------------------------------------------------------------*/
47
48#ifndef RBD_rigidBodyInertia_H
49#define RBD_rigidBodyInertia_H
50
51#include "vector.H"
52#include "symmTensor.H"
53#include "spatialVector.H"
54#include "spatialTensor.H"
55
56// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57
58namespace Foam
59{
60
61// Forward declaration of classes
62class Istream;
63class Ostream;
64
65namespace RBD
66{
67
68// Forward declaration of friend functions and operators
70Istream& operator>>(Istream&, rigidBodyInertia&);
71Ostream& operator<<(Ostream&, const rigidBodyInertia&);
72
73
74/*---------------------------------------------------------------------------*\
75 Class rigidBodyInertia Declaration
76\*---------------------------------------------------------------------------*/
79{
80 // Private data
81
82 //- Mass of the rigid-body
83 scalar m_;
84
85 //- Centre of mass of the rigid-body
86 vector c_;
87
88 //- Inertia tensor about the centre of mass
89 symmTensor Ic_;
90
91
92public:
93
94 // Static member functions
95
96 //- Return the difference between the inertia tensor of the rigid-body
97 // about the origin - about the centre of mass
98 // for the given mass and centre of mass
99 inline static symmTensor Ioc(const scalar m, const vector& c);
100
101
102 // Constructors
103
104 //- Null constructor, initializes to zero
105 inline rigidBodyInertia();
106
107 //- Construct from mass, centre of mass and moment of inertia tensor
108 // about the centre of mass
109 inline rigidBodyInertia
110 (
111 const scalar m,
112 const vector& c,
113 const symmTensor& Ic
114 );
115
116 //- Construct from dictionary
117 inline rigidBodyInertia(const dictionary& dict);
118
119 //- Construct from the components of a spatial tensor
120 inline explicit rigidBodyInertia(const spatialTensor& st);
121
122 //- Construct from Istream
123 inline explicit rigidBodyInertia(Istream& is);
124
125
126 // Member Functions
127
128 //- Return the mass of the rigid-body
129 inline scalar m() const;
130
131 //- Return the centre of mass of the rigid-body
132 inline const vector& c() const;
133
134 //- Return the inertia tensor of the rigid-body about the centre of mass
135 inline const symmTensor& Ic() const;
136
137 //- Return the difference between the inertia tensor of the rigid-body
138 // about the origin - about the centre of mass
139 inline symmTensor Ioc() const;
140
141 //- Return the difference between the inertia tensor of the rigid-body
142 // about the a new centre of mass - about the current centre of mass
143 inline symmTensor Icc(const vector& c) const;
144
145 //- Return the inertia tensor of the rigid-body about the origin
146 inline symmTensor Io() const;
147
148 //- Return the kinetic energy of the body with the given velocity
149 inline scalar kineticEnergy(const spatialVector& v);
150
151
152 // Member Operators
153
154 //- Conversion to spatial tensor
155 inline operator spatialTensor() const;
156
157 inline void operator+=(const rigidBodyInertia&);
158
159
160 // IOstream Operators
163 friend Ostream& operator<<(Ostream&, const rigidBodyInertia&);
164};
165
166
167// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168
169} // End namespace RBD
170} // End namespace Foam
171
172// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173
174#include "rigidBodyInertiaI.H"
175
176// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177
178#endif
179
180// ************************************************************************* //
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
symmTensor Icc(const vector &c) const
Return the difference between the inertia tensor of the rigid-body.
scalar kineticEnergy(const spatialVector &v)
Return the kinetic energy of the body with the given velocity.
const vector & c() const
Return the centre of mass of the rigid-body.
void operator+=(const rigidBodyInertia &)
rigidBodyInertia()
Null constructor, initializes to zero.
symmTensor Io() const
Return the inertia tensor of the rigid-body about the origin.
friend Ostream & operator<<(Ostream &, const rigidBodyInertia &)
symmTensor Ioc() const
Return the difference between the inertia tensor of the rigid-body.
friend Istream & operator>>(Istream &, rigidBodyInertia &)
scalar m() const
Return the mass of the rigid-body.
const symmTensor & Ic() const
Return the inertia tensor of the rigid-body about the centre of mass.
Templated 3D spatial tensor derived from MatrixSpace used to represent transformations of spatial vec...
Definition: SpatialTensor.H:70
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
This class represents the linear and angular inertia of a rigid body by the mass, centre of mass and ...
Ostream & operator<<(Ostream &, const rigidBody &)
Definition: rigidBodyI.H:75
Istream & operator>>(Istream &, rigidBodyInertia &)
Namespace for OpenFOAM.
SpatialTensor< scalar > spatialTensor
SpatialTensor of scalars.
Definition: spatialTensor.H:50
dictionary dict