sixDoFRigidBodyMotionRestraint.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 Namespace
25  Foam::sixDoFRigidBodyMotionRestraints
26 
27 Description
28  Namespace for six DoF motion restraints
29 
30 
31 Class
32  Foam::sixDoFRigidBodyMotionRestraint
33 
34 Description
35  Base class for defining restraints for sixDoF motions
36 
37 SourceFiles
38  sixDoFRigidBodyMotionRestraint.C
39  sixDoFRigidBodyMotionRestraintNew.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef sixDoFRigidBodyMotionRestraint_H
44 #define sixDoFRigidBodyMotionRestraint_H
45 
46 #include "Time.H"
47 #include "dictionary.H"
48 #include "autoPtr.H"
49 #include "vector.H"
50 #include "runTimeSelectionTables.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 // Forward declaration of classes
58 class sixDoFRigidBodyMotion;
59 
60 
61 /*---------------------------------------------------------------------------*\
62  Class sixDoFRigidBodyMotionRestraint Declaration
63 \*---------------------------------------------------------------------------*/
64 
66 {
67 
68 protected:
69 
70  // Protected data
71 
72  //- Name of the restraint
73  word name_;
74 
75  //- Restraint model specific coefficient dictionary
77 
78 
79 public:
80 
81  //- Runtime type information
82  TypeName("sixDoFRigidBodyMotionRestraint");
83 
84 
85  // Declare run-time constructor selection table
86 
88  (
89  autoPtr,
91  dictionary,
92  (const word& name, const dictionary& sDoFRBMRDict),
93  (name, sDoFRBMRDict)
94  );
95 
96 
97  // Constructors
98 
99  //- Construct from the sDoFRBMRDict dictionary and Time
101  (
102  const word& name,
103  const dictionary& sDoFRBMRDict
104  );
105 
106  //- Construct and return a clone
108 
109 
110  // Selectors
111 
112  //- Select constructed from the sDoFRBMRDict dictionary and Time
114  (
115  const word& name,
116  const dictionary& sDoFRBMRDict
117  );
118 
119 
120  //- Destructor
122 
123 
124  // Member Functions
125 
126  //- Return the name
127  const word& name() const
128  {
129  return name_;
130  }
131 
132  //- Calculate the restraint position, force and moment.
133  // Global reference frame vectors.
134  virtual void restrain
135  (
136  const sixDoFRigidBodyMotion& motion,
137  vector& restraintPosition,
138  vector& restraintForce,
139  vector& restraintMoment
140  ) const = 0;
141 
142  //- Update properties from given dictionary
143  virtual bool read(const dictionary& sDoFRBMRDict);
144 
145  // Access
146 
147  // Return access to sDoFRBMRCoeffs
148  inline const dictionary& coeffDict() const
149  {
150  return sDoFRBMRCoeffs_;
151  }
152 
153  //- Write
154  virtual void write(Ostream&) const = 0;
155 };
156 
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 } // End namespace Foam
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 #endif
165 
166 // ************************************************************************* //
Six degree of freedom motion for a rigid body.
dictionary sDoFRBMRCoeffs_
Restraint model specific coefficient dictionary.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
Base class for defining restraints for sixDoF motions.
virtual autoPtr< sixDoFRigidBodyMotionRestraint > clone() const =0
Construct and return a clone.
virtual void restrain(const sixDoFRigidBodyMotion &motion, vector &restraintPosition, vector &restraintForce, vector &restraintMoment) const =0
Calculate the restraint position, force and moment.
A class for handling words, derived from string.
Definition: word.H:59
virtual bool read(const dictionary &sDoFRBMRDict)
Update properties from given dictionary.
sixDoFRigidBodyMotionRestraint(const word &name, const dictionary &sDoFRBMRDict)
Construct from the sDoFRBMRDict dictionary and Time.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
static autoPtr< sixDoFRigidBodyMotionRestraint > New(const word &name, const dictionary &sDoFRBMRDict)
Select constructed from the sDoFRBMRDict dictionary and Time.
const word & name() const
Return the name.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
virtual void write(Ostream &) const =0
Write.
Macros to ease declaration of run-time selection tables.
TypeName("sixDoFRigidBodyMotionRestraint")
Runtime type information.
Namespace for OpenFOAM.
declareRunTimeSelectionTable(autoPtr, sixDoFRigidBodyMotionRestraint, dictionary,(const word &name, const dictionary &sDoFRBMRDict),(name, sDoFRBMRDict))