sixDoFRigidBodyMotionConstraint.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-2018 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::sixDoFRigidBodyMotionConstraints
26 
27 Description
28  Namespace for six DoF motion constraints
29 
30 
31 Class
32  Foam::sixDoFRigidBodyMotionConstraint
33 
34 Description
35  Base class for defining constraints for sixDoF motions
36 
37 SourceFiles
38  sixDoFRigidBodyMotionConstraint.C
39  sixDoFRigidBodyMotionConstraintNew.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef sixDoFRigidBodyMotionConstraint_H
44 #define sixDoFRigidBodyMotionConstraint_H
45 
46 #include "Time.H"
47 #include "dictionary.H"
48 #include "autoPtr.H"
49 #include "point.H"
50 #include "pointConstraint.H"
51 #include "runTimeSelectionTables.H"
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 namespace Foam
56 {
57 
58 // Forward declaration of classes
59 class sixDoFRigidBodyMotion;
60 
61 
62 /*---------------------------------------------------------------------------*\
63  Class sixDoFRigidBodyMotionConstraint Declaration
64 \*---------------------------------------------------------------------------*/
65 
67 {
68 
69 protected:
70 
71  // Protected data
72 
73  //- Name of the constraint
74  word name_;
75 
76  //- Constraint model specific coefficient dictionary
78 
79  //- Reference to the body motion
81 
82 
83 public:
84 
85  //- Runtime type information
86  TypeName("sixDoFRigidBodyMotionConstraint");
87 
88 
89  // Declare run-time constructor selection table
90 
92  (
93  autoPtr,
95  dictionary,
96  (
97  const word& name,
98  const dictionary& sDoFRBMCDict,
99  const sixDoFRigidBodyMotion& motion
100  ),
101  (name, sDoFRBMCDict, motion)
102  );
103 
104 
105  // Constructors
106 
107  //- Construct from the sDoFRBMCDict dictionary and Time
109  (
110  const word& name,
111  const dictionary& sDoFRBMCDict,
112  const sixDoFRigidBodyMotion& motion
113  );
114 
115  //- Construct and return a clone
117 
118 
119  // Selectors
120 
121  //- Select constructed from the sDoFRBMCDict dictionary and Time
123  (
124  const word& name,
125  const dictionary& sDoFRBMCDict,
126  const sixDoFRigidBodyMotion& motion
127  );
128 
129 
130  //- Destructor
132 
133 
134  // Member Functions
135 
136  //- Return the name
137  const word& name() const
138  {
139  return name_;
140  }
141 
142  //- Set the centre of rotation if not the centre of mass
143  virtual void setCentreOfRotation(point&) const
144  {}
145 
146  //- Apply and accumulate translational constraints
147  virtual void constrainTranslation(pointConstraint&) const = 0;
148 
149  //- Apply and accumulate rotational constraints
150  virtual void constrainRotation(pointConstraint&) const = 0;
151 
152  //- Update properties from given dictionary
153  virtual bool read(const dictionary& sDoFRBMCDict);
154 
155  // Access
156 
157  // Return access to sDoFRBMCCoeffs
158  inline const dictionary& coeffDict() const
159  {
160  return sDoFRBMCCoeffs_;
161  }
162 
163  //- Write
164  virtual void write(Ostream&) const;
165 };
166 
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 } // End namespace Foam
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 #endif
175 
176 // ************************************************************************* //
Six degree of freedom motion for a rigid body.
const word & name() const
Return the name.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Base class for defining constraints for sixDoF motions.
virtual void setCentreOfRotation(point &) const
Set the centre of rotation if not the centre of mass.
virtual void write(Ostream &) const
Write.
virtual void constrainTranslation(pointConstraint &) const =0
Apply and accumulate translational constraints.
A class for handling words, derived from string.
Definition: word.H:59
const sixDoFRigidBodyMotion & motion_
Reference to the body motion.
Accumulates point constraints through successive applications of the applyConstraint function...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual bool read(const dictionary &sDoFRBMCDict)
Update properties from given dictionary.
dictionary sDoFRBMCCoeffs_
Constraint model specific coefficient dictionary.
virtual void constrainRotation(pointConstraint &) const =0
Apply and accumulate rotational constraints.
virtual autoPtr< sixDoFRigidBodyMotionConstraint > clone() const =0
Construct and return a clone.
sixDoFRigidBodyMotionConstraint(const word &name, const dictionary &sDoFRBMCDict, const sixDoFRigidBodyMotion &motion)
Construct from the sDoFRBMCDict dictionary and Time.
TypeName("sixDoFRigidBodyMotionConstraint")
Runtime type information.
declareRunTimeSelectionTable(autoPtr, sixDoFRigidBodyMotionConstraint, dictionary,(const word &name, const dictionary &sDoFRBMCDict, const sixDoFRigidBodyMotion &motion),(name, sDoFRBMCDict, motion))
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
static autoPtr< sixDoFRigidBodyMotionConstraint > New(const word &name, const dictionary &sDoFRBMCDict, const sixDoFRigidBodyMotion &motion)
Select constructed from the sDoFRBMCDict dictionary and Time.
Macros to ease declaration of run-time selection tables.
Namespace for OpenFOAM.