smallPoolFire2D fireFoam tutorial: improved stability of the BCs.
[OpenFOAM-1.6.x.git] / src / postProcessing / functionObjects / forces / pointPatchFields / derived / sixDoFRigidBodyDisplacement / sixDoFRigidBodyMotion / sixDoFRigidBodyMotionState.H
blob32cf0be02bc51a452783377fbbd653ad20d14f1f
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2009-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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
25 Class
26     Foam::sixDoFRigidBodyMotionState
28 Description
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.
33 SourceFiles
34     sixDoFRigidBodyMotionStateI.H
35     sixDoFRigidBodyMotionState.C
36     sixDoFRigidBodyMotionStateIO.C
38 \*---------------------------------------------------------------------------*/
40 #ifndef sixDoFRigidBodyMotionState_H
41 #define sixDoFRigidBodyMotionState_H
43 #include "vector.H"
44 #include "point.H"
45 #include "diagTensor.H"
46 #include "tensor.H"
47 #include "dictionary.H"
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 namespace Foam
54 // Forward declaration of classes
55 class Istream;
56 class Ostream;
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
70     // Private data
72         //- Current position of the centre of mass of the body
73         point centreOfMass_;
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
79         tensor Q_;
81         // Linear velocity of body
82         vector v_;
84         // Total linear acceleration of body
85         vector a_;
87         //- Angular momentum of body, in body local reference frame
88         vector pi_;
90         //- Total torque on body, in body local reference frame
91         vector tau_;
94 public:
96     // Constructors
98         //- Construct null
99         sixDoFRigidBodyMotionState();
101         //- Construct from components
102         sixDoFRigidBodyMotionState
103         (
104             const point& centreOfMass,
105             const tensor& Q,
106             const vector& v,
107             const vector& a,
108             const vector& pi,
109             const vector& tau
110         );
112         //- Construct from dictionary
113         sixDoFRigidBodyMotionState(const dictionary& dict);
115         //- Construct as copy
116         sixDoFRigidBodyMotionState(const sixDoFRigidBodyMotionState&);
119     //- Destructor
120     ~sixDoFRigidBodyMotionState();
123     // Member Functions
125         // Access
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;
146         // Edit
148             //- Return non-const access to the centre of mass
149             inline point& centreOfMass();
151             //- Return non-const access to the orientation
152             inline tensor& Q();
154             //- Return non-const access to vector
155             inline vector& v();
157             //- Return non-const access to acceleration
158             inline vector& a();
160             //- Return non-const access to angular momentum
161             inline vector& pi();
163             //- Return non-const access to torque
164             inline vector& tau();
167         //- Write
168         void write(Ostream&) const;
171     // Friend Functions
173     // Friend Operators
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 #endif
194 // ************************************************************************* //