sixDoFRigidBodyMotionRestraint.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-2013 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Namespace
27  Foam::sixDoFRigidBodyMotionRestraints
28 
29 Description
30  Namespace for six DoF motion restraints
31 
32 
33 Class
34  Foam::sixDoFRigidBodyMotionRestraint
35 
36 Description
37  Base class for defining restraints for sixDoF motions
38 
39 SourceFiles
40  sixDoFRigidBodyMotionRestraint.C
41  sixDoFRigidBodyMotionRestraintNew.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef sixDoFRigidBodyMotionRestraint_H
46 #define sixDoFRigidBodyMotionRestraint_H
47 
48 #include "Time.H"
49 #include "dictionary.H"
50 #include "autoPtr.H"
51 #include "vector.H"
52 #include "runTimeSelectionTables.H"
53 
54 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 
56 namespace Foam
57 {
58 
59 // Forward declaration of classes
60 class sixDoFRigidBodyMotion;
61 
62 
63 /*---------------------------------------------------------------------------*\
64  Class sixDoFRigidBodyMotionRestraint Declaration
65 \*---------------------------------------------------------------------------*/
66 
68 {
69 
70 protected:
71 
72  // Protected data
73 
74  //- Name of the restraint
75  word name_;
76 
77  //- Restraint model specific coefficient dictionary
79 
80 
81 public:
82 
83  //- Runtime type information
84  TypeName("sixDoFRigidBodyMotionRestraint");
85 
86 
87  // Declare run-time constructor selection table
88 
90  (
91  autoPtr,
93  dictionary,
94  (const word& name, const dictionary& sDoFRBMRDict),
95  (name, sDoFRBMRDict)
96  );
97 
98 
99  // Constructors
100 
101  //- Construct from the sDoFRBMRDict dictionary and Time
103  (
104  const word& name,
105  const dictionary& sDoFRBMRDict
106  );
107 
108  //- Construct and return a clone
110 
111 
112  // Selectors
113 
114  //- Select constructed from the sDoFRBMRDict dictionary and Time
116  (
117  const word& name,
118  const dictionary& sDoFRBMRDict
119  );
120 
121 
122  //- Destructor
124 
125 
126  // Member Functions
127 
128  //- Return the name
129  const word& name() const
130  {
131  return name_;
132  }
133 
134  //- Calculate the restraint position, force and moment.
135  // Global reference frame vectors.
136  virtual void restrain
137  (
138  const sixDoFRigidBodyMotion& motion,
139  vector& restraintPosition,
140  vector& restraintForce,
141  vector& restraintMoment
142  ) const = 0;
143 
144  //- Update properties from given dictionary
145  virtual bool read(const dictionary& sDoFRBMRDict);
146 
147  // Access
148 
149  // Return access to sDoFRBMRCoeffs
150  inline const dictionary& coeffDict() const
151  {
152  return sDoFRBMRCoeffs_;
153  }
154 
155  //- Write
156  virtual void write(Ostream&) const = 0;
157 };
158 
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 } // End namespace Foam
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 #endif
167 
168 // ************************************************************************* //
Foam::sixDoFRigidBodyMotionRestraint::read
virtual bool read(const dictionary &sDoFRBMRDict)
Update properties from given dictionary.
Definition: sixDoFRigidBodyMotionRestraint.C:61
Foam::sixDoFRigidBodyMotionRestraint::name
const word & name() const
Return the name.
Definition: sixDoFRigidBodyMotionRestraint.H:128
Foam::sixDoFRigidBodyMotionRestraint::coeffDict
const dictionary & coeffDict() const
Definition: sixDoFRigidBodyMotionRestraint.H:149
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::sixDoFRigidBodyMotionRestraint::restrain
virtual void restrain(const sixDoFRigidBodyMotion &motion, vector &restraintPosition, vector &restraintForce, vector &restraintMoment) const =0
Calculate the restraint position, force and moment.
Foam::sixDoFRigidBodyMotionRestraint::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, sixDoFRigidBodyMotionRestraint, dictionary,(const word &name, const dictionary &sDoFRBMRDict),(name, sDoFRBMRDict))
Foam::sixDoFRigidBodyMotionRestraint::sixDoFRigidBodyMotionRestraint
sixDoFRigidBodyMotionRestraint(const word &name, const dictionary &sDoFRBMRDict)
Construct from the sDoFRBMRDict dictionary and Time.
Definition: sixDoFRigidBodyMotionRestraint.C:42
Foam::sixDoFRigidBodyMotionRestraint::clone
virtual autoPtr< sixDoFRigidBodyMotionRestraint > clone() const =0
Construct and return a clone.
Foam::sixDoFRigidBodyMotionRestraint::name_
word name_
Name of the restraint.
Definition: sixDoFRigidBodyMotionRestraint.H:74
Foam::sixDoFRigidBodyMotionRestraint
Base class for defining restraints for sixDoF motions.
Definition: sixDoFRigidBodyMotionRestraint.H:66
Foam::sixDoFRigidBodyMotionRestraint::sDoFRBMRCoeffs_
dictionary sDoFRBMRCoeffs_
Restraint model specific coefficient dictionary.
Definition: sixDoFRigidBodyMotionRestraint.H:77
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::sixDoFRigidBodyMotionRestraint::write
virtual void write(Ostream &) const =0
Write.
Time.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::sixDoFRigidBodyMotion
Six degree of freedom motion for a rigid body.
Definition: sixDoFRigidBodyMotion.H:69
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::Vector< scalar >
dictionary.H
Foam::sixDoFRigidBodyMotionRestraint::TypeName
TypeName("sixDoFRigidBodyMotionRestraint")
Runtime type information.
vector.H
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::sixDoFRigidBodyMotionRestraint::~sixDoFRigidBodyMotionRestraint
virtual ~sixDoFRigidBodyMotionRestraint()
Destructor.
Definition: sixDoFRigidBodyMotionRestraint.C:54
Foam::sixDoFRigidBodyMotionRestraint::New
static autoPtr< sixDoFRigidBodyMotionRestraint > New(const word &name, const dictionary &sDoFRBMRDict)
Select constructed from the sDoFRBMRDict dictionary and Time.
Definition: sixDoFRigidBodyMotionRestraintNew.C:35
autoPtr.H