MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
rbk_impl.cc
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/base/rbk_impl.cc,v 1.12 2017/01/12 14:46:10 masarati Exp $ */
2 /*
3  * MBDyn (C) is a multibody analysis code.
4  * http://www.mbdyn.org
5  *
6  * Copyright (C) 1996-2017
7  *
8  * Pierangelo Masarati <masarati@aero.polimi.it>
9  * Paolo Mantegazza <mantegazza@aero.polimi.it>
10  *
11  * Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano
12  * via La Masa, 34 - 20156 Milano, Italy
13  * http://www.aero.polimi.it
14  *
15  * Changing this copyright notice is forbidden.
16  *
17  * This program is free software; you can redistribute it and/or modify
18  * it under the terms of the GNU General Public License as published by
19  * the Free Software Foundation (version 2 of the License).
20  *
21  *
22  * This program is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25  * GNU General Public License for more details.
26  *
27  * You should have received a copy of the GNU General Public License
28  * along with this program; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */
31 
32 /* Rigid body kinematics: structure, handling etc. */
33 
34 #include "mbconfig.h" /* This goes first in every *.c,*.cc file */
35 
36 #include "rbk_impl.h"
37 #include "Rot.hh"
38 
40 : X(Zero3), R(Eye3), V(Zero3), W(Zero3), XPP(Zero3), WP(Zero3)
41 {
42  NO_OP;
43 }
44 
46  const Mat3x3& R,
47  const Vec3& V,
48  const Vec3& W,
49  const Vec3& XPP,
50  const Vec3& WP)
51 : X(X), R(R), V(V), W(W), XPP(XPP), WP(WP)
52 {
53  NO_OP;
54 }
55 
57 {
58  NO_OP;
59 }
60 
61 const Vec3&
63 {
64  return X;
65 }
66 
67 const Mat3x3&
69 {
70  return R;
71 }
72 
73 const Vec3&
75 {
76  return V;
77 }
78 
79 const Vec3&
81 {
82  return W;
83 }
84 
85 const Vec3&
87 {
88  return XPP;
89 }
90 
91 const Vec3&
93 {
94  return WP;
95 }
96 
98  const TplDriveCaller<Vec3> *pXDrv,
99  const TplDriveCaller<Vec3> *pThetaDrv,
100  const TplDriveCaller<Vec3> *pVDrv,
101  const TplDriveCaller<Vec3> *pWDrv,
102  const TplDriveCaller<Vec3> *pXPPDrv,
103  const TplDriveCaller<Vec3> *pWPDrv)
104 : XDrv(pXDrv),
105 ThetaDrv(pThetaDrv),
106 VDrv(pVDrv),
107 WDrv(pWDrv),
108 XPPDrv(pXPPDrv),
109 WPDrv(pWPDrv)
110 {
111  Update();
112 }
113 
115 {
116  NO_OP;
117 }
118 
119 void
121 {
122  bool bR(false);
123 
124  if (ThetaDrv.pGetDriveCaller()) {
126  bR = true;
127  }
128 
129  if (XDrv.pGetDriveCaller()) {
130  if (bR) {
131  X = R.MulTV(XDrv.Get());
132 
133  } else {
134  X = XDrv.Get();
135  }
136  }
137 
138  if (VDrv.pGetDriveCaller()) {
139  if (bR) {
140  V = R.MulTV(VDrv.Get());
141 
142  } else {
143  V = VDrv.Get();
144  }
145  }
146 
147  if (WDrv.pGetDriveCaller()) {
148  if (bR) {
149  W = R.MulTV(WDrv.Get());
150 
151  } else {
152  W = WDrv.Get();
153  }
154  }
155 
156  if (XPPDrv.pGetDriveCaller()) {
157  if (bR) {
158  XPP = R.MulTV(XPPDrv.Get());
159 
160  } else {
161  XPP = XPPDrv.Get();
162  }
163  }
164 
165  if (WPDrv.pGetDriveCaller()) {
166  if (bR) {
167  WP = R.MulTV(WPDrv.Get());
168 
169  } else {
170  WP = WPDrv.Get();
171  }
172  }
173 }
virtual const Vec3 & GetW(void) const
Definition: rbk_impl.cc:80
const Vec3 Zero3(0., 0., 0.)
virtual ~ConstRigidBodyKinematics(void)
Definition: rbk_impl.cc:56
Definition: matvec3.h:98
TplDriveOwner< Vec3 > WPDrv
Definition: rbk_impl.h:73
const Mat3x3 Eye3(1., 0., 0., 0., 1., 0., 0., 0., 1.)
DriveRigidBodyKinematics(const TplDriveCaller< Vec3 > *pXDrv, const TplDriveCaller< Vec3 > *pThetaDrv, const TplDriveCaller< Vec3 > *pVDrv, const TplDriveCaller< Vec3 > *pWDrv, const TplDriveCaller< Vec3 > *pXPPDrv, const TplDriveCaller< Vec3 > *pWPDrv)
Definition: rbk_impl.cc:97
#define NO_OP
Definition: myassert.h:74
virtual const Vec3 & GetV(void) const
Definition: rbk_impl.cc:74
Vec3 MulTV(const Vec3 &v) const
Definition: matvec3.cc:482
virtual const Mat3x3 & GetR(void) const
Definition: rbk_impl.cc:68
TplDriveCaller< T > * pGetDriveCaller(void) const
Definition: tpldrive.h:105
virtual ~DriveRigidBodyKinematics(void)
Definition: rbk_impl.cc:114
virtual const Vec3 & GetWP(void) const
Definition: rbk_impl.cc:92
TplDriveOwner< Vec3 > XPPDrv
Definition: rbk_impl.h:72
virtual const Vec3 & GetX(void) const
Definition: rbk_impl.cc:62
T Get(const doublereal &dVar) const
Definition: tpldrive.h:109
virtual const Vec3 & GetXPP(void) const
Definition: rbk_impl.cc:86
Mat3x3 Rot(const Vec3 &phi)
Definition: Rot.cc:62
TplDriveOwner< Vec3 > VDrv
Definition: rbk_impl.h:70
TplDriveOwner< Vec3 > XDrv
Definition: rbk_impl.h:68
TplDriveOwner< Vec3 > ThetaDrv
Definition: rbk_impl.h:69
TplDriveOwner< Vec3 > WDrv
Definition: rbk_impl.h:71
virtual void Update(void)
Definition: rbk_impl.cc:120
Mat3x3 R