FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

sixDoFRigidBodyMotionState.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 2009-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::sixDoFRigidBodyMotionState
00026 
00027 Description
00028     Holds the motion state of sixDoF object.  Wrapped up together
00029     to allow rapid scatter to other processors.  The processors must all
00030     maintain exactly the same state data to avoid any drift or inconsistency.
00031 
00032 SourceFiles
00033     sixDoFRigidBodyMotionStateI.H
00034     sixDoFRigidBodyMotionState.C
00035     sixDoFRigidBodyMotionStateIO.C
00036 
00037 \*---------------------------------------------------------------------------*/
00038 
00039 #ifndef sixDoFRigidBodyMotionState_H
00040 #define sixDoFRigidBodyMotionState_H
00041 
00042 #include <OpenFOAM/vector.H>
00043 #include <OpenFOAM/point.H>
00044 #include <OpenFOAM/diagTensor.H>
00045 #include <OpenFOAM/tensor.H>
00046 #include <OpenFOAM/dictionary.H>
00047 
00048 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00049 
00050 namespace Foam
00051 {
00052 
00053 // Forward declaration of classes
00054 class Istream;
00055 class Ostream;
00056 
00057 // Forward declaration of friend functions and operators
00058 class sixDoFRigidBodyMotionState;
00059 Istream& operator>>(Istream&, sixDoFRigidBodyMotionState&);
00060 Ostream& operator<<(Ostream&, const sixDoFRigidBodyMotionState&);
00061 
00062 
00063 /*---------------------------------------------------------------------------*\
00064                   Class sixDoFRigidBodyMotionState Declaration
00065 \*---------------------------------------------------------------------------*/
00066 
00067 class sixDoFRigidBodyMotionState
00068 {
00069     // Private data
00070 
00071         //- Current position of the centre of mass of the body
00072         point centreOfMass_;
00073 
00074         //- Orientation, stored as the rotation tensor to transform
00075         //  from the body to the global reference frame, i.e.:
00076         //  globalVector = Q_ & bodyLocalVector
00077         //  bodyLocalVector = Q_.T() & globalVector
00078         tensor Q_;
00079 
00080         // Linear velocity of body
00081         vector v_;
00082 
00083         // Total linear acceleration of body
00084         vector a_;
00085 
00086         //- Angular momentum of body, in body local reference frame
00087         vector pi_;
00088 
00089         //- Total torque on body, in body local reference frame
00090         vector tau_;
00091 
00092 
00093 public:
00094 
00095     // Constructors
00096 
00097         //- Construct null
00098         sixDoFRigidBodyMotionState();
00099 
00100         //- Construct from components
00101         sixDoFRigidBodyMotionState
00102         (
00103             const point& centreOfMass,
00104             const tensor& Q,
00105             const vector& v,
00106             const vector& a,
00107             const vector& pi,
00108             const vector& tau
00109         );
00110 
00111         //- Construct from dictionary
00112         sixDoFRigidBodyMotionState(const dictionary& dict);
00113 
00114         //- Construct as copy
00115         sixDoFRigidBodyMotionState(const sixDoFRigidBodyMotionState&);
00116 
00117 
00118     //- Destructor
00119     ~sixDoFRigidBodyMotionState();
00120 
00121 
00122     // Member Functions
00123 
00124         // Access
00125 
00126             //- Return access to the centre of mass
00127             inline const point& centreOfMass() const;
00128 
00129             //- Return access to the orientation
00130             inline const tensor& Q() const;
00131 
00132             //- Return access to velocity
00133             inline const vector& v() const;
00134 
00135             //- Return access to acceleration
00136             inline const vector& a() const;
00137 
00138             //- Return access to angular momentum
00139             inline const vector& pi() const;
00140 
00141             //- Return access to torque
00142             inline const vector& tau() const;
00143 
00144 
00145         // Edit
00146 
00147             //- Return non-const access to the centre of mass
00148             inline point& centreOfMass();
00149 
00150             //- Return non-const access to the orientation
00151             inline tensor& Q();
00152 
00153             //- Return non-const access to vector
00154             inline vector& v();
00155 
00156             //- Return non-const access to acceleration
00157             inline vector& a();
00158 
00159             //- Return non-const access to angular momentum
00160             inline vector& pi();
00161 
00162             //- Return non-const access to torque
00163             inline vector& tau();
00164 
00165 
00166         //- Write
00167         void write(Ostream&) const;
00168 
00169 
00170     // Friend Functions
00171 
00172     // Friend Operators
00173 
00174     // IOstream Operators
00175 
00176         friend Istream& operator>>(Istream&, sixDoFRigidBodyMotionState&);
00177         friend Ostream& operator<<(Ostream&, const sixDoFRigidBodyMotionState&);
00178 };
00179 
00180 
00181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00182 
00183 } // End namespace Foam
00184 
00185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00186 
00187 #include "sixDoFRigidBodyMotionStateI.H"
00188 
00189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00190 
00191 #endif
00192 
00193 // ************************************************************************* //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines