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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2014 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::sixDoFRigidBodyMotionState
28 
29 Description
30  Holds the motion state of sixDoF object. Wrapped up together
31  to allow rapid scatter to other processors. The processors must all
32  maintain exactly the same state data to avoid any drift or inconsistency.
33 
34 SourceFiles
35  sixDoFRigidBodyMotionStateI.H
36  sixDoFRigidBodyMotionState.C
37  sixDoFRigidBodyMotionStateIO.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef sixDoFRigidBodyMotionState_H
42 #define sixDoFRigidBodyMotionState_H
43 
44 #include "vector.H"
45 #include "point.H"
46 #include "diagTensor.H"
47 #include "tensor.H"
48 #include "dictionary.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 // Forward declaration of classes
56 class Istream;
57 class Ostream;
58 
59 // Forward declaration of friend functions and operators
60 class sixDoFRigidBodyMotionState;
61 Istream& operator>>(Istream&, sixDoFRigidBodyMotionState&);
62 Ostream& operator<<(Ostream&, const sixDoFRigidBodyMotionState&);
63 
64 
65 /*---------------------------------------------------------------------------*\
66  Class sixDoFRigidBodyMotionState Declaration
67 \*---------------------------------------------------------------------------*/
68 
70 {
71  // Private data
72 
73  //- Current position of the centre of mass of the body
74  point centreOfRotation_;
75 
76  //- Orientation, stored as the rotation tensor to transform
77  // from the body to the global reference frame, i.e.:
78  // globalVector = Q_ & bodyLocalVector
79  // bodyLocalVector = Q_.T() & globalVector
80  tensor Q_;
81 
82  // Linear velocity of body
83  vector v_;
84 
85  // Total linear acceleration of body
86  vector a_;
87 
88  //- Angular momentum of body, in body local reference frame
89  vector pi_;
90 
91  //- Total torque on body, in body local reference frame
92  vector tau_;
93 
94 
95 public:
96 
97  // Constructors
98 
99  //- Construct null
101 
102  //- Construct from dictionary
104 
105  //- Construct as copy
107 
108 
109  //- Destructor
111 
112 
113  // Member Functions
114 
115  // Access
116 
117  //- Return access to the centre of mass
118  inline const point& centreOfRotation() const;
119 
120  //- Return access to the orientation
121  inline const tensor& Q() const;
122 
123  //- Return access to velocity
124  inline const vector& v() const;
125 
126  //- Return access to acceleration
127  inline const vector& a() const;
128 
129  //- Return access to angular momentum
130  inline const vector& pi() const;
131 
132  //- Return access to torque
133  inline const vector& tau() const;
134 
135 
136  // Edit
137 
138  //- Return non-const access to the centre of mass
139  inline point& centreOfRotation();
140 
141  //- Return non-const access to the orientation
142  inline tensor& Q();
143 
144  //- Return non-const access to vector
145  inline vector& v();
146 
147  //- Return non-const access to acceleration
148  inline vector& a();
149 
150  //- Return non-const access to angular momentum
151  inline vector& pi();
152 
153  //- Return non-const access to torque
154  inline vector& tau();
155 
156 
157  //- Write to dictionary
158  void write(dictionary& dict) const;
159 
160  //- Write to stream
161  void write(Ostream&) const;
162 
163 
164  // IOstream Operators
165 
168 };
169 
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 } // End namespace Foam
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 #endif
182 
183 // ************************************************************************* //
Foam::sixDoFRigidBodyMotionState::~sixDoFRigidBodyMotionState
~sixDoFRigidBodyMotionState()
Destructor.
Definition: sixDoFRigidBodyMotionState.C:80
Foam::sixDoFRigidBodyMotionState::operator<<
friend Ostream & operator<<(Ostream &, const sixDoFRigidBodyMotionState &)
Foam::sixDoFRigidBodyMotionState::pi
const vector & pi() const
Return access to angular momentum.
Definition: sixDoFRigidBodyMotionStateI.H:55
Foam::Tensor< scalar >
point.H
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:228
tensor.H
Foam::sixDoFRigidBodyMotionState::Q
const tensor & Q() const
Return access to the orientation.
Definition: sixDoFRigidBodyMotionStateI.H:37
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
sixDoFRigidBodyMotionStateI.H
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::sixDoFRigidBodyMotionState::a
const vector & a() const
Return access to acceleration.
Definition: sixDoFRigidBodyMotionStateI.H:49
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::sixDoFRigidBodyMotionState
Holds the motion state of sixDoF object. Wrapped up together to allow rapid scatter to other processo...
Definition: sixDoFRigidBodyMotionState.H:68
Foam::sixDoFRigidBodyMotionState::write
void write(dictionary &dict) const
Write to dictionary.
Definition: sixDoFRigidBodyMotionStateIO.C:33
Foam::sixDoFRigidBodyMotionState::operator>>
friend Istream & operator>>(Istream &, sixDoFRigidBodyMotionState &)
Foam::sixDoFRigidBodyMotionState::v
const vector & v() const
Return access to velocity.
Definition: sixDoFRigidBodyMotionStateI.H:43
Foam::Vector< scalar >
Foam::sixDoFRigidBodyMotionState::tau
const vector & tau() const
Return access to torque.
Definition: sixDoFRigidBodyMotionStateI.H:61
dictionary.H
vector.H
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::sixDoFRigidBodyMotionState::sixDoFRigidBodyMotionState
sixDoFRigidBodyMotionState()
Construct null.
Definition: sixDoFRigidBodyMotionState.C:32
diagTensor.H
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &)
Definition: boundaryPatch.C:102
Foam::sixDoFRigidBodyMotionState::centreOfRotation
const point & centreOfRotation() const
Return access to the centre of mass.
Definition: sixDoFRigidBodyMotionStateI.H:31