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  Copyright (C) 2023 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Namespace
28  Foam::sixDoFRigidBodyMotionConstraints
29 
30 Description
31  Namespace for six DoF motion constraints
32 
33 
34 Class
35  Foam::sixDoFRigidBodyMotionConstraint
36 
37 Description
38  Base class for defining constraints for sixDoF motions
39 
40 SourceFiles
41  sixDoFRigidBodyMotionConstraint.C
42  sixDoFRigidBodyMotionConstraintNew.C
43 
44 \*---------------------------------------------------------------------------*/
45 
46 #ifndef sixDoFRigidBodyMotionConstraint_H
47 #define sixDoFRigidBodyMotionConstraint_H
48 
49 #include "Time.H"
50 #include "dictionary.H"
51 #include "autoPtr.H"
52 #include "point.H"
53 #include "pointConstraint.H"
54 #include "runTimeSelectionTables.H"
55 
56 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 
58 namespace Foam
59 {
60 
61 // Forward declaration of classes
62 class sixDoFRigidBodyMotion;
63 
64 
65 /*---------------------------------------------------------------------------*\
66  Class sixDoFRigidBodyMotionConstraint Declaration
67 \*---------------------------------------------------------------------------*/
68 
70 {
71 
72 protected:
73 
74  // Protected data
75 
76  //- Name of the constraint
77  word name_;
78 
79  //- Constraint model specific coefficient dictionary
81 
82  //- Reference to the body motion
84 
85 
86 public:
87 
88  //- Runtime type information
89  TypeName("sixDoFRigidBodyMotionConstraint");
90 
91 
92  // Declare run-time constructor selection table
93 
95  (
96  autoPtr,
98  dictionary,
99  (
100  const word& name,
101  const dictionary& sDoFRBMCDict,
103  ),
104  (name, sDoFRBMCDict, motion)
105  );
106 
107 
108  // Constructors
109 
110  //- Construct from the sDoFRBMCDict dictionary and Time
112  (
113  const word& name,
114  const dictionary& sDoFRBMCDict,
116  );
117 
118  //- Construct and return a clone
120 
121 
122  // Selectors
123 
124  //- Select constructed from the sDoFRBMCDict dictionary and Time
126  (
127  const word& name,
128  const dictionary& sDoFRBMCDict,
130  );
131 
132 
133  //- Destructor
135 
136 
137  // Member Functions
138 
139  //- Return the name
140  const word& name() const
141  {
142  return name_;
143  }
144 
145  //- Set the centre of rotation if not the centre of mass
146  virtual void setCentreOfRotation(point&) const
147  {}
148 
149  //- Apply and accumulate translational constraints
150  virtual void constrainTranslation(pointConstraint&) const = 0;
151 
152  //- Apply and accumulate rotational constraints
153  virtual void constrainRotation(pointConstraint&) const = 0;
155  //- Update properties from given dictionary
156  virtual bool read(const dictionary& sDoFRBMCDict);
157 
158  // Access
159 
160  // Return access to sDoFRBMCCoeffs
161  inline const dictionary& coeffDict() const
162  {
163  return sDoFRBMCCoeffs_;
164  }
165 
166  //- Return const access to motion
167  const sixDoFRigidBodyMotion& motion() const noexcept { return motion_; }
168 
169 
170  // I-O
171 
172  //- Write
173  virtual void write(Ostream&) const;
174 };
175 
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 } // End namespace Foam
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 #endif
184 
185 // ************************************************************************* //
Six degree of freedom motion for a rigid body.
const sixDoFRigidBodyMotion & motion() const noexcept
Return const access to motion.
const word & name() const
Return the name.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
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 Foam::string.
Definition: word.H:63
const sixDoFRigidBodyMotion & motion_
Reference to the body motion.
const direction noexcept
Definition: Scalar.H:258
virtual bool read(const dictionary &sDoFRBMCDict)
Update properties from given dictionary.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
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))
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
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.