sixDoFRigidBodyState.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) 2017-2024 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::functionObjects::sixDoFRigidBodyState
26 
27 Description
28  Writes the 6-DoF motion state.
29 
30 Usage
31  \table
32  Property | Description | Required | Default value
33  type | type name: sixDoFRigidBodyState | yes |
34  angleUnits | units in which angles are written \\
35  | no | [rad]
36  angularVelocityUnits | units in which angular velocities are written \\
37  | no | [rad/s]
38  \endtable
39 
40  Example of function object specification:
41  \verbatim
42  sixDoFRigidBodyState
43  {
44  type sixDoFRigidBodyState;
45  libs ("libsixDoFRigidBodyState.so");
46  angleUnits [deg];
47  angularVelocityUnits [rpm];
48  }
49  \endverbatim
50 
51 See also
52  Foam::functionObjects::fvMeshFunctionObject
53  Foam::functionObjects::logFiles
54 
55 SourceFiles
56  sixDoFRigidBodyState.C
57 
58 \*---------------------------------------------------------------------------*/
59 
60 #ifndef sixDoFRigidBodyState_H
61 #define sixDoFRigidBodyState_H
62 
63 #include "fvMeshFunctionObject.H"
64 #include "logFiles.H"
65 #include "namedUnitConversion.H"
66 #include "sixDoFRigidBodyMotion.H"
67 
68 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
69 
70 namespace Foam
71 {
72 namespace functionObjects
73 {
74 
75 /*---------------------------------------------------------------------------*\
76  Class sixDoFRigidBodyState Declaration
77 \*---------------------------------------------------------------------------*/
78 
79 class sixDoFRigidBodyState
80 :
81  public fvMeshFunctionObject,
82  public logFiles
83 {
84  // Private Data
85 
86  //- Units in which to write the angles
87  namedUnitConversion angleUnits_;
88 
89  //- Units in which to write the angular velocities
90  namedUnitConversion angularVelocityUnits_;
91 
92 
93  // Private Member Functions
94 
95  const sixDoFRigidBodyMotion& motion() const;
96 
97 
98 protected:
99 
100  // Protected Member Functions
101 
102  //- overloaded writeFileHeader from writeFile
103  virtual void writeFileHeader(const label i = 0);
104 
105 
106 public:
107 
108  //- Runtime type information
109  TypeName("sixDoFRigidBodyState");
110 
111 
112  // Constructors
113 
114  //- Construct from Time and dictionary
116  (
117  const word& name,
118  const Time& runTime,
119  const dictionary& dict
120  );
121 
122  //- Disallow default bitwise copy construction
124 
125 
126  //- Destructor
127  virtual ~sixDoFRigidBodyState();
128 
129 
130  // Member Functions
131 
132  //- Return the current body velocity
133  vector velocity() const;
134 
135  //- Return the current body angular velocity
136  vector angularVelocity() const;
137 
138  //- Return the units in which to write the angular velocities
139  const unitConversion& angularVelocityUnits() const;
140 
141  //- Read the sixDoFRigidBodyState data
142  virtual bool read(const dictionary&);
143 
144  //- Return the list of fields required
145  virtual wordList fields() const
146  {
147  return wordList::null();
148  }
149 
150  //- Execute, currently does nothing
151  virtual bool execute();
152 
153  //- Write the sixDoFRigidBodyState
154  virtual bool write();
155 
156 
157  // Member Operators
158 
159  //- Disallow default bitwise assignment
160  void operator=(const sixDoFRigidBodyState&) = delete;
161 };
162 
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 } // End namespace functionObjects
167 } // End namespace Foam
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 #endif
172 
173 // ************************************************************************* //
static const List< word > & null()
Return a null List.
Definition: ListI.H:118
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
const word & name() const
Return the name of this functionObject.
vector velocity() const
Return the current body velocity.
void operator=(const sixDoFRigidBodyState &)=delete
Disallow default bitwise assignment.
virtual wordList fields() const
Return the list of fields required.
vector angularVelocity() const
Return the current body angular velocity.
TypeName("sixDoFRigidBodyState")
Runtime type information.
sixDoFRigidBodyState(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
const unitConversion & angularVelocityUnits() const
Return the units in which to write the angular velocities.
virtual void writeFileHeader(const label i=0)
overloaded writeFileHeader from writeFile
virtual bool execute()
Execute, currently does nothing.
virtual bool write()
Write the sixDoFRigidBodyState.
virtual bool read(const dictionary &)
Read the sixDoFRigidBodyState data.
Unit conversion structure. Contains the associated dimensions and the multiplier with which to conver...
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
dictionary dict