MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
GimbalRotationJoint Class Reference

#include <gimbal.h>

Inheritance diagram for GimbalRotationJoint:
Collaboration diagram for GimbalRotationJoint:

Public Member Functions

 GimbalRotationJoint (unsigned int uL, const DofOwner *pDO, const StructNode *pN1, const StructNode *pN2, const Mat3x3 &R1, const Mat3x3 &R2, const OrientationDescription &od, flag fOut)
 
virtual ~GimbalRotationJoint (void)
 
virtual Joint::Type GetJointType (void) const
 
virtual std::ostream & Restart (std::ostream &out) const
 
virtual void Output (OutputHandler &OH) const
 
virtual unsigned int iGetNumDof (void) const
 
virtual DofOrder::Order GetDofType (unsigned int i) const
 
virtual DofOrder::Order GetEqType (unsigned int i) const
 
virtual void WorkSpaceDim (integer *piNumRows, integer *piNumCols) const
 
virtual VariableSubMatrixHandlerAssJac (VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual SubVectorHandlerAssRes (SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual void AfterPredict (VectorHandler &X, VectorHandler &XP)
 
virtual unsigned int iGetInitialNumDof (void) const
 
virtual void InitialWorkSpaceDim (integer *piNumRows, integer *piNumCols) const
 
virtual VariableSubMatrixHandlerInitialAssJac (VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
 
virtual SubVectorHandlerInitialAssRes (SubVectorHandler &WorkVec, const VectorHandler &XCurr)
 
virtual unsigned int iGetNumPrivData (void) const
 
virtual unsigned int iGetPrivDataIdx (const char *s) const
 
virtual doublereal dGetPrivData (unsigned int i=0) const
 
virtual void GetConnectedNodes (std::vector< const Node * > &connectedNodes) const
 
- Public Member Functions inherited from Elem
 Elem (unsigned int uL, flag fOut)
 
virtual ~Elem (void)
 
virtual std::ostream & DescribeDof (std::ostream &out, const char *prefix="", bool bInitial=false) const
 
virtual void DescribeDof (std::vector< std::string > &desc, bool bInitial=false, int i=-1) const
 
virtual std::ostream & DescribeEq (std::ostream &out, const char *prefix="", bool bInitial=false) const
 
virtual void DescribeEq (std::vector< std::string > &desc, bool bInitial=false, int i=-1) const
 
virtual void AssMats (VariableSubMatrixHandler &WorkMatA, VariableSubMatrixHandler &WorkMatB, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual bool bInverseDynamics (void) const
 
void SetInverseDynamicsFlags (unsigned uIDF)
 
unsigned GetInverseDynamicsFlags (void) const
 
bool bIsErgonomy (void) const
 
bool bIsRightHandSide (void) const
 
virtual VariableSubMatrixHandlerAssJac (VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
 
virtual SubVectorHandlerAssRes (SubVectorHandler &WorkVec, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr, const VectorHandler &XPrimePrimeCurr, InverseDynamics::Order iOrder=InverseDynamics::INVERSE_DYNAMICS)
 
virtual int GetNumConnectedNodes (void) const
 
- Public Member Functions inherited from WithLabel
 WithLabel (unsigned int uL=0, const std::string &sN="")
 
virtual ~WithLabel (void)
 
void PutLabel (unsigned int uL)
 
void PutName (const std::string &sN)
 
unsigned int GetLabel (void) const
 
const std::string & GetName (void) const
 
- Public Member Functions inherited from SimulationEntity
 SimulationEntity (void)
 
virtual ~SimulationEntity (void)
 
virtual bool bIsValidIndex (unsigned int i) const
 
virtual HintParseHint (DataManager *pDM, const char *s) const
 
virtual void BeforePredict (VectorHandler &, VectorHandler &, VectorHandler &, VectorHandler &) const
 
virtual void Update (const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual void DerivativesUpdate (const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual void AfterConvergence (const VectorHandler &X, const VectorHandler &XP)
 
virtual void AfterConvergence (const VectorHandler &X, const VectorHandler &XP, const VectorHandler &XPP)
 
virtual std::ostream & OutputAppend (std::ostream &out) const
 
virtual void ReadInitialState (MBDynParser &HP)
 
- Public Member Functions inherited from ToBeOutput
 ToBeOutput (flag fOut=fDefaultOut)
 
virtual ~ToBeOutput (void)
 
virtual void OutputPrepare (OutputHandler &OH)
 
virtual void Output (OutputHandler &OH, const VectorHandler &X, const VectorHandler &XP) const
 
virtual flag fToBeOutput (void) const
 
virtual bool bToBeOutput (void) const
 
virtual void SetOutputFlag (flag f=flag(1))
 
- Public Member Functions inherited from Joint
 Joint (unsigned int uL, const DofOwner *pD, flag fOut)
 
virtual ~Joint (void)
 
virtual Elem::Type GetElemType (void) const
 
std::ostream & Output (std::ostream &out, const char *sJointName, unsigned int uLabel, const Vec3 &FLocal, const Vec3 &MLocal, const Vec3 &FGlobal, const Vec3 &MGlobal) const
 
virtual void SetInitialValue (VectorHandler &)
 
virtual void SetValue (DataManager *pDM, VectorHandler &, VectorHandler &, SimulationEntity::Hints *ph=0)
 
virtual void Update (const VectorHandler &XCurr, InverseDynamics::Order iOrder=InverseDynamics::INVERSE_DYNAMICS)
 
bool bIsPrescribedMotion (void) const
 
bool bIsTorque (void) const
 
- Public Member Functions inherited from ElemGravityOwner
 ElemGravityOwner (unsigned int uL, flag fOut)
 
virtual ~ElemGravityOwner (void)
 
virtual doublereal dGetM (void) const
 
Vec3 GetS (void) const
 
Mat3x3 GetJ (void) const
 
Vec3 GetB (void) const
 
Vec3 GetG (void) const
 
- Public Member Functions inherited from GravityOwner
 GravityOwner (void)
 
virtual ~GravityOwner (void)
 
void PutGravity (const Gravity *pG)
 
virtual bool bGetGravity (const Vec3 &X, Vec3 &Acc) const
 
- Public Member Functions inherited from ElemWithDofs
 ElemWithDofs (unsigned int uL, const DofOwner *pDO, flag fOut)
 
virtual ~ElemWithDofs (void)
 
- Public Member Functions inherited from DofOwnerOwner
 DofOwnerOwner (const DofOwner *pDO)
 
virtual ~DofOwnerOwner ()
 
virtual const DofOwnerpGetDofOwner (void) const
 
virtual integer iGetFirstIndex (void) const
 
- Public Member Functions inherited from InitialAssemblyElem
 InitialAssemblyElem (unsigned int uL, flag fOut)
 
virtual ~InitialAssemblyElem (void)
 
- Public Member Functions inherited from SubjectToInitialAssembly
 SubjectToInitialAssembly (void)
 
virtual ~SubjectToInitialAssembly (void)
 

Protected Member Functions

void AssMat (FullSubMatrixHandler &WM, doublereal dCoef)
 
void AssVec (SubVectorHandler &WorkVec, doublereal dCoef)
 
- Protected Member Functions inherited from Joint
virtual void OutputPrepare_int (const std::string &type, OutputHandler &OH, std::string &name)
 
- Protected Member Functions inherited from ElemGravityOwner
virtual Vec3 GetS_int (void) const
 
virtual Mat3x3 GetJ_int (void) const
 
virtual Vec3 GetB_int (void) const
 
virtual Vec3 GetG_int (void) const
 

Protected Attributes

const StructNodepNode1
 
const StructNodepNode2
 
const Mat3x3 R1h
 
const Mat3x3 R2h
 
Vec3 M
 
doublereal dTheta
 
doublereal dPhi
 
OrientationDescription od
 
- Protected Attributes inherited from WithLabel
unsigned int uLabel
 
std::string sName
 
- Protected Attributes inherited from ToBeOutput
flag fOutput
 
- Protected Attributes inherited from GravityOwner
GravitypGravity
 

Additional Inherited Members

- Public Types inherited from Elem
enum  Type {
  UNKNOWN = -1, AIRPROPERTIES = 0, INDUCEDVELOCITY, AUTOMATICSTRUCTURAL,
  GRAVITY, BODY, JOINT, JOINT_REGULARIZATION,
  BEAM, PLATE, FORCE, INERTIA,
  ELECTRICBULK, ELECTRIC, THERMAL, HYDRAULIC,
  BULK, LOADABLE, DRIVEN, EXTERNAL,
  AEROMODAL, AERODYNAMIC, GENEL, SOCKETSTREAM_OUTPUT,
  RTAI_OUTPUT = SOCKETSTREAM_OUTPUT, LASTELEMTYPE
}
 
- Public Types inherited from SimulationEntity
typedef std::vector< Hint * > Hints
 
- Public Types inherited from ToBeOutput
enum  { OUTPUT = 0x1U, OUTPUT_MASK = 0xFU, OUTPUT_PRIVATE = 0x10U, OUTPUT_PRIVATE_MASK = ~OUTPUT_MASK }
 
- Public Types inherited from Joint
enum  Type {
  UNKNOWN = -1, DISTANCE = 0, DISTANCEWITHOFFSET, CLAMP,
  SPHERICALHINGE, PIN, UNIVERSALHINGE, UNIVERSALROTATION,
  UNIVERSALPIN, PLANEHINGE, PLANEROTATION, PLANEPIN,
  AXIALROTATION, PLANEDISP, PLANEDISPPIN, INPLANE,
  INPLANECONTACT, J_INLINE, ROD, RODBEZIER,
  DEFORMABLEHINGE, DEFORMABLEDISPJOINT, DEFORMABLEJOINT, DEFORMABLEAXIALJOINT,
  VISCOUSBODY, LINEARVELOCITY, ANGULARVELOCITY, LINEARACCELERATION,
  ANGULARACCELERATION, PRISMATIC, DRIVEHINGE, DRIVEDISP,
  DRIVEDISPPIN, IMPOSEDORIENTATION, IMPOSEDDISP, IMPOSEDDISPPIN,
  IMPOSEDKINEMATICS, BEAMSLIDER, BRAKE, GIMBAL,
  POINT_SURFACE_CONTACT, TOTALJOINT, TOTALPINJOINT, TOTALEQUATION,
  TOTALREACTION, MODAL, SCREWJOINT, LASTJOINTTYPE
}
 

Detailed Description

Definition at line 43 of file gimbal.h.

Constructor & Destructor Documentation

GimbalRotationJoint::GimbalRotationJoint ( unsigned int  uL,
const DofOwner pDO,
const StructNode pN1,
const StructNode pN2,
const Mat3x3 R1,
const Mat3x3 R2,
const OrientationDescription od,
flag  fOut 
)

Definition at line 43 of file gimbal.cc.

References ASSERT, StructDispNode::GetNodeType(), pNode1, pNode2, and Node::STRUCTURAL.

51 : Elem(uL, fOut),
52 Joint(uL, pDO, fOut),
53 pNode1(pN1), pNode2(pN2), R1h(R1), R2h(R2),
54 M(Zero3), dTheta(0.), dPhi(0.), od(od)
55 {
56  ASSERT(pNode1 != NULL);
57  ASSERT(pNode2 != NULL);
60 }
const Vec3 Zero3(0., 0., 0.)
const StructNode * pNode1
Definition: gimbal.h:47
virtual Node::Type GetNodeType(void) const
Definition: strnode.cc:145
Joint(unsigned int uL, const DofOwner *pD, flag fOut)
Definition: joint.cc:83
const Mat3x3 R1h
Definition: gimbal.h:49
const StructNode * pNode2
Definition: gimbal.h:48
doublereal dTheta
Definition: gimbal.h:53
OrientationDescription od
Definition: gimbal.h:55
#define ASSERT(expression)
Definition: colamd.c:977
const Mat3x3 R2h
Definition: gimbal.h:50
Elem(unsigned int uL, flag fOut)
Definition: elem.cc:41
doublereal dPhi
Definition: gimbal.h:53

Here is the call graph for this function:

GimbalRotationJoint::~GimbalRotationJoint ( void  )
virtual

Definition at line 64 of file gimbal.cc.

References NO_OP.

65 {
66  NO_OP;
67 }
#define NO_OP
Definition: myassert.h:74

Member Function Documentation

void GimbalRotationJoint::AfterPredict ( VectorHandler X,
VectorHandler XP 
)
virtual

Reimplemented from SimulationEntity.

Definition at line 175 of file gimbal.cc.

References NO_OP.

177 {
178  NO_OP;
179 }
#define NO_OP
Definition: myassert.h:74
VariableSubMatrixHandler & GimbalRotationJoint::AssJac ( VariableSubMatrixHandler WorkMat,
doublereal  dCoef,
const VectorHandler XCurr,
const VectorHandler XPrimeCurr 
)
virtual

Implements Elem.

Definition at line 133 of file gimbal.cc.

References AssMat(), DEBUGCOUT, DofOwnerOwner::iGetFirstIndex(), StructDispNode::iGetFirstMomentumIndex(), StructDispNode::iGetFirstPositionIndex(), pNode1, pNode2, FullSubMatrixHandler::PutColIndex(), FullSubMatrixHandler::PutRowIndex(), FullSubMatrixHandler::ResizeReset(), VariableSubMatrixHandler::SetFull(), and WorkSpaceDim().

137 {
138  DEBUGCOUT("Entering GimbalRotationJoint::AssJac()" << std::endl);
139 
140  FullSubMatrixHandler& WM = WorkMat.SetFull();
141 
142  /* Dimensiona e resetta la matrice di lavoro */
143  integer iNumRows = 0;
144  integer iNumCols = 0;
145  WorkSpaceDim(&iNumRows, &iNumCols);
146  WM.ResizeReset(iNumRows, iNumCols);
147 
148  /* Recupera gli indici */
149  integer iNode1FirstPosIndex = pNode1->iGetFirstPositionIndex() + 3;
150  integer iNode1FirstMomIndex = pNode1->iGetFirstMomentumIndex() + 3;
151  integer iNode2FirstPosIndex = pNode2->iGetFirstPositionIndex() + 3;
152  integer iNode2FirstMomIndex = pNode2->iGetFirstMomentumIndex() + 3;
153  integer iFirstReactionIndex = iGetFirstIndex();
154 
155  /* Setta gli indici della matrice */
156  for (int iCnt = 1; iCnt <= 3; iCnt++) {
157  WM.PutRowIndex(iCnt, iNode1FirstMomIndex + iCnt);
158  WM.PutColIndex(iCnt, iNode1FirstPosIndex + iCnt);
159  WM.PutRowIndex(3 + iCnt, iNode2FirstMomIndex + iCnt);
160  WM.PutColIndex(3 + iCnt, iNode2FirstPosIndex + iCnt);
161  }
162 
163  for (int iCnt = 1; iCnt <= 5; iCnt++) {
164  WM.PutRowIndex(6 + iCnt, iFirstReactionIndex + iCnt);
165  WM.PutColIndex(6 + iCnt, iFirstReactionIndex + iCnt);
166  }
167 
168  AssMat(WM, dCoef);
169 
170  return WorkMat;
171 }
void PutColIndex(integer iSubCol, integer iCol)
Definition: submat.h:325
const StructNode * pNode1
Definition: gimbal.h:47
FullSubMatrixHandler & SetFull(void)
Definition: submat.h:1168
const StructNode * pNode2
Definition: gimbal.h:48
#define DEBUGCOUT(msg)
Definition: myassert.h:232
virtual integer iGetFirstMomentumIndex(void) const =0
virtual integer iGetFirstPositionIndex(void) const
Definition: strnode.h:452
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: gimbal.h:98
virtual void ResizeReset(integer, integer)
Definition: submat.cc:182
void PutRowIndex(integer iSubRow, integer iRow)
Definition: submat.h:311
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
long int integer
Definition: colamd.c:51
void AssMat(FullSubMatrixHandler &WM, doublereal dCoef)
Definition: gimbal.cc:183

Here is the call graph for this function:

void GimbalRotationJoint::AssMat ( FullSubMatrixHandler WM,
doublereal  dCoef 
)
protected

Definition at line 183 of file gimbal.cc.

References FullSubMatrixHandler::Add(), grad::cos(), grad::Cross(), FullSubMatrixHandler::DecCoef(), dPhi, dTheta, StructNode::GetRCurr(), FullSubMatrixHandler::IncCoef(), M, MatCross, pNode1, pNode2, R1h, R2h, grad::sin(), and FullSubMatrixHandler::Sub().

Referenced by AssJac(), and InitialAssJac().

184 {
185  Mat3x3 Ra(pNode1->GetRCurr()*R1h);
186  Mat3x3 Rb(pNode2->GetRCurr()*R2h);
187  Mat3x3 RaT(Ra.Transpose());
188 
189  Mat3x3 R_ab(RaT*Rb);
190 
191  doublereal dCosTheta = cos(dTheta);
192  doublereal dSinTheta = sin(dTheta);
193  doublereal dCosPhi = cos(dPhi);
194  doublereal dSinPhi = sin(dPhi);
195 
196  Vec3 w_theta(dSinTheta*dSinPhi, 1. + dCosPhi, -dCosTheta*dSinPhi);
197  Vec3 w_phi(dCosTheta, 0., dSinTheta);
198 
199  Vec3 w_theta_theta(dCosTheta*dSinPhi, 0., dSinTheta*dSinPhi);
200  Vec3 w_theta_phi(dSinTheta*dCosPhi, -dSinPhi, -dCosTheta*dCosPhi);
201  Vec3 w_phi_theta(-dSinTheta, 0., dCosTheta);
202 
203  /* coppie */
204  /* termini in Delta lambda */
205  WM.Add(1, 6 + 1, Ra);
206  WM.Sub(3 + 1, 6 + 1, Ra);
207 
208  /* termini in Delta g_a */
209  Vec3 Lambda(Ra*M);
210  Mat3x3 MTmp(MatCross, Lambda*dCoef);
211  WM.Sub(1, 1, MTmp);
212  WM.Add(3 + 1, 1, MTmp);
213 
214  /* equazioni di vincolo */
215  /* termini in Delta g_a, Delta g_b */
216  MTmp = RaT*dCoef;
217  WM.Add(6 + 1, 1, MTmp);
218  WM.Sub(6 + 1, 3 + 1, MTmp);
219 
220  /* termini in Delta theta */
221  Vec3 VTmp(R_ab*w_theta);
222  WM.IncCoef(6 + 1, 9 + 1, VTmp(1));
223  WM.IncCoef(6 + 2, 9 + 1, VTmp(2));
224  WM.IncCoef(6 + 3, 9 + 1, VTmp(3));
225 
226  WM.IncCoef(9 + 1, 6 + 1, VTmp(1));
227  WM.IncCoef(9 + 1, 6 + 2, VTmp(2));
228  WM.IncCoef(9 + 1, 6 + 3, VTmp(3));
229 
230  /* termini in Delta phi */
231  VTmp = Vec3(R_ab*w_phi);
232  WM.IncCoef(6 + 1, 9 + 2, VTmp(1));
233  WM.IncCoef(6 + 2, 9 + 2, VTmp(2));
234  WM.IncCoef(6 + 3, 9 + 2, VTmp(3));
235 
236  WM.IncCoef(9 + 2, 6 + 1, VTmp(1));
237  WM.IncCoef(9 + 2, 6 + 2, VTmp(2));
238  WM.IncCoef(9 + 2, 6 + 3, VTmp(3));
239 
240  /* equazione in theta */
241  /* termini in Delta g_a, Delta g_b */
242  VTmp = (Rb*w_theta).Cross(Lambda*dCoef);
243  WM.DecCoef(9 + 1, 1, VTmp(1));
244  WM.DecCoef(9 + 1, 2, VTmp(2));
245  WM.DecCoef(9 + 1, 3, VTmp(3));
246 
247  WM.IncCoef(9 + 1, 3 + 1, VTmp(1));
248  WM.IncCoef(9 + 1, 3 + 2, VTmp(2));
249  WM.IncCoef(9 + 1, 3 + 3, VTmp(3));
250 
251  /* termine in Delta theta */
252  WM.IncCoef(9 + 1, 9 + 1, (Rb*w_theta_theta)*Lambda);
253 
254  /* termine in Delta phi */
255  WM.IncCoef(9 + 1, 9 + 2, (Rb*w_theta_phi)*Lambda);
256 
257  /* equazione in phi */
258  /* termini in Delta g_a, Delta g_b */
259  VTmp = (Rb*w_phi).Cross(Lambda*dCoef);
260  WM.DecCoef(9 + 2, 1, VTmp(1));
261  WM.DecCoef(9 + 2, 2, VTmp(2));
262  WM.DecCoef(9 + 2, 3, VTmp(3));
263 
264  WM.IncCoef(9 + 2, 3 + 1, VTmp(1));
265  WM.IncCoef(9 + 2, 3 + 2, VTmp(2));
266  WM.IncCoef(9 + 2, 3 + 3, VTmp(3));
267 
268  /* termine in Delta theta */
269  WM.IncCoef(9 + 2, 9 + 1, (Rb*w_phi_theta)*Lambda);
270 }
const StructNode * pNode1
Definition: gimbal.h:47
Definition: matvec3.h:98
GradientExpression< UnaryExpr< FuncSin, Expr > > sin(const GradientExpression< Expr > &u)
Definition: gradient.h:2977
const MatCross_Manip MatCross
Definition: matvec3.cc:639
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
void Add(integer iRow, integer iCol, const Vec3 &v)
Definition: submat.cc:209
const Mat3x3 R1h
Definition: gimbal.h:49
void IncCoef(integer iRow, integer iCol, const doublereal &dCoef)
Definition: submat.h:683
void DecCoef(integer iRow, integer iCol, const doublereal &dCoef)
Definition: submat.h:694
const StructNode * pNode2
Definition: gimbal.h:48
doublereal dTheta
Definition: gimbal.h:53
VectorExpression< VectorCrossExpr< VectorLhsExpr, VectorRhsExpr >, 3 > Cross(const VectorExpression< VectorLhsExpr, 3 > &u, const VectorExpression< VectorRhsExpr, 3 > &v)
Definition: matvec.h:3248
void Sub(integer iRow, integer iCol, const Vec3 &v)
Definition: submat.cc:215
const Mat3x3 R2h
Definition: gimbal.h:50
GradientExpression< UnaryExpr< FuncCos, Expr > > cos(const GradientExpression< Expr > &u)
Definition: gradient.h:2978
double doublereal
Definition: colamd.c:52
doublereal dPhi
Definition: gimbal.h:53

Here is the call graph for this function:

SubVectorHandler & GimbalRotationJoint::AssRes ( SubVectorHandler WorkVec,
doublereal  dCoef,
const VectorHandler XCurr,
const VectorHandler XPrimeCurr 
)
virtual

Implements Elem.

Definition at line 275 of file gimbal.cc.

References AssVec(), DEBUGCOUT, dPhi, dTheta, DofOwnerOwner::iGetFirstIndex(), StructDispNode::iGetFirstMomentumIndex(), M, pNode1, pNode2, SubVectorHandler::PutRowIndex(), VectorHandler::ResizeReset(), and WorkSpaceDim().

279 {
280  DEBUGCOUT("Entering GimbalRotationJoint::AssRes()" << std::endl);
281 
282  /* Dimensiona e resetta la matrice di lavoro */
283  integer iNumRows = 0;
284  integer iNumCols = 0;
285  WorkSpaceDim(&iNumRows, &iNumCols);
286  WorkVec.ResizeReset(iNumRows);
287 
288  /* Recupera gli indici */
289  integer iNode1FirstMomIndex = pNode1->iGetFirstMomentumIndex() + 3;
290  integer iNode2FirstMomIndex = pNode2->iGetFirstMomentumIndex() + 3;
291  integer iFirstReactionIndex = iGetFirstIndex();
292 
293  /* Setta gli indici della matrice */
294  for (int iCnt = 1; iCnt <= 3; iCnt++) {
295  WorkVec.PutRowIndex(iCnt, iNode1FirstMomIndex + iCnt);
296  WorkVec.PutRowIndex(3 + iCnt, iNode2FirstMomIndex + iCnt);
297  }
298 
299  for (int iCnt = 1; iCnt <= 5; iCnt++) {
300  WorkVec.PutRowIndex(6 + iCnt, iFirstReactionIndex + iCnt);
301  }
302 
303  M = Vec3(XCurr, iFirstReactionIndex + 1);
304  dTheta = XCurr(iFirstReactionIndex + 3 + 1);
305  dPhi = XCurr(iFirstReactionIndex + 3 + 2);
306 
307  AssVec(WorkVec, dCoef);
308 
309  return WorkVec;
310 }
void AssVec(SubVectorHandler &WorkVec, doublereal dCoef)
Definition: gimbal.cc:314
const StructNode * pNode1
Definition: gimbal.h:47
Definition: matvec3.h:98
virtual void ResizeReset(integer)
Definition: vh.cc:55
virtual void PutRowIndex(integer iSubRow, integer iRow)=0
const StructNode * pNode2
Definition: gimbal.h:48
doublereal dTheta
Definition: gimbal.h:53
#define DEBUGCOUT(msg)
Definition: myassert.h:232
virtual integer iGetFirstMomentumIndex(void) const =0
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: gimbal.h:98
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
long int integer
Definition: colamd.c:51
doublereal dPhi
Definition: gimbal.h:53

Here is the call graph for this function:

void GimbalRotationJoint::AssVec ( SubVectorHandler WorkVec,
doublereal  dCoef 
)
protected

Definition at line 314 of file gimbal.cc.

References VectorHandler::Add(), grad::cos(), VectorHandler::DecCoef(), dPhi, dTheta, StructNode::GetRCurr(), M, pNode1, pNode2, R1h, R2h, RotManip::Rot(), grad::sin(), VectorHandler::Sub(), Mat3x3::Transpose(), and RotManip::VecRot().

Referenced by AssRes(), and InitialAssRes().

315 {
316  Mat3x3 Ra(pNode1->GetRCurr()*R1h);
317  Mat3x3 Rb(pNode2->GetRCurr()*R2h);
318 
319  Mat3x3 ExpTheta(RotManip::Rot(Vec3(0., dTheta, 0.)));
320  Mat3x3 ExpPhi(RotManip::Rot(Vec3(dPhi, 0., 0.)));
321 
322  doublereal dCosTheta = cos(dTheta);
323  doublereal dSinTheta = sin(dTheta);
324  doublereal dCosPhi = cos(dPhi);
325  doublereal dSinPhi = sin(dPhi);
326 
327  Vec3 MTmp(Ra*M);
328 
329  Mat3x3 R_rel(ExpTheta*ExpPhi*ExpTheta);
330  Mat3x3 R_ab(Ra.Transpose()*Rb);
331 
332  WorkVec.Sub(1, MTmp);
333  WorkVec.Add(3 + 1, MTmp);
334 
335  WorkVec.Add(6 + 1, RotManip::VecRot(R_ab*R_rel.Transpose()));
336 
337  Vec3 w_theta(dSinTheta*dSinPhi, 1. + dCosPhi, -dCosTheta*dSinPhi);
338  Vec3 w_phi(dCosTheta, 0., dSinTheta);
339 
340  WorkVec.DecCoef(9 + 1, (R_ab*w_theta)*M);
341  WorkVec.DecCoef(9 + 2, (R_ab*w_phi)*M);
342 }
const StructNode * pNode1
Definition: gimbal.h:47
Definition: matvec3.h:98
GradientExpression< UnaryExpr< FuncSin, Expr > > sin(const GradientExpression< Expr > &u)
Definition: gradient.h:2977
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
virtual void Sub(integer iRow, const Vec3 &v)
Definition: vh.cc:78
const Mat3x3 R1h
Definition: gimbal.h:49
Vec3 VecRot(const Mat3x3 &Phi)
Definition: Rot.cc:136
virtual void DecCoef(integer iRow, const doublereal &dCoef)=0
const StructNode * pNode2
Definition: gimbal.h:48
doublereal dTheta
Definition: gimbal.h:53
Mat3x3 Rot(const Vec3 &phi)
Definition: Rot.cc:62
virtual void Add(integer iRow, const Vec3 &v)
Definition: vh.cc:63
const Mat3x3 R2h
Definition: gimbal.h:50
GradientExpression< UnaryExpr< FuncCos, Expr > > cos(const GradientExpression< Expr > &u)
Definition: gradient.h:2978
double doublereal
Definition: colamd.c:52
doublereal dPhi
Definition: gimbal.h:53

Here is the call graph for this function:

doublereal GimbalRotationJoint::dGetPrivData ( unsigned int  i = 0) const
virtual

Reimplemented from SimulationEntity.

Definition at line 459 of file gimbal.cc.

References dPhi, dTheta, M, and MBDYN_EXCEPT_ARGS.

460 {
461  switch (i) {
462  case 1:
463  case 2:
464  case 3:
465  return M(i);
466 
467  case 4:
468  return dTheta;
469 
470  case 5:
471  return dPhi;
472  }
473 
475 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
doublereal dTheta
Definition: gimbal.h:53
doublereal dPhi
Definition: gimbal.h:53
virtual void GimbalRotationJoint::GetConnectedNodes ( std::vector< const Node * > &  connectedNodes) const
inlinevirtual

Reimplemented from Elem.

Definition at line 149 of file gimbal.h.

References pNode1, and pNode2.

149  {
150  connectedNodes.resize(2);
151  connectedNodes[0] = pNode1;
152  connectedNodes[1] = pNode2;
153  };
const StructNode * pNode1
Definition: gimbal.h:47
const StructNode * pNode2
Definition: gimbal.h:48
virtual DofOrder::Order GimbalRotationJoint::GetDofType ( unsigned int  i) const
inlinevirtual

Reimplemented from Elem.

Definition at line 88 of file gimbal.h.

References DofOrder::ALGEBRAIC, ASSERT, and iGetNumDof().

88  {
89  ASSERT(i >= 0 && i < iGetNumDof());
90  return DofOrder::ALGEBRAIC;
91  };
virtual unsigned int iGetNumDof(void) const
Definition: gimbal.h:84
#define ASSERT(expression)
Definition: colamd.c:977

Here is the call graph for this function:

virtual DofOrder::Order GimbalRotationJoint::GetEqType ( unsigned int  i) const
inlinevirtual

Reimplemented from SimulationEntity.

Definition at line 93 of file gimbal.h.

References DofOrder::ALGEBRAIC, ASSERT, and iGetNumDof().

93  {
94  ASSERT(i >= 0 && i < iGetNumDof());
95  return DofOrder::ALGEBRAIC;
96  };
virtual unsigned int iGetNumDof(void) const
Definition: gimbal.h:84
#define ASSERT(expression)
Definition: colamd.c:977

Here is the call graph for this function:

virtual Joint::Type GimbalRotationJoint::GetJointType ( void  ) const
inlinevirtual

Implements Joint.

Definition at line 75 of file gimbal.h.

References Joint::GIMBAL.

75  {
76  return GIMBAL;
77  };
virtual unsigned int GimbalRotationJoint::iGetInitialNumDof ( void  ) const
inlinevirtual

Implements SubjectToInitialAssembly.

Definition at line 121 of file gimbal.h.

121  {
122  return 5;
123  };
virtual unsigned int GimbalRotationJoint::iGetNumDof ( void  ) const
inlinevirtual

Reimplemented from Elem.

Definition at line 84 of file gimbal.h.

Referenced by GetDofType(), and GetEqType().

84  {
85  return 5;
86  };
unsigned int GimbalRotationJoint::iGetNumPrivData ( void  ) const
virtual

Reimplemented from SimulationEntity.

Definition at line 424 of file gimbal.cc.

425 {
426  return 5;
427 }
unsigned int GimbalRotationJoint::iGetPrivDataIdx ( const char *  s) const
virtual

Reimplemented from SimulationEntity.

Definition at line 430 of file gimbal.cc.

References STRLENOF.

431 {
432  if (strncmp(s, "lambda[" /*]*/ , STRLENOF("lambda[" /*]*/ )) == 0) {
433  s += STRLENOF("lambda[" /*]*/ );
434  if (strcmp(&s[1], /*[*/ "]") != 0) {
435  return 0;
436  }
437 
438  switch (s[0]) {
439  case '1':
440  case '2':
441  case '3':
442  return s[0] - '0';
443 
444  default:
445  return 0;
446  }
447 
448  } else if (strcmp(s, "theta") == 0) {
449  return 4;
450 
451  } else if (strcmp(s, "phi") == 0) {
452  return 5;
453  }
454 
455  return 0;
456 }
#define STRLENOF(s)
Definition: mbdyn.h:166
VariableSubMatrixHandler & GimbalRotationJoint::InitialAssJac ( VariableSubMatrixHandler WorkMat,
const VectorHandler XCurr 
)
virtual

Implements SubjectToInitialAssembly.

Definition at line 352 of file gimbal.cc.

References AssMat(), DEBUGCOUT, DofOwnerOwner::iGetFirstIndex(), StructDispNode::iGetFirstPositionIndex(), InitialWorkSpaceDim(), pNode1, pNode2, FullSubMatrixHandler::PutColIndex(), FullSubMatrixHandler::PutRowIndex(), FullSubMatrixHandler::ResizeReset(), and VariableSubMatrixHandler::SetFull().

354 {
355  DEBUGCOUT("Entering GimbalRotationJoint::InitialAssJac()" << std::endl);
356 
357  FullSubMatrixHandler& WM = WorkMat.SetFull();
358 
359  /* Dimensiona e resetta la matrice di lavoro */
360  integer iNumRows = 0;
361  integer iNumCols = 0;
362  InitialWorkSpaceDim(&iNumRows, &iNumCols);
363  WM.ResizeReset(iNumRows, iNumCols);
364 
365  /* Recupera gli indici */
366  integer iNode1FirstPosIndex = pNode1->iGetFirstPositionIndex() + 3;
367  integer iNode2FirstPosIndex = pNode2->iGetFirstPositionIndex() + 3;
368  integer iFirstReactionIndex = iGetFirstIndex();
369 
370  /* Setta gli indici della matrice */
371  for (int iCnt = 1; iCnt <= 3; iCnt++) {
372  WM.PutRowIndex(iCnt, iNode1FirstPosIndex + iCnt);
373  WM.PutColIndex(iCnt, iNode1FirstPosIndex + iCnt);
374  WM.PutRowIndex(3 + iCnt, iNode2FirstPosIndex + iCnt);
375  WM.PutColIndex(3 + iCnt, iNode2FirstPosIndex + iCnt);
376  }
377 
378  for (int iCnt = 1; iCnt <= 5; iCnt++) {
379  WM.PutRowIndex(6 + iCnt, iFirstReactionIndex + iCnt);
380  WM.PutColIndex(6 + iCnt, iFirstReactionIndex + iCnt);
381  }
382 
383  AssMat(WM, 1.);
384 
385  return WorkMat;
386 }
void PutColIndex(integer iSubCol, integer iCol)
Definition: submat.h:325
const StructNode * pNode1
Definition: gimbal.h:47
FullSubMatrixHandler & SetFull(void)
Definition: submat.h:1168
const StructNode * pNode2
Definition: gimbal.h:48
#define DEBUGCOUT(msg)
Definition: myassert.h:232
virtual integer iGetFirstPositionIndex(void) const
Definition: strnode.h:452
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: gimbal.h:125
virtual void ResizeReset(integer, integer)
Definition: submat.cc:182
void PutRowIndex(integer iSubRow, integer iRow)
Definition: submat.h:311
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
long int integer
Definition: colamd.c:51
void AssMat(FullSubMatrixHandler &WM, doublereal dCoef)
Definition: gimbal.cc:183

Here is the call graph for this function:

SubVectorHandler & GimbalRotationJoint::InitialAssRes ( SubVectorHandler WorkVec,
const VectorHandler XCurr 
)
virtual

Implements SubjectToInitialAssembly.

Definition at line 391 of file gimbal.cc.

References AssVec(), DEBUGCOUT, DofOwnerOwner::iGetFirstIndex(), StructDispNode::iGetFirstPositionIndex(), InitialWorkSpaceDim(), pNode1, pNode2, SubVectorHandler::PutRowIndex(), and VectorHandler::ResizeReset().

393 {
394  DEBUGCOUT("Entering GimbalRotationJoint::InitialAssRes()" << std::endl);
395 
396  /* Dimensiona e resetta la matrice di lavoro */
397  integer iNumRows = 0;
398  integer iNumCols = 0;
399  InitialWorkSpaceDim(&iNumRows, &iNumCols);
400  WorkVec.ResizeReset(iNumRows);
401 
402  /* Recupera gli indici */
403  integer iNode1FirstPosIndex = pNode1->iGetFirstPositionIndex() + 3;
404  integer iNode2FirstPosIndex = pNode2->iGetFirstPositionIndex() + 3;
405  integer iFirstReactionIndex = iGetFirstIndex();
406 
407  /* Setta gli indici del vettore */
408  for (int iCnt = 1; iCnt <= 3; iCnt++) {
409  WorkVec.PutRowIndex(iCnt, iNode1FirstPosIndex + iCnt);
410  WorkVec.PutRowIndex(3 + iCnt, iNode2FirstPosIndex + iCnt);
411  }
412 
413  for (int iCnt = 1; iCnt <= 5; iCnt++) {
414  WorkVec.PutRowIndex(6 + iCnt, iFirstReactionIndex + iCnt);
415  }
416 
417  AssVec(WorkVec, 1);
418 
419  return WorkVec;
420 }
void AssVec(SubVectorHandler &WorkVec, doublereal dCoef)
Definition: gimbal.cc:314
const StructNode * pNode1
Definition: gimbal.h:47
virtual void ResizeReset(integer)
Definition: vh.cc:55
virtual void PutRowIndex(integer iSubRow, integer iRow)=0
const StructNode * pNode2
Definition: gimbal.h:48
#define DEBUGCOUT(msg)
Definition: myassert.h:232
virtual integer iGetFirstPositionIndex(void) const
Definition: strnode.h:452
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: gimbal.h:125
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

virtual void GimbalRotationJoint::InitialWorkSpaceDim ( integer piNumRows,
integer piNumCols 
) const
inlinevirtual

Implements SubjectToInitialAssembly.

Definition at line 125 of file gimbal.h.

Referenced by InitialAssJac(), and InitialAssRes().

126  {
127  *piNumRows = 11;
128  *piNumCols = 11;
129  };
void GimbalRotationJoint::Output ( OutputHandler OH) const
virtual

Reimplemented from ToBeOutput.

Definition at line 86 of file gimbal.cc.

References ToBeOutput::bToBeOutput(), dPhi, dRaDegr, dTheta, EULER_123, EULER_313, EULER_321, WithLabel::GetLabel(), StructNode::GetRCurr(), OutputHandler::Joints(), M, MatR2EulerAngles123(), MatR2EulerAngles313(), MatR2EulerAngles321(), od, ORIENTATION_MATRIX, ORIENTATION_VECTOR, Joint::Output(), pNode1, pNode2, R, Mat3x3::Transpose(), RotManip::VecRot(), and Zero3.

87 {
88  if (bToBeOutput()) {
89  Mat3x3 Ra(pNode1->GetRCurr());
90 
91  // TODO: allow to customize orientation description
93 
94  std::ostream& out = OH.Joints();
95 
96  Joint::Output(out, "Gimbal", GetLabel(),
97  Zero3, M, Zero3, Ra*M)
98  << " " << dTheta << " " << dPhi << " ";
99 
100  switch (od) {
101  case EULER_123:
102  out << MatR2EulerAngles123(R)*dRaDegr;
103  break;
104 
105  case EULER_313:
106  out << MatR2EulerAngles313(R)*dRaDegr;
107  break;
108 
109  case EULER_321:
110  out << MatR2EulerAngles321(R)*dRaDegr;
111  break;
112 
113  case ORIENTATION_VECTOR:
114  out << RotManip::VecRot(R);
115  break;
116 
117  case ORIENTATION_MATRIX:
118  out << R;
119  break;
120 
121  default:
122  /* impossible */
123  break;
124  }
125 
126  out << std::endl;
127  }
128 }
const Vec3 Zero3(0., 0., 0.)
virtual bool bToBeOutput(void) const
Definition: output.cc:890
const StructNode * pNode1
Definition: gimbal.h:47
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
Vec3 VecRot(const Mat3x3 &Phi)
Definition: Rot.cc:136
const StructNode * pNode2
Definition: gimbal.h:48
doublereal dTheta
Definition: gimbal.h:53
OrientationDescription od
Definition: gimbal.h:55
Vec3 MatR2EulerAngles313(const Mat3x3 &R)
Definition: matvec3.cc:927
Vec3 MatR2EulerAngles123(const Mat3x3 &R)
Definition: matvec3.cc:893
const doublereal dRaDegr
Definition: matvec3.cc:884
std::ostream & Joints(void) const
Definition: output.h:443
Mat3x3 Transpose(void) const
Definition: matvec3.h:816
Vec3 MatR2EulerAngles321(const Mat3x3 &R)
Definition: matvec3.cc:941
std::ostream & Output(std::ostream &out, const char *sJointName, unsigned int uLabel, const Vec3 &FLocal, const Vec3 &MLocal, const Vec3 &FGlobal, const Vec3 &MGlobal) const
Definition: joint.cc:138
unsigned int GetLabel(void) const
Definition: withlab.cc:62
Mat3x3 R
doublereal dPhi
Definition: gimbal.h:53

Here is the call graph for this function:

std::ostream & GimbalRotationJoint::Restart ( std::ostream &  out) const
virtual

Implements Elem.

Definition at line 72 of file gimbal.cc.

References WithLabel::GetLabel(), Mat3x3::GetVec(), pNode1, pNode2, R1h, R2h, Joint::Restart(), and Write().

73 {
74  Joint::Restart(out) << ", gimbal rotation, "
75  << pNode1->GetLabel() << ", reference, node, 1, ",
76  (R1h.GetVec(1)).Write(out, ", ")
77  << ", 2, ", (R1h.GetVec(2)).Write(out, ", ") << ", "
78  << pNode2->GetLabel() << ", reference, node, 1, ",
79  (R2h.GetVec(1)).Write(out, ", ")
80  << ", 2, ", (R2h.GetVec(2)).Write(out, ", ") << ';' << std::endl;
81  return out;
82 }
const StructNode * pNode1
Definition: gimbal.h:47
std::ostream & Write(std::ostream &out, const FullMatrixHandler &m, const char *s, const char *s2)
Definition: fullmh.cc:376
const Mat3x3 R1h
Definition: gimbal.h:49
Vec3 GetVec(unsigned short int i) const
Definition: matvec3.h:893
const StructNode * pNode2
Definition: gimbal.h:48
virtual std::ostream & Restart(std::ostream &out) const
Definition: joint.h:195
const Mat3x3 R2h
Definition: gimbal.h:50
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

virtual void GimbalRotationJoint::WorkSpaceDim ( integer piNumRows,
integer piNumCols 
) const
inlinevirtual

Implements Elem.

Definition at line 98 of file gimbal.h.

Referenced by AssJac(), and AssRes().

99  {
100  *piNumRows = 11;
101  *piNumCols = 11;
102  };

Member Data Documentation

doublereal GimbalRotationJoint::dPhi
protected

Definition at line 53 of file gimbal.h.

Referenced by AssMat(), AssRes(), AssVec(), dGetPrivData(), and Output().

doublereal GimbalRotationJoint::dTheta
protected

Definition at line 53 of file gimbal.h.

Referenced by AssMat(), AssRes(), AssVec(), dGetPrivData(), and Output().

Vec3 GimbalRotationJoint::M
protected

Definition at line 52 of file gimbal.h.

Referenced by AssMat(), AssRes(), AssVec(), dGetPrivData(), and Output().

OrientationDescription GimbalRotationJoint::od
protected

Definition at line 55 of file gimbal.h.

Referenced by Output().

const StructNode* GimbalRotationJoint::pNode1
protected
const StructNode* GimbalRotationJoint::pNode2
protected
const Mat3x3 GimbalRotationJoint::R1h
protected

Definition at line 49 of file gimbal.h.

Referenced by AssMat(), AssVec(), and Restart().

const Mat3x3 GimbalRotationJoint::R2h
protected

Definition at line 50 of file gimbal.h.

Referenced by AssMat(), AssVec(), and Restart().


The documentation for this class was generated from the following files: