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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2014 OpenFOAM Foundation
9 Copyright (C) 2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::sixDoFRigidBodyMotionState
29
30Description
31 Holds the motion state of sixDoF object. Wrapped up together
32 to allow rapid scatter to other processors. The processors must all
33 maintain exactly the same state data to avoid any drift or inconsistency.
34
35SourceFiles
36 sixDoFRigidBodyMotionStateI.H
37 sixDoFRigidBodyMotionState.C
38 sixDoFRigidBodyMotionStateIO.C
39
40\*---------------------------------------------------------------------------*/
41
42#ifndef sixDoFRigidBodyMotionState_H
43#define sixDoFRigidBodyMotionState_H
44
45#include "vector.H"
46#include "point.H"
47#include "diagTensor.H"
48#include "tensor.H"
49#include "dictionary.H"
50
51// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52
53namespace Foam
54{
55
56// Forward Declarations
57class Istream;
58class Ostream;
59class sixDoFRigidBodyMotionState;
60Istream& operator>>(Istream&, sixDoFRigidBodyMotionState&);
61Ostream& operator<<(Ostream&, const sixDoFRigidBodyMotionState&);
62
63
64/*---------------------------------------------------------------------------*\
65 Class sixDoFRigidBodyMotionState Declaration
66\*---------------------------------------------------------------------------*/
69{
70 // Private Data
71
72 //- Current position of the centre of mass of the body
73 point centreOfRotation_;
74
75 //- Orientation, stored as the rotation tensor to transform
76 //- from the body to the global reference frame
77 // i.e.:
78 // globalVector = Q_ & bodyLocalVector
79 // bodyLocalVector = Q_.T() & globalVector
80 tensor Q_;
81
82 //- Linear velocity of body
83 vector v_;
84
85 //- Total linear acceleration of body
86 vector a_;
87
88 //- Angular momentum of body, in body local reference frame
89 vector pi_;
90
91 //- Total torque on body, in body local reference frame
92 vector tau_;
93
94
95public:
96
97 // Constructors
98
99 //- Default construct, zero-initialized with identity transformation
101
102 //- Construct from dictionary
104
105
106 // Member Functions
107
108 // Access
109
110 //- Return access to the centre of mass
111 inline const point& centreOfRotation() const;
112
113 //- Return access to the orientation
114 inline const tensor& Q() const;
115
116 //- Return access to velocity
117 inline const vector& v() const;
118
119 //- Return access to acceleration
120 inline const vector& a() const;
121
122 //- Return access to angular momentum
123 inline const vector& pi() const;
124
125 //- Return access to torque
126 inline const vector& tau() const;
127
128
129 // Edit
130
131 //- Return non-const access to the centre of mass
132 inline point& centreOfRotation();
133
134 //- Return non-const access to the orientation
135 inline tensor& Q();
136
137 //- Return non-const access to vector
138 inline vector& v();
139
140 //- Return non-const access to acceleration
141 inline vector& a();
142
143 //- Return non-const access to angular momentum
144 inline vector& pi();
145
146 //- Return non-const access to torque
147 inline vector& tau();
148
149
150 //- Write to dictionary
151 void write(dictionary& dict) const;
152
153 //- Write to stream
154 void write(Ostream& os) const;
155
156
157 // IOstream Operators
161};
162
163
164// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165
166} // End namespace Foam
167
168// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169
171
172// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173
174#endif
175
176// ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Holds the motion state of sixDoF object. Wrapped up together to allow rapid scatter to other processo...
const tensor & Q() const
Return access to the orientation.
const vector & v() const
Return access to velocity.
friend Ostream & operator<<(Ostream &, const sixDoFRigidBodyMotionState &)
friend Istream & operator>>(Istream &, sixDoFRigidBodyMotionState &)
const vector & a() const
Return access to acceleration.
const vector & tau() const
Return access to torque.
sixDoFRigidBodyMotionState()
Default construct, zero-initialized with identity transformation.
const vector & pi() const
Return access to angular momentum.
const point & centreOfRotation() const
Return access to the centre of mass.
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Istream & operator>>(Istream &, directionInfo &)
runTime write()
dictionary dict