sixDoFRigidBodyMotionState.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 | Copyright (C) 2011-2014 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::sixDoFRigidBodyMotionState
26 
27 Description
28  Holds the motion state of sixDoF object. Wrapped up together
29  to allow rapid scatter to other processors. The processors must all
30  maintain exactly the same state data to avoid any drift or inconsistency.
31 
32 SourceFiles
33  sixDoFRigidBodyMotionStateI.H
34  sixDoFRigidBodyMotionState.C
35  sixDoFRigidBodyMotionStateIO.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef sixDoFRigidBodyMotionState_H
40 #define sixDoFRigidBodyMotionState_H
41 
42 #include "vector.H"
43 #include "point.H"
44 #include "diagTensor.H"
45 #include "tensor.H"
46 #include "dictionary.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 // Forward declaration of classes
54 class Istream;
55 class Ostream;
56 
57 // Forward declaration of friend functions and operators
58 class sixDoFRigidBodyMotionState;
59 Istream& operator>>(Istream&, sixDoFRigidBodyMotionState&);
60 Ostream& operator<<(Ostream&, const sixDoFRigidBodyMotionState&);
61 
62 
63 /*---------------------------------------------------------------------------*\
64  Class sixDoFRigidBodyMotionState Declaration
65 \*---------------------------------------------------------------------------*/
66 
68 {
69  // Private data
70 
71  //- Current position of the centre of mass of the body
72  point centreOfRotation_;
73 
74  //- Orientation, stored as the rotation tensor to transform
75  // from the body to the global reference frame, i.e.:
76  // globalVector = Q_ & bodyLocalVector
77  // bodyLocalVector = Q_.T() & globalVector
78  tensor Q_;
79 
80  // Linear velocity of body
81  vector v_;
82 
83  // Total linear acceleration of body
84  vector a_;
85 
86  //- Angular momentum of body, in body local reference frame
87  vector pi_;
88 
89  //- Total torque on body, in body local reference frame
90  vector tau_;
91 
92 
93 public:
94 
95  // Constructors
96 
97  //- Construct null
99 
100  //- Construct from dictionary
102 
103  //- Construct as copy
105 
106 
107  //- Destructor
109 
110 
111  // Member Functions
112 
113  // Access
114 
115  //- Return access to the centre of mass
116  inline const point& centreOfRotation() const;
117 
118  //- Return access to the orientation
119  inline const tensor& Q() const;
120 
121  //- Return access to velocity
122  inline const vector& v() const;
123 
124  //- Return access to acceleration
125  inline const vector& a() const;
126 
127  //- Return access to angular momentum
128  inline const vector& pi() const;
129 
130  //- Return access to torque
131  inline const vector& tau() const;
132 
133 
134  // Edit
135 
136  //- Return non-const access to the centre of mass
137  inline point& centreOfRotation();
138 
139  //- Return non-const access to the orientation
140  inline tensor& Q();
141 
142  //- Return non-const access to vector
143  inline vector& v();
144 
145  //- Return non-const access to acceleration
146  inline vector& a();
147 
148  //- Return non-const access to angular momentum
149  inline vector& pi();
150 
151  //- Return non-const access to torque
152  inline vector& tau();
153 
154 
155  //- Write to dictionary
156  void write(dictionary& dict) const;
157 
158  //- Write to stream
159  void write(Ostream&) const;
160 
161 
162  // IOstream Operators
163 
166 };
167 
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 } // End namespace Foam
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 #endif
180 
181 // ************************************************************************* //
friend Istream & operator>>(Istream &, sixDoFRigidBodyMotionState &)
const vector & tau() const
Return access to torque.
const vector & v() const
Return access to velocity.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Ostream & operator<<(Ostream &, const edgeMesh &)
Definition: edgeMeshIO.C:133
Namespace for OpenFOAM.
dictionary dict
const vector & a() const
Return access to acceleration.
void write(dictionary &dict) const
Write to dictionary.
const point & centreOfRotation() const
Return access to the centre of mass.
friend Ostream & operator<<(Ostream &, const sixDoFRigidBodyMotionState &)
Holds the motion state of sixDoF object. Wrapped up together to allow rapid scatter to other processo...
Istream & operator>>(Istream &, edgeMesh &)
Definition: edgeMeshIO.C:144
const vector & pi() const
Return access to angular momentum.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
const tensor & Q() const
Return access to the orientation.