1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 Foam::sixDoFRigidBodyMotionState
29 Holds the motion state of sixDoF object. Wrapped up together
30 to allow rapid scatter to other processors. The processors must all
31 maintain exactly the same state data to avoid any drift or inconsistency.
34 sixDoFRigidBodyMotionStateI.H
35 sixDoFRigidBodyMotionState.C
36 sixDoFRigidBodyMotionStateIO.C
38 \*---------------------------------------------------------------------------*/
40 #ifndef sixDoFRigidBodyMotionState_H
41 #define sixDoFRigidBodyMotionState_H
45 #include "diagTensor.H"
47 #include "dictionary.H"
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 // Forward declaration of classes
58 // Forward declaration of friend functions and operators
59 class sixDoFRigidBodyMotionState;
60 Istream& operator>>(Istream&, sixDoFRigidBodyMotionState&);
61 Ostream& operator<<(Ostream&, const sixDoFRigidBodyMotionState&);
64 /*---------------------------------------------------------------------------*\
65 Class sixDoFRigidBodyMotionState Declaration
66 \*---------------------------------------------------------------------------*/
68 class sixDoFRigidBodyMotionState
72 //- Current position of the centre of mass of the body
75 //- Orientation, stored as the rotation tensor to transform
76 // from the body to the global reference frame, i.e.:
77 // globalVector = Q_ & bodyLocalVector
78 // bodyLocalVector = Q_.T() & globalVector
81 // Linear velocity of body
84 // Total linear acceleration of body
87 //- Angular momentum of body, in body local reference frame
90 //- Total torque on body, in body local reference frame
99 sixDoFRigidBodyMotionState();
101 //- Construct from components
102 sixDoFRigidBodyMotionState
104 const point& centreOfMass,
112 //- Construct from dictionary
113 sixDoFRigidBodyMotionState(const dictionary& dict);
115 //- Construct as copy
116 sixDoFRigidBodyMotionState(const sixDoFRigidBodyMotionState&);
120 ~sixDoFRigidBodyMotionState();
127 //- Return access to the centre of mass
128 inline const point& centreOfMass() const;
130 //- Return access to the orientation
131 inline const tensor& Q() const;
133 //- Return access to velocity
134 inline const vector& v() const;
136 //- Return access to acceleration
137 inline const vector& a() const;
139 //- Return access to angular momentum
140 inline const vector& pi() const;
142 //- Return access to torque
143 inline const vector& tau() const;
148 //- Return non-const access to the centre of mass
149 inline point& centreOfMass();
151 //- Return non-const access to the orientation
154 //- Return non-const access to vector
157 //- Return non-const access to acceleration
160 //- Return non-const access to angular momentum
163 //- Return non-const access to torque
164 inline vector& tau();
168 void write(Ostream&) const;
175 // IOstream Operators
177 friend Istream& operator>>(Istream&, sixDoFRigidBodyMotionState&);
178 friend Ostream& operator<<(Ostream&, const sixDoFRigidBodyMotionState&);
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 } // End namespace Foam
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 #include "sixDoFRigidBodyMotionStateI.H"
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 // ************************************************************************* //