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