sixDoFRigidBodyMotionState.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
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 "vector.H"
43 #include "point.H"
44 #include "diagTensor.H"
45 #include "tensor.H"
46 #include "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 centreOfRotation_;
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 dictionary
102 
103 
104  //- Destructor
106 
107 
108  // Member Functions
109 
110  // Access
111 
112  //- Return access to the centre of mass
113  inline const point& centreOfRotation() const;
114 
115  //- Return access to the orientation
116  inline const tensor& Q() const;
117 
118  //- Return access to velocity
119  inline const vector& v() const;
120 
121  //- Return access to acceleration
122  inline const vector& a() const;
123 
124  //- Return access to angular momentum
125  inline const vector& pi() const;
126 
127  //- Return access to torque
128  inline const vector& tau() const;
129 
130 
131  // Edit
132 
133  //- Return non-const access to the centre of mass
134  inline point& centreOfRotation();
135 
136  //- Return non-const access to the orientation
137  inline tensor& Q();
138 
139  //- Return non-const access to vector
140  inline vector& v();
141 
142  //- Return non-const access to acceleration
143  inline vector& a();
144 
145  //- Return non-const access to angular momentum
146  inline vector& pi();
147 
148  //- Return non-const access to torque
149  inline vector& tau();
150 
151 
152  //- Write to dictionary
153  void write(dictionary& dict) const;
154 
155  //- Write to stream
156  void write(Ostream&) const;
157 
158 
159  // IOstream Operators
160 
163 };
164 
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 } // End namespace Foam
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 #endif
177 
178 // ************************************************************************* //
dictionary dict
const vector & a() const
Return access to acceleration.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
void write(dictionary &dict) const
Write to dictionary.
const vector & v() const
Return access to velocity.
friend Istream & operator>>(Istream &, sixDoFRigidBodyMotionState &)
const vector & tau() const
Return access to torque.
const point & centreOfRotation() const
Return access to the centre of mass.
const vector & pi() const
Return access to angular momentum.
Istream & operator>>(Istream &, directionInfo &)
Holds the motion state of sixDoF object. Wrapped up together to allow rapid scatter to other processo...
friend Ostream & operator<<(Ostream &, const sixDoFRigidBodyMotionState &)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
const tensor & Q() const
Return access to the orientation.
Ostream & operator<<(Ostream &, const ensightPart &)
Namespace for OpenFOAM.