Rs.C
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) 2016-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 \*---------------------------------------------------------------------------*/
25 
26 #include "Rs.H"
27 #include "rigidBodyModelState.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace RBD
35 {
36 namespace joints
37 {
39 
41  (
42  joint,
43  Rs,
44  dictionary
45  );
46 }
47 }
48 }
49 
50 
51 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
52 
54 :
55  joint(model, 3)
56 {
57  S_[0] = spatialVector(1, 0, 0, 0, 0, 0);
58  S_[1] = spatialVector (0, 1, 0, 0, 0, 0);
59  S_[2] = spatialVector(0, 0, 1, 0, 0, 0);
60 }
61 
62 
64 :
65  joint(model, 3)
66 {
67  S_[0] = spatialVector(1, 0, 0, 0, 0, 0);
68  S_[1] = spatialVector (0, 1, 0, 0, 0, 0);
69  S_[2] = spatialVector(0, 0, 1, 0, 0, 0);
70 }
71 
72 
74 {
75  return autoPtr<joint>(new Rs(*this));
76 }
77 
78 
79 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
80 
82 {}
83 
84 
85 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
86 
88 {
89  return true;
90 }
91 
92 
94 (
95  joint::XSvc& J,
96  const rigidBodyModelState& state
97 ) const
98 {
99  J.X.E() = joint::unitQuaternion(state.q()).R().T();
100  J.X.r() = Zero;
101 
102  J.S = Zero;
103  J.S.xx() = 1;
104  J.S.yy() = 1;
105  J.S.zz() = 1;
106 
107  J.v = spatialVector(state.qDot().block<vector>(qIndex_), Zero);
108  J.c = Zero;
109 }
110 
111 
112 // ************************************************************************* //
Abstract base-class for all rigid-body joints.
Definition: joint.H:80
dictionary dict
virtual bool unitQuaternion() const
Return true as this joint describes rotation using a quaternion.
Definition: Rs.C:87
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
spatialVector v
The constrained joint velocity.
Definition: joint.H:137
label qIndex_
Index of this joints data in the rigidBodyModel state.
Definition: joint.H:97
compactSpatialTensor S
The joint motion sub-space (3-DoF)
Definition: joint.H:131
const Cmpt & xx() const
Definition: MatrixSpaceI.H:148
Rs(const rigidBodyModel &model)
Construct for given model.
Definition: Rs.C:53
defineTypeNameAndDebug(composite, 0)
addToRunTimeSelectionTable(joint, composite, dictionary)
spatialVector c
The constrained joint acceleration correction.
Definition: joint.H:141
const vector & r() const
Return the translation vector.
Macros for easy insertion into run-time selection tables.
Holds the motion state of rigid-body model.
Joint state returned by jcalc.
Definition: joint.H:123
virtual ~Rs()
Destructor.
Definition: Rs.C:81
const scalarField & q() const
Return access to the joint position and orientation.
SpatialVector< scalar > spatialVector
SpatialVector of scalars.
Definition: spatialVector.H:47
const scalarField & qDot() const
Return access to the joint velocity.
static const zero Zero
Definition: zero.H:97
VSForm block(const label start) const
Definition: Field.C:489
List< spatialVector > S_
Joint motion sub-space.
Definition: joint.H:91
spatialTransform X
The joint transformation.
Definition: joint.H:128
const tensor & E() const
Return the rotation tensor.
#define R(A, B, C, D, E, F, K, M)
const Cmpt & yy() const
Definition: MatrixSpaceI.H:204
virtual void jcalc(joint::XSvc &J, const rigidBodyModelState &state) const
Update the model state for this joint.
Definition: Rs.C:94
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Basic rigid-body model representing a system of rigid-bodies connected by 1-6 DoF joints...
virtual autoPtr< joint > clone() const
Clone this joint.
Definition: Rs.C:73
const Cmpt & zz() const
Definition: MatrixSpaceI.H:260
virtual bool unitQuaternion() const
Return true if this joint describes rotation using a quaternion.
Definition: jointI.H:44
Namespace for OpenFOAM.