rigidBodyRestraint.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) 2016 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
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
26Namespace
27 Foam::RBD::restraints
28
29Description
30 Namespace for rigid-body dynamics restraints
31
32Class
33 Foam::RBD::restraint
34
35Description
36 Base class for defining restraints for rigid-body dynamics
37
38SourceFiles
39 rigidBodyRestraint.C
40 rigidBodyRestraintNew.C
41
42\*---------------------------------------------------------------------------*/
43
44#ifndef RBD_rigidBodyRestraint_H
45#define RBD_rigidBodyRestraint_H
46
47#include "dictionary.H"
48#include "autoPtr.H"
49#include "spatialVector.H"
50#include "point.H"
51#include "scalarField.H"
53#include "rigidBodyModelState.H"
54
55// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56
57namespace Foam
58{
59namespace RBD
60{
61
62// Forward declaration of classes
63class rigidBodyModel;
64
65/*---------------------------------------------------------------------------*\
66 Class restraint Declaration
67\*---------------------------------------------------------------------------*/
69class restraint
70{
71
72protected:
73
74 // Protected data
75
76 //- Name of the restraint
77 word name_;
78
79 //- ID of the body the restraint is applied to
80 label bodyID_;
81
82 //- Index of the body the force is applied to
83 label bodyIndex_;
84
85 //- Restraint model specific coefficient dictionary
87
88 //- Reference to the model
90
91 //- Transform the given point on the restrained body to the global frame
92 inline point bodyPoint(const point& p) const;
93
94 //- Transform the velocity of the given point on the restrained body
95 // to the global frame
96 inline spatialVector bodyPointVelocity(const point& p) const;
97
98
99public:
100
101 //- Runtime type information
102 TypeName("restraint");
103
104
105 // Declare run-time constructor selection table
108 (
109 autoPtr,
110 restraint,
112 (
113 const word& name,
114 const dictionary& dict,
115 const rigidBodyModel& model
116 ),
117 (name, dict, model)
118 );
119
120
121 // Constructors
122
123 //- Construct from the dict dictionary and Time
125 (
126 const word& name,
127 const dictionary& dict,
128 const rigidBodyModel& model
129 );
130
131 //- Construct and return a clone
132 virtual autoPtr<restraint> clone() const = 0;
133
134
135 // Selectors
136
137 //- Select constructed from the dict dictionary and Time
139 (
140 const word& name,
141 const dictionary& dict,
142 const rigidBodyModel& model
143 );
144
145
146 //- Destructor
147 virtual ~restraint();
148
149
150 // Member Functions
151
152 //- Return the name
153 const word& name() const
154 {
155 return name_;
156 }
158 label bodyID() const
159 {
160 return bodyID_;
161 }
162
163 //- Accumulate the restraint internal joint forces into the tau field and
164 // external forces into the fx field
165 virtual void restrain
166 (
167 scalarField& tau,
169 const rigidBodyModelState& state
170 ) const = 0;
171
172 //- Update properties from given dictionary
173 virtual bool read(const dictionary& dict);
174
175 //- Return access to coeffs
176 const dictionary& coeffDict() const;
177
178 //- Write
179 virtual void write(Ostream&) const = 0;
180};
181
182
183// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184
185} // End namespace RBD
186} // End namespace Foam
187
188// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189
190#include "rigidBodyRestraintI.H"
191
192// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193
194#endif
195
196// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Base class for defining restraints for rigid-body dynamics.
label bodyID_
ID of the body the restraint is applied to.
virtual void restrain(scalarField &tau, Field< spatialVector > &fx, const rigidBodyModelState &state) const =0
Accumulate the restraint internal joint forces into the tau field and.
word name_
Name of the restraint.
const word & name() const
Return the name.
static autoPtr< restraint > New(const word &name, const dictionary &dict, const rigidBodyModel &model)
Select constructed from the dict dictionary and Time.
label bodyIndex_
Index of the body the force is applied to.
virtual bool read(const dictionary &dict)
Update properties from given dictionary.
virtual ~restraint()
Destructor.
dictionary coeffs_
Restraint model specific coefficient dictionary.
virtual autoPtr< restraint > clone() const =0
Construct and return a clone.
const dictionary & coeffDict() const
Return access to coeffs.
TypeName("restraint")
Runtime type information.
declareRunTimeSelectionTable(autoPtr, restraint, dictionary,(const word &name, const dictionary &dict, const rigidBodyModel &model),(name, dict, model))
point bodyPoint(const point &p) const
Transform the given point on the restrained body to the global frame.
spatialVector bodyPointVelocity(const point &p) const
Transform the velocity of the given point on the restrained body.
const rigidBodyModel & model_
Reference to the model.
Holds the motion state of rigid-body model.
Basic rigid-body model representing a system of rigid-bodies connected by 1-6 DoF joints.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A class for handling words, derived from Foam::string.
Definition: word.H:68
volScalarField & p
Namespace for OpenFOAM.
runTime write()
Macros to ease declaration of run-time selection tables.
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes)
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73