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 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::sixDoFRigidBodyMotionState
29 
30 Description
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 
35 SourceFiles
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 
53 namespace Foam
54 {
55 
56 // Forward Declarations
57 class Istream;
58 class Ostream;
59 class sixDoFRigidBodyMotionState;
60 Istream& operator>>(Istream&, sixDoFRigidBodyMotionState&);
61 Ostream& operator<<(Ostream&, const sixDoFRigidBodyMotionState&);
62 
63 
64 /*---------------------------------------------------------------------------*\
65  Class sixDoFRigidBodyMotionState Declaration
66 \*---------------------------------------------------------------------------*/
67 
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 
95 public:
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
158 
161 };
162 
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 } // End namespace Foam
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 #endif
175 
176 // ************************************************************************* //
Foam::sixDoFRigidBodyMotionState::operator<<
friend Ostream & operator<<(Ostream &, const sixDoFRigidBodyMotionState &)
Foam::sixDoFRigidBodyMotionState::pi
const vector & pi() const
Return access to angular momentum.
Definition: sixDoFRigidBodyMotionStateI.H:55
Foam::Tensor< scalar >
point.H
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:230
tensor.H
Foam::sixDoFRigidBodyMotionState::Q
const tensor & Q() const
Return access to the orientation.
Definition: sixDoFRigidBodyMotionStateI.H:37
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
sixDoFRigidBodyMotionStateI.H
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::sixDoFRigidBodyMotionState::a
const vector & a() const
Return access to acceleration.
Definition: sixDoFRigidBodyMotionStateI.H:49
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::sixDoFRigidBodyMotionState
Holds the motion state of sixDoF object. Wrapped up together to allow rapid scatter to other processo...
Definition: sixDoFRigidBodyMotionState.H:67
Foam::sixDoFRigidBodyMotionState::write
void write(dictionary &dict) const
Write to dictionary.
Definition: sixDoFRigidBodyMotionStateIO.C:33
Foam::sixDoFRigidBodyMotionState::operator>>
friend Istream & operator>>(Istream &, sixDoFRigidBodyMotionState &)
Foam::sixDoFRigidBodyMotionState::v
const vector & v() const
Return access to velocity.
Definition: sixDoFRigidBodyMotionStateI.H:43
Foam::Vector< scalar >
Foam::sixDoFRigidBodyMotionState::tau
const vector & tau() const
Return access to torque.
Definition: sixDoFRigidBodyMotionStateI.H:61
dictionary.H
vector.H
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::sixDoFRigidBodyMotionState::sixDoFRigidBodyMotionState
sixDoFRigidBodyMotionState()
Default construct, zero-initialized with identity transformation.
Definition: sixDoFRigidBodyMotionState.C:33
diagTensor.H
Foam::sixDoFRigidBodyMotionState::centreOfRotation
const point & centreOfRotation() const
Return access to the centre of mass.
Definition: sixDoFRigidBodyMotionStateI.H:31