FreeFOAM The Cross-Platform CFD Toolkit
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) 2009-2010 OpenCFD Ltd.
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 <OpenFOAM/vector.H>
43 #include <OpenFOAM/point.H>
44 #include <OpenFOAM/diagTensor.H>
45 #include <OpenFOAM/tensor.H>
46 #include <OpenFOAM/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 centreOfMass_;
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 components
102  (
103  const point& centreOfMass,
104  const tensor& Q,
105  const vector& v,
106  const vector& a,
107  const vector& pi,
108  const vector& tau
109  );
110 
111  //- Construct from dictionary
113 
114  //- Construct as copy
116 
117 
118  //- Destructor
120 
121 
122  // Member Functions
123 
124  // Access
125 
126  //- Return access to the centre of mass
127  inline const point& centreOfMass() const;
128 
129  //- Return access to the orientation
130  inline const tensor& Q() const;
131 
132  //- Return access to velocity
133  inline const vector& v() const;
134 
135  //- Return access to acceleration
136  inline const vector& a() const;
137 
138  //- Return access to angular momentum
139  inline const vector& pi() const;
140 
141  //- Return access to torque
142  inline const vector& tau() const;
143 
144 
145  // Edit
146 
147  //- Return non-const access to the centre of mass
148  inline point& centreOfMass();
149 
150  //- Return non-const access to the orientation
151  inline tensor& Q();
152 
153  //- Return non-const access to vector
154  inline vector& v();
155 
156  //- Return non-const access to acceleration
157  inline vector& a();
158 
159  //- Return non-const access to angular momentum
160  inline vector& pi();
161 
162  //- Return non-const access to torque
163  inline vector& tau();
164 
165 
166  //- Write
167  void write(Ostream&) const;
168 
169 
170  // Friend Functions
171 
172  // Friend Operators
173 
174  // IOstream Operators
175 
178 };
179 
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 } // End namespace Foam
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 #endif
192 
193 // ************************************************************************* //