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 sixDoFRigidBodyMotionState;
58 Istream& operator>>(Istream&, sixDoFRigidBodyMotionState&);
59 Ostream& operator<<(Ostream&, const sixDoFRigidBodyMotionState&);
60 
61 
62 /*---------------------------------------------------------------------------*\
63  Class sixDoFRigidBodyMotionState Declaration
64 \*---------------------------------------------------------------------------*/
65 
67 {
68  // Private Data
69 
70  //- Current position of the centre of mass of the body
71  point centreOfRotation_;
72 
73  //- Orientation, stored as the rotation tensor to transform
74  //- from the body to the global reference frame
75  // 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  //- Default construct, zero-initialized with identity transformation
99 
100  //- Construct from dictionary
102 
103 
104  // Member Functions
105 
106  // Access
107 
108  //- Return access to the centre of mass
109  inline const point& centreOfRotation() const;
110 
111  //- Return access to the orientation
112  inline const tensor& Q() const;
113 
114  //- Return access to velocity
115  inline const vector& v() const;
116 
117  //- Return access to acceleration
118  inline const vector& a() const;
119 
120  //- Return access to angular momentum
121  inline const vector& pi() const;
122 
123  //- Return access to torque
124  inline const vector& tau() const;
125 
126 
127  // Edit
128 
129  //- Return non-const access to the centre of mass
130  inline point& centreOfRotation();
131 
132  //- Return non-const access to the orientation
133  inline tensor& Q();
134 
135  //- Return non-const access to vector
136  inline vector& v();
137 
138  //- Return non-const access to acceleration
139  inline vector& a();
140 
141  //- Return non-const access to angular momentum
142  inline vector& pi();
143 
144  //- Return non-const access to torque
145  inline vector& tau();
146 
147 
148  //- Write to dictionary
149  void write(dictionary& dict) const;
150 
151  //- Write to stream
152  void write(Ostream& os) const;
153 
154 
155  // IOstream Operators
156 
159 };
160 
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 } // End namespace Foam
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 #endif
173 
174 // ************************************************************************* //
dictionary dict
const vector & a() const
Return access to acceleration.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
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.
sixDoFRigidBodyMotionState()
Default construct, zero-initialized with identity transformation.
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:56
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
OBJstream os(runTime.globalPath()/outputName)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:77
const tensor & Q() const
Return access to the orientation.
Tensor of scalars, i.e. Tensor<scalar>.
Namespace for OpenFOAM.