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 -------------------------------------------------------------------------------
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::RBD::rigidBody
28 
29 Group
30  grpRigidBodyDynamicsBodies
31 
32 Description
33 
34 SourceFiles
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"
44 #include "runTimeSelectionTables.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 namespace RBD
51 {
52 
53 // Forward declaration of classes
54 class subBody;
55 
56 // Forward declaration of friend functions and operators
57 class rigidBody;
58 
59 inline Ostream& operator<<(Ostream&, const rigidBody&);
60 
61 
62 /*---------------------------------------------------------------------------*\
63  Class rigidBody Declaration
64 \*---------------------------------------------------------------------------*/
65 
66 class rigidBody
67 :
68  public rigidBodyInertia
69 {
70  // Private data
71 
72  //- Name of body
73  word name_;
74 
75 
76 public:
77 
78  //- Runtime type information
79  TypeName("rigidBody");
80 
81 
82  // Declare run-time constructor selection table
83 
85  (
86  autoPtr,
87  rigidBody,
88  dictionary,
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
127  static autoPtr<rigidBody> New
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
136  static autoPtr<rigidBody> New
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
163 
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 // ************************************************************************* //
Foam::RBD::rigidBody
Definition: rigidBody.H:65
Foam::SymmTensor< scalar >
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::RBD::rigidBody::merge
void merge(const subBody &)
Merge a body into this parent body.
Definition: rigidBody.C:113
Foam::RBD::operator<<
Ostream & operator<<(Ostream &, const rigidBody &)
Definition: rigidBodyI.H:75
Foam::RBD::rigidBody::TypeName
TypeName("rigidBody")
Runtime type information.
subBody
This specialized rigidBody holds the original body after it has been merged into a master.
Foam::RBD::rigidBody::clone
virtual autoPtr< rigidBody > clone() const
Return clone of this rigidBody.
Definition: rigidBody.C:54
Foam::RBD::rigidBody::massless
virtual bool massless() const
Return false as this body is not massless.
Definition: rigidBody.C:107
Foam::RBD::rigidBodyInertia::m
scalar m() const
Return the mass of the rigid-body.
Definition: rigidBodyInertiaI.H:94
rigidBodyInertia.H
Foam::RBD::subBody
Definition: subBody.H:57
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::RBD::rigidBody::~rigidBody
virtual ~rigidBody()
Destructor.
Definition: rigidBody.C:101
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::RBD::rigidBody::write
virtual void write(Ostream &) const
Write.
Definition: rigidBody.C:123
Foam::RBD::rigidBody::name
const word & name() const
Return name.
Definition: rigidBodyI.H:67
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::Vector< scalar >
Foam::RBD::rigidBody::operator<<
friend Ostream & operator<<(Ostream &, const rigidBody &)
Foam::RBD::rigidBodyInertia::Ic
const symmTensor & Ic() const
Return the inertia tensor of the rigid-body about the centre of mass.
Definition: rigidBodyInertiaI.H:104
dictionary.H
Foam::RBD::rigidBody::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, rigidBody, dictionary,(const word &name, const dictionary &dict),(name, dict))
rigidBodyI.H
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::RBD::rigidBody::rigidBody
rigidBody(const word &name, const scalar &m, const vector &c, const symmTensor &Ic)
Construct from mass, centre of mass and moment of inertia tensor.
Definition: rigidBodyI.H:31
Foam::RBD::rigidBody::New
static autoPtr< rigidBody > New(const word &name, const scalar &m, const vector &c, const symmTensor &Ic)
Select constructed from components.
Definition: rigidBody.C:63
Foam::RBD::rigidBodyInertia
Definition: rigidBodyInertia.H:77
Foam::RBD::rigidBodyInertia::c
const vector & c() const
Return the centre of mass of the rigid-body.
Definition: rigidBodyInertiaI.H:99