rigidBody.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::RBD::rigidBody
28
29Group
30 grpRigidBodyDynamicsBodies
31
32Description
33
34SourceFiles
35 rigidBodyI.H
36
37\*---------------------------------------------------------------------------*/
38
39#ifndef RBD_rigidBody_H
40#define RBD_rigidBody_H
41
42#include "rigidBodyInertia.H"
43#include "dictionary.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
50namespace RBD
51{
52
53// Forward declaration of classes
54class subBody;
55
56// Forward declaration of friend functions and operators
57class rigidBody;
58
59inline Ostream& operator<<(Ostream&, const rigidBody&);
60
61
62/*---------------------------------------------------------------------------*\
63 Class rigidBody Declaration
64\*---------------------------------------------------------------------------*/
66class rigidBody
67:
68 public rigidBodyInertia
69{
70 // Private data
71
72 //- Name of body
73 word name_;
74
75
76public:
77
78 //- Runtime type information
79 TypeName("rigidBody");
80
81
82 // Declare run-time constructor selection table
85 (
86 autoPtr,
89 (const word& name, const dictionary& dict),
90 (name, dict)
91 );
92
93
94 // Constructors
95
96 //- Construct from mass, centre of mass and moment of inertia tensor
97 // about the centre of mass
98 inline rigidBody
99 (
100 const word& name,
101 const scalar& m,
102 const vector& c,
103 const symmTensor& Ic
104 );
105
106 //- Construct from with the given rigidBodyInertia
107 inline rigidBody
108 (
109 const word& name,
110 const rigidBodyInertia& rbi
111 );
112
113 //- Construct from dictionary
114 inline rigidBody
115 (
116 const word& name,
117 const dictionary& dict
118 );
119
120 //- Return clone of this rigidBody
121 virtual autoPtr<rigidBody> clone() const;
122
123
124 // Selectors
125
126 //- Select constructed from components
128 (
129 const word& name,
130 const scalar& m,
131 const vector& c,
132 const symmTensor& Ic
133 );
134
135 //- Select constructed from name and dictionary
137 (
138 const word& name,
139 const dictionary& dict
140 );
141
142
143 //- Destructor
144 virtual ~rigidBody();
145
146
147 // Member Functions
148
149 //- Return name
150 inline const word& name() const;
151
152 //- Return false as this body is not massless
153 virtual bool massless() const;
154
155 //- Merge a body into this parent body
156 void merge(const subBody&);
157
158 //- Write
159 virtual void write(Ostream&) const;
160
161
162 // Ostream Operator
164 friend Ostream& operator<<(Ostream&, const rigidBody&);
165};
166
167
168// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169
170} // End namespace RBD
171} // End namespace Foam
172
173// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174
175#include "rigidBodyI.H"
176
177// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178
179#endif
180
181// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
const vector & c() const
Return the centre of mass of the rigid-body.
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.
static autoPtr< rigidBody > New(const word &name, const scalar &m, const vector &c, const symmTensor &Ic)
Select constructed from components.
Definition: rigidBody.C:63
virtual bool massless() const
Return false as this body is not massless.
Definition: rigidBody.C:107
void merge(const subBody &)
Merge a body into this parent body.
Definition: rigidBody.C:113
virtual ~rigidBody()
Destructor.
Definition: rigidBody.C:101
virtual autoPtr< rigidBody > clone() const
Return clone of this rigidBody.
Definition: rigidBody.C:54
friend Ostream & operator<<(Ostream &, const rigidBody &)
declareRunTimeSelectionTable(autoPtr, rigidBody, dictionary,(const word &name, const dictionary &dict),(name, dict))
TypeName("rigidBody")
Runtime type information.
const word & name() const
Return name.
Definition: rigidBodyI.H:67
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
This specialized rigidBody holds the original body after it has been merged into a master.
A class for handling words, derived from Foam::string.
Definition: word.H:68
Ostream & operator<<(Ostream &, const rigidBody &)
Definition: rigidBodyI.H:75
Namespace for OpenFOAM.
runTime write()
Macros to ease declaration of run-time selection tables.
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes)
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73