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

#include <planej.h>

Inheritance diagram for PlanePinJoint:
Collaboration diagram for PlanePinJoint:

Public Member Functions

 PlanePinJoint (unsigned int uL, const DofOwner *pDO, const StructNode *pN, const Vec3 &X0Tmp, const Mat3x3 &R0Tmp, const Vec3 &dTmp, const Mat3x3 &RhTmp, flag fOut, const bool _calcInitdTheta, const doublereal initDTheta)
 
 ~PlanePinJoint (void)
 
virtual Joint::Type GetJointType (void) const
 
virtual void ReadInitialState (MBDynParser &HP)
 
virtual std::ostream & Restart (std::ostream &out) const
 
virtual unsigned int iGetNumDof (void) const
 
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 DofOrder::Order GetDofType (unsigned int i) const
 
DofOrder::Order GetEqType (unsigned int i) const
 
virtual void SetValue (DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *ph=0)
 
virtual HintParseHint (DataManager *pDM, const char *s) const
 
virtual void AfterConvergence (const VectorHandler &X, const VectorHandler &XP)
 
virtual void WorkSpaceDim (integer *piNumRows, integer *piNumCols) const
 
VariableSubMatrixHandlerAssJac (VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
SubVectorHandlerAssRes (SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual void Output (OutputHandler &OH) const
 
virtual unsigned int iGetInitialNumDof (void) const
 
virtual void InitialWorkSpaceDim (integer *piNumRows, integer *piNumCols) const
 
VariableSubMatrixHandlerInitialAssJac (VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
 
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) 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 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 void BeforePredict (VectorHandler &, VectorHandler &, VectorHandler &, VectorHandler &) const
 
virtual void AfterPredict (VectorHandler &X, VectorHandler &XP)
 
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, const VectorHandler &XPP)
 
virtual std::ostream & OutputAppend (std::ostream &out) const
 
- 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 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)
 

Private Attributes

const StructNodepNode
 
Vec3 X0
 
Mat3x3 R0
 
Vec3 d
 
Mat3x3 Rh
 
Vec3 F
 
Vec3 M
 
bool calcInitdTheta
 
int NTheta
 
doublereal dTheta
 
doublereal dThetaWrapped
 

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
}
 
- 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 inherited from WithLabel
unsigned int uLabel
 
std::string sName
 
- Protected Attributes inherited from ToBeOutput
flag fOutput
 
- Protected Attributes inherited from GravityOwner
GravitypGravity
 

Detailed Description

Definition at line 521 of file planej.h.

Constructor & Destructor Documentation

PlanePinJoint::PlanePinJoint ( unsigned int  uL,
const DofOwner pDO,
const StructNode pN,
const Vec3 X0Tmp,
const Mat3x3 R0Tmp,
const Vec3 dTmp,
const Mat3x3 RhTmp,
flag  fOut,
const bool  _calcInitdTheta,
const doublereal  initDTheta 
)

Definition at line 3977 of file planej.cc.

References NO_OP.

3983 : Elem(uL, fOut),
3984 Joint(uL, pDO, fOut),
3985 pNode(pN),
3986 X0(X0Tmp), R0(R0Tmp), d(dTmp), Rh(RhTmp),
3987 F(Zero3), M(Zero3),
3988 calcInitdTheta(_calcInitdTheta),
3989 NTheta(0), dTheta(initDTheta), dThetaWrapped(0.)
3990 {
3991  NO_OP;
3992 }
const Vec3 Zero3(0., 0., 0.)
Joint(unsigned int uL, const DofOwner *pD, flag fOut)
Definition: joint.cc:83
int NTheta
Definition: planej.h:531
#define NO_OP
Definition: myassert.h:74
const StructNode * pNode
Definition: planej.h:523
Mat3x3 Rh
Definition: planej.h:527
bool calcInitdTheta
Definition: planej.h:530
Mat3x3 R0
Definition: planej.h:525
doublereal dThetaWrapped
Definition: planej.h:532
Elem(unsigned int uL, flag fOut)
Definition: elem.cc:41
doublereal dTheta
Definition: planej.h:532
PlanePinJoint::~PlanePinJoint ( void  )

Definition at line 3996 of file planej.cc.

References NO_OP.

3997 {
3998  NO_OP;
3999 };
#define NO_OP
Definition: myassert.h:74

Member Function Documentation

void PlanePinJoint::AfterConvergence ( const VectorHandler X,
const VectorHandler XP 
)
virtual

Reimplemented from SimulationEntity.

Definition at line 4305 of file planej.cc.

References dTheta, dThetaWrapped, StructNode::GetRCurr(), M_PI, Mat3x3::MulTM(), NTheta, pNode, R0, Rh, and RotManip::VecRot().

4307 {
4309  doublereal dThetaTmp(v(3));
4310 
4311  // unwrap
4312  if (dThetaTmp - dThetaWrapped < -M_PI) {
4313  NTheta++;
4314  }
4315 
4316  if (dThetaTmp - dThetaWrapped > M_PI) {
4317  NTheta--;
4318  }
4319 
4320  // save new wrapped angle
4321  dThetaWrapped = dThetaTmp;
4322 
4323  // compute new unwrapped angle
4325 
4326 }
#define M_PI
Definition: gradienttest.cc:67
Definition: matvec3.h:98
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
int NTheta
Definition: planej.h:531
Vec3 VecRot(const Mat3x3 &Phi)
Definition: Rot.cc:136
const StructNode * pNode
Definition: planej.h:523
Mat3x3 Rh
Definition: planej.h:527
Mat3x3 R0
Definition: planej.h:525
Mat3x3 MulTM(const Mat3x3 &m) const
Definition: matvec3.cc:500
doublereal dThetaWrapped
Definition: planej.h:532
doublereal dTheta
Definition: planej.h:532
double doublereal
Definition: colamd.c:52

Here is the call graph for this function:

VariableSubMatrixHandler & PlanePinJoint::AssJac ( VariableSubMatrixHandler WorkMat,
doublereal  dCoef,
const VectorHandler XCurr,
const VectorHandler XPrimeCurr 
)
virtual

Implements Elem.

Definition at line 4358 of file planej.cc.

References grad::Cross(), d, DEBUGCOUT, Vec3::dGet(), F, StructNode::GetRRef(), Mat3x3::GetVec(), DofOwnerOwner::iGetFirstIndex(), StructDispNode::iGetFirstMomentumIndex(), StructDispNode::iGetFirstPositionIndex(), M, MatCrossCross, pNode, SparseSubMatrixHandler::PutCross(), SparseSubMatrixHandler::PutItem(), SparseSubMatrixHandler::PutMat3x3(), R, R0, SparseSubMatrixHandler::ResizeReset(), Rh, and VariableSubMatrixHandler::SetSparse().

4362 {
4363  DEBUGCOUT("Entering PlanePinJoint::AssJac()" << std::endl);
4364 
4365  SparseSubMatrixHandler& WM = WorkMat.SetSparse();
4366  WM.ResizeReset(39, 0);
4367 
4368  integer iFirstPositionIndex = pNode->iGetFirstPositionIndex();
4369  integer iFirstMomentumIndex = pNode->iGetFirstMomentumIndex();
4370  integer iFirstReactionIndex = iGetFirstIndex();
4371 
4372  const Mat3x3& R(pNode->GetRRef());
4373  Vec3 dTmp(R*d);
4374  Mat3x3 RhTmp(R*Rh);
4375 
4376 
4377  /*
4378  * L'equazione di vincolo afferma che il punto in cui si trova la
4379  * cerniera deve essere fissato:
4380  * x + d = x0
4381  * e3_0^Te1 = 0
4382  * e3_0^Te2 = 0
4383  *
4384  * con: d = R * d_0
4385  *
4386  * La forza e' data dalla reazione vincolare F, nel sistema globale
4387  * La coppia dovuta all'eccentricita' e' data rispettivamente da:
4388  * d /\ F
4389  *
4390  *
4391  * x g F
4392  * Q1 | 0 0 I 0 | | x | | -F |
4393  * G1 | 0 cF/\d1/\-M/\ d/\ e1e2 | | g | | -d/\F-M |
4394  * F | I d/\ 0 0 | | F | | (x+d-x0)/c |
4395  * M | 0 e_0/\e1,e2 0 0 | | M | | e_0^Te1,e2 |
4396  *
4397  * con d = R*d_0, c = dCoef
4398  */
4399 
4400 
4401 
4402  /* Moltiplica la forza ed il momento per il coefficiente
4403  * del metodo */
4404 
4405  Vec3 e3(R0.GetVec(3));
4406  Vec3 e1(RhTmp.GetVec(1));
4407  Vec3 e2(RhTmp.GetVec(2));
4408  Vec3 MTmp(e2*M.dGet(1)-e1*M.dGet(2));
4409 
4410  Vec3 Tmp1((e2).Cross(e3));
4411  Vec3 Tmp2((e3).Cross(e1));
4412 
4413  /* termini di reazione sul nodo (forza e momento) */
4414  for (int iCnt = 1; iCnt <= 3; iCnt++) {
4415  WM.PutItem(iCnt, iFirstMomentumIndex+iCnt,
4416  iFirstReactionIndex+iCnt, 1.);
4417  WM.PutItem(3+iCnt, 3+iFirstMomentumIndex+iCnt,
4418  iFirstReactionIndex+4, Tmp1.dGet(iCnt));
4419  WM.PutItem(6+iCnt, 3+iFirstMomentumIndex+iCnt,
4420  iFirstReactionIndex+5, Tmp2.dGet(iCnt));
4421  }
4422 
4423  WM.PutCross(10, iFirstMomentumIndex+3,
4424  iFirstReactionIndex, dTmp);
4425 
4426 
4427  /* Nota: F ed M, le reazioni vincolari, sono state aggiornate da AssRes */
4428 
4429  /* Termini diagonali del tipo: c*F/\d/\Delta_g
4430  * nota: la forza e' gia' moltiplicata per dCoef */
4431  WM.PutMat3x3(16, iFirstMomentumIndex+3, iFirstPositionIndex+3,
4432  Mat3x3(MatCrossCross, F*dCoef, dTmp) + Mat3x3(MatCrossCross, e3, MTmp*dCoef));
4433 
4434  /* Modifica: divido le equazioni di vincolo per dCoef */
4435 
4436  /* termini di vincolo dovuti al nodo 1 */
4437  for (int iCnt = 1; iCnt <= 3; iCnt++) {
4438  WM.PutItem(24+iCnt, iFirstReactionIndex+iCnt,
4439  iFirstPositionIndex+iCnt, -1.);
4440  }
4441 
4442  WM.PutCross(28, iFirstReactionIndex,
4443  iFirstPositionIndex+3, dTmp);
4444 
4445  for (int iCnt = 1; iCnt <= 3; iCnt ++) {
4446  WM.PutItem(33+iCnt, iFirstReactionIndex+4,
4447  iFirstPositionIndex+3+iCnt, -Tmp1.dGet(iCnt));
4448  WM.PutItem(36+iCnt, iFirstReactionIndex+5,
4449  iFirstPositionIndex+3+iCnt, Tmp2.dGet(iCnt));
4450  }
4451 
4452  return WorkMat;
4453 }
void PutMat3x3(integer iSubIt, integer iFirstRow, integer iFirstCol, const Mat3x3 &m)
Definition: submat.cc:1331
virtual const Mat3x3 & GetRRef(void) const
Definition: strnode.h:1006
Definition: matvec3.h:98
void ResizeReset(integer iNewRow, integer iNewCol)
Definition: submat.cc:1084
void PutCross(integer iSubIt, integer iFirstRow, integer iFirstCol, const Vec3 &v)
Definition: submat.cc:1236
Vec3 GetVec(unsigned short int i) const
Definition: matvec3.h:893
const StructNode * pNode
Definition: planej.h:523
Mat3x3 Rh
Definition: planej.h:527
void PutItem(integer iSubIt, integer iRow, integer iCol, const doublereal &dCoef)
Definition: submat.h:997
const doublereal & dGet(unsigned short int iRow) const
Definition: matvec3.h:285
#define DEBUGCOUT(msg)
Definition: myassert.h:232
Mat3x3 R0
Definition: planej.h:525
virtual integer iGetFirstMomentumIndex(void) const =0
virtual integer iGetFirstPositionIndex(void) const
Definition: strnode.h:452
VectorExpression< VectorCrossExpr< VectorLhsExpr, VectorRhsExpr >, 3 > Cross(const VectorExpression< VectorLhsExpr, 3 > &u, const VectorExpression< VectorRhsExpr, 3 > &v)
Definition: matvec.h:3248
const MatCrossCross_Manip MatCrossCross
Definition: matvec3.cc:640
SparseSubMatrixHandler & SetSparse(void)
Definition: submat.h:1178
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
long int integer
Definition: colamd.c:51
Mat3x3 R

Here is the call graph for this function:

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

Implements Elem.

Definition at line 4457 of file planej.cc.

References VectorHandler::Add(), ASSERT, Vec3::Cross(), grad::Cross(), d, DEBUGCOUT, Vec3::dGet(), F, StructNode::GetRCurr(), Mat3x3::GetVec(), StructDispNode::GetXCurr(), DofOwnerOwner::iGetFirstIndex(), StructDispNode::iGetFirstMomentumIndex(), M, pNode, VectorHandler::PutCoef(), SubVectorHandler::PutRowIndex(), R, R0, VectorHandler::ResizeReset(), Rh, VectorHandler::Sub(), WorkSpaceDim(), and X0.

4461 {
4462  DEBUGCOUT("Entering PlanePinJoint::AssRes()" << std::endl);
4463 
4464  /* Dimensiona e resetta la matrice di lavoro */
4465  integer iNumRows = 0;
4466  integer iNumCols = 0;
4467  WorkSpaceDim(&iNumRows, &iNumCols);
4468  WorkVec.ResizeReset(iNumRows);
4469 
4470  integer iFirstMomentumIndex = pNode->iGetFirstMomentumIndex();
4471  integer iFirstReactionIndex = iGetFirstIndex();
4472 
4473  /* Indici dei nodi */
4474  for (int iCnt = 1; iCnt <= 6; iCnt++) {
4475  WorkVec.PutRowIndex(iCnt, iFirstMomentumIndex+iCnt);
4476  }
4477 
4478 
4479  /* Indici del vincolo */
4480  for (int iCnt = 1; iCnt <= 5; iCnt++) {
4481  WorkVec.PutRowIndex(6+iCnt, iFirstReactionIndex+iCnt);
4482  }
4483 
4484  F = Vec3(XCurr, iFirstReactionIndex+1);
4485  M = Vec3(XCurr(iFirstReactionIndex+4),
4486  XCurr(iFirstReactionIndex+5),
4487  0.);
4488 
4489  const Vec3& x(pNode->GetXCurr());
4490  const Mat3x3& R(pNode->GetRCurr());
4491 
4492  Vec3 dTmp(R*d);
4493  Mat3x3 RhTmp(R*Rh);
4494 
4495  Vec3 e3(R0.GetVec(3));
4496  Vec3 e1(RhTmp.GetVec(1));
4497  Vec3 e2(RhTmp.GetVec(2));
4498 
4499  WorkVec.Sub(1, F);
4500  WorkVec.Add(4, F.Cross(dTmp)-(e2*M.dGet(1)-e1*M.dGet(2)).Cross(e3)); /* Sfrutto il fatto che F/\d = -d/\F */
4501 
4502  /* Modifica: divido le equazioni di vincolo per dCoef */
4503  ASSERT(dCoef != 0.);
4504  WorkVec.Add(7, (x+dTmp-X0)/dCoef);
4505 
4506  WorkVec.PutCoef(10, e3.Dot(e2)/dCoef);
4507  WorkVec.PutCoef(11, e3.Dot(e1)/dCoef);
4508 
4509  return WorkVec;
4510 }
Vec3 Cross(const Vec3 &v) const
Definition: matvec3.h:218
Definition: matvec3.h:98
virtual void ResizeReset(integer)
Definition: vh.cc:55
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
virtual void Sub(integer iRow, const Vec3 &v)
Definition: vh.cc:78
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: planej.h:591
Vec3 GetVec(unsigned short int i) const
Definition: matvec3.h:893
const StructNode * pNode
Definition: planej.h:523
Mat3x3 Rh
Definition: planej.h:527
virtual void PutRowIndex(integer iSubRow, integer iRow)=0
const doublereal & dGet(unsigned short int iRow) const
Definition: matvec3.h:285
#define DEBUGCOUT(msg)
Definition: myassert.h:232
Mat3x3 R0
Definition: planej.h:525
virtual integer iGetFirstMomentumIndex(void) const =0
#define ASSERT(expression)
Definition: colamd.c:977
virtual void PutCoef(integer iRow, const doublereal &dCoef)=0
VectorExpression< VectorCrossExpr< VectorLhsExpr, VectorRhsExpr >, 3 > Cross(const VectorExpression< VectorLhsExpr, 3 > &u, const VectorExpression< VectorRhsExpr, 3 > &v)
Definition: matvec.h:3248
virtual const Vec3 & GetXCurr(void) const
Definition: strnode.h:310
virtual void Add(integer iRow, const Vec3 &v)
Definition: vh.cc:63
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
long int integer
Definition: colamd.c:51
Mat3x3 R

Here is the call graph for this function:

std::ostream & PlanePinJoint::DescribeDof ( std::ostream &  out,
const char *  prefix = "",
bool  bInitial = false 
) const
virtual

Reimplemented from Elem.

Definition at line 4003 of file planej.cc.

References DofOwnerOwner::iGetFirstIndex().

4004 {
4005  integer iIndex = iGetFirstIndex();
4006 
4007  out
4008  << prefix << iIndex + 1 << "->" << iIndex + 3 << ": "
4009  "reaction forces [Fx,Fy,Fz]" << std::endl
4010  << prefix << iIndex + 4 << "->" << iIndex + 5 << ": "
4011  "reaction couples [mx,my]" << std::endl;
4012 
4013  if (bInitial) {
4014  iIndex += 5;
4015  out
4016  << prefix << iIndex + 1 << "->" << iIndex + 3 << ": "
4017  "reaction force derivatives [FPx,FPy,FPz]" << std::endl
4018  << prefix << iIndex + 4 << "->" << iIndex + 5 << ": "
4019  "reaction couple derivatives [mPx,mPy]" << std::endl;
4020  }
4021 
4022  return out;
4023 }
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

void PlanePinJoint::DescribeDof ( std::vector< std::string > &  desc,
bool  bInitial = false,
int  i = -1 
) const
virtual

Reimplemented from Elem.

Definition at line 4026 of file planej.cc.

References WithLabel::GetLabel(), MBDYN_EXCEPT_ARGS, and xyz.

4027 {
4028  std::ostringstream os;
4029  os << "PlanePinJoint(" << GetLabel() << ")";
4030 
4031  unsigned short nself = 5;
4032  if (bInitial) {
4033  nself *= 2;
4034  }
4035 
4036  if (i == -1) {
4037  desc.resize(nself);
4038  std::string name = os.str();
4039 
4040  for (unsigned i = 0; i < 3; i++) {
4041  os.str(name);
4042  os.seekp(0, std::ios_base::end);
4043  os << ": reaction force f" << xyz[i];
4044  desc[i] = os.str();
4045  }
4046 
4047  for (unsigned i = 0; i < 2; i++) {
4048  os.str(name);
4049  os.seekp(0, std::ios_base::end);
4050  os << ": reaction couple m" << xyz[i];
4051  desc[3 + i] = os.str();
4052  }
4053 
4054  if (bInitial) {
4055  for (unsigned i = 0; i < 3; i++) {
4056  os.str(name);
4057  os.seekp(0, std::ios_base::end);
4058  os << ": reaction force derivative fP" << xyz[i];
4059  desc[5 + i] = os.str();
4060  }
4061 
4062  for (unsigned i = 0; i < 2; i++) {
4063  os.str(name);
4064  os.seekp(0, std::ios_base::end);
4065  os << ": reaction couple derivative mP" << xyz[i];
4066  desc[8 + i] = os.str();
4067  }
4068  }
4069 
4070  } else {
4071  if (i < -1) {
4072  // error
4074  }
4075 
4076  if (i >= nself) {
4077  // error
4079  }
4080 
4081  desc.resize(1);
4082 
4083  switch (i) {
4084  case 0:
4085  case 1:
4086  case 2:
4087  os << ": reaction force f" << xyz[i];
4088  break;
4089 
4090  case 3:
4091  case 4:
4092  os << ": reaction couple m" << xyz[i - 3];
4093  break;
4094 
4095  case 5:
4096  case 6:
4097  case 7:
4098  os << ": reaction force derivative fP" << xyz[i - 5];
4099  break;
4100 
4101  case 8:
4102  case 9:
4103  os << ": reaction couple derivative mP" << xyz[i - 8];
4104  break;
4105  }
4106  desc[0] = os.str();
4107  }
4108 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
static const char xyz[]
Definition: planej.cc:133
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

std::ostream & PlanePinJoint::DescribeEq ( std::ostream &  out,
const char *  prefix = "",
bool  bInitial = false 
) const
virtual

Reimplemented from Elem.

Definition at line 4111 of file planej.cc.

References DofOwnerOwner::iGetFirstIndex().

4112 {
4113  integer iIndex = iGetFirstIndex();
4114 
4115  out
4116  << prefix << iIndex + 1 << "->" << iIndex + 3 << ": "
4117  "position constraints [Px=Px0,Py=Py0,Pz=Pz0]" << std::endl
4118  << prefix << iIndex + 4 << "->" << iIndex + 5 << ": "
4119  "orientation constraints [gx=gx0,gy=gy0]" << std::endl;
4120 
4121  if (bInitial) {
4122  iIndex += 5;
4123  out
4124  << prefix << iIndex + 1 << "->" << iIndex + 3 << ": "
4125  "velocity constraints [vx=0,vy=0,vz=0]" << std::endl
4126  << prefix << iIndex + 4 << "->" << iIndex + 5 << ": "
4127  "angular velocity constraints [wx=0,wy=0]" << std::endl;
4128  }
4129 
4130  return out;
4131 }
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

void PlanePinJoint::DescribeEq ( std::vector< std::string > &  desc,
bool  bInitial = false,
int  i = -1 
) const
virtual

Reimplemented from Elem.

Definition at line 4134 of file planej.cc.

References WithLabel::GetLabel(), MBDYN_EXCEPT_ARGS, and xyz.

4135 {
4136  std::ostringstream os;
4137  os << "PlanePinJoint(" << GetLabel() << ")";
4138 
4139  unsigned short nself = 5;
4140  if (bInitial) {
4141  nself *= 2;
4142  }
4143 
4144  if (i == -1) {
4145  desc.resize(nself);
4146  std::string name = os.str();
4147 
4148  for (unsigned i = 0; i < 3; i++) {
4149  os.str(name);
4150  os.seekp(0, std::ios_base::end);
4151  os << ": position constraint P" << xyz[i];
4152  desc[i] = os.str();
4153  }
4154 
4155  for (unsigned i = 0; i < 2; i++) {
4156  os.str(name);
4157  os.seekp(0, std::ios_base::end);
4158  os << ": orientation constraint g" << xyz[i];
4159  desc[3 + i] = os.str();
4160  }
4161 
4162  if (bInitial) {
4163  for (unsigned i = 0; i < 3; i++) {
4164  os.str(name);
4165  os.seekp(0, std::ios_base::end);
4166  os << ": position constraint derivative v" << xyz[i];
4167  desc[5 + i] = os.str();
4168  }
4169 
4170  for (unsigned i = 0; i < 2; i++) {
4171  os.str(name);
4172  os.seekp(0, std::ios_base::end);
4173  os << ": orientation constraint derivative w" << xyz[i];
4174  desc[8 + i] = os.str();
4175  }
4176  }
4177 
4178  } else {
4179  if (i < -1) {
4180  // error
4182  }
4183 
4184  if (i >= nself) {
4185  // error
4187  }
4188 
4189  desc.resize(1);
4190 
4191  switch (i) {
4192  case 0:
4193  case 1:
4194  case 2:
4195  os << ": position constraint P" << xyz[i];
4196  break;
4197 
4198  case 3:
4199  case 4:
4200  os << ": orientation constraint g" << xyz[i - 3];
4201  break;
4202 
4203  case 5:
4204  case 6:
4205  case 7:
4206  os << ": position constraint derivative v" << xyz[i - 5];
4207  break;
4208 
4209  case 8:
4210  case 9:
4211  os << ": orientation constraint derivative w" << xyz[i - 8];
4212  break;
4213  }
4214  desc[0] = os.str();
4215  }
4216 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
static const char xyz[]
Definition: planej.cc:133
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

doublereal PlanePinJoint::dGetPrivData ( unsigned int  i) const
virtual

Reimplemented from SimulationEntity.

Definition at line 4829 of file planej.cc.

References ASSERT, dThetaWrapped, F, WithLabel::GetLabel(), StructNode::GetRCurr(), StructNode::GetWCurr(), iGetNumPrivData(), M, M_PI, MBDYN_EXCEPT_ARGS, Mat3x3::MulTM(), NTheta, pNode, R0, Rh, and RotManip::VecRot().

4830 {
4831  ASSERT(i >= 1 && i <= iGetNumPrivData());
4832 
4833  switch (i) {
4834  case 1: {
4836  doublereal dThetaTmp(v(3));
4837 
4838  int n = 0;
4839 
4840  if (dThetaTmp - dThetaWrapped < -M_PI) {
4841  n++;
4842  }
4843 
4844  if (dThetaTmp - dThetaWrapped > M_PI) {
4845  n--;
4846  }
4847 
4848  return 2*M_PI*(NTheta + n) + dThetaTmp;
4849  }
4850 
4851  case 2: {
4852  Mat3x3 RTmp(pNode->GetRCurr()*Rh);
4853  Vec3 v(RTmp.MulTV(pNode->GetWCurr()));
4854 
4855  return v(3);
4856  }
4857 
4858  case 3:
4859  case 4:
4860  case 5:
4861  return F(i - 2);
4862 
4863  case 6:
4864  case 7:
4865  case 8:
4866  return M(i - 5);
4867  }
4868 
4869  silent_cerr("PlanePinJoint(" << GetLabel() << "): "
4870  "illegal private data " << i << std::endl);
4872 }
#define M_PI
Definition: gradienttest.cc:67
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Definition: matvec3.h:98
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
int NTheta
Definition: planej.h:531
Vec3 VecRot(const Mat3x3 &Phi)
Definition: Rot.cc:136
const StructNode * pNode
Definition: planej.h:523
Mat3x3 Rh
Definition: planej.h:527
virtual unsigned int iGetNumPrivData(void) const
Definition: planej.cc:4786
Mat3x3 R0
Definition: planej.h:525
virtual const Vec3 & GetWCurr(void) const
Definition: strnode.h:1030
#define ASSERT(expression)
Definition: colamd.c:977
Mat3x3 MulTM(const Mat3x3 &m) const
Definition: matvec3.cc:500
doublereal dThetaWrapped
Definition: planej.h:532
double doublereal
Definition: colamd.c:52
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

virtual void PlanePinJoint::GetConnectedNodes ( std::vector< const Node * > &  connectedNodes) const
inlinevirtual

Reimplemented from Elem.

Definition at line 635 of file planej.h.

References pNode.

635  {
636  connectedNodes.resize(1);
637  connectedNodes[0] = pNode;
638  };
const StructNode * pNode
Definition: planej.h:523
virtual DofOrder::Order PlanePinJoint::GetDofType ( unsigned int  i) const
inlinevirtual

Reimplemented from Elem.

Definition at line 574 of file planej.h.

References DofOrder::ALGEBRAIC, and ASSERT.

574  {
575  ASSERT(i >= 0 && i < 5);
576  return DofOrder::ALGEBRAIC;
577  };
#define ASSERT(expression)
Definition: colamd.c:977
DofOrder::Order PlanePinJoint::GetEqType ( unsigned int  i) const
virtual

Reimplemented from SimulationEntity.

Definition at line 4297 of file planej.cc.

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

4298 {
4299  ASSERTMSGBREAK(i < iGetNumDof(),
4300  "INDEX ERROR in PlanePinJoint::GetEqType");
4301  return DofOrder::ALGEBRAIC;
4302 }
#define ASSERTMSGBREAK(expr, msg)
Definition: myassert.h:222
virtual unsigned int iGetNumDof(void) const
Definition: planej.h:556

Here is the call graph for this function:

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

Implements Joint.

Definition at line 546 of file planej.h.

References Joint::PIN.

546  {
547  return Joint::PIN;
548  };
virtual unsigned int PlanePinJoint::iGetInitialNumDof ( void  ) const
inlinevirtual

Implements SubjectToInitialAssembly.

Definition at line 610 of file planej.h.

610  {
611  return 10;
612  };
virtual unsigned int PlanePinJoint::iGetNumDof ( void  ) const
inlinevirtual

Reimplemented from Elem.

Definition at line 556 of file planej.h.

Referenced by GetEqType().

556  {
557  return 5;
558  };
unsigned int PlanePinJoint::iGetNumPrivData ( void  ) const
virtual

Reimplemented from SimulationEntity.

Definition at line 4786 of file planej.cc.

Referenced by dGetPrivData().

4787 {
4788  return 2;
4789 }
unsigned int PlanePinJoint::iGetPrivDataIdx ( const char *  s) const
virtual

Reimplemented from SimulationEntity.

Definition at line 4792 of file planej.cc.

References ASSERT.

4793 {
4794  ASSERT(s != NULL);
4795 
4796  unsigned int idx = 0;
4797 
4798  switch (s[0]) {
4799  case 'w':
4800  idx++;
4801  case 'r':
4802  idx++;
4803  if (s[1] == 'z') {
4804  return idx;
4805  }
4806  break;
4807 
4808  case 'M':
4809  idx += 3;
4810  case 'F':
4811  idx += 2;
4812 
4813  switch (s[1]) {
4814  case 'x':
4815  return idx + 1;
4816 
4817  case 'y':
4818  return idx + 2;
4819 
4820  case 'z':
4821  return idx + 3;
4822  }
4823  }
4824 
4825  return 0;
4826 }
#define ASSERT(expression)
Definition: colamd.c:977
VariableSubMatrixHandler & PlanePinJoint::InitialAssJac ( VariableSubMatrixHandler WorkMat,
const VectorHandler XCurr 
)
virtual

Implements SubjectToInitialAssembly.

Definition at line 4529 of file planej.cc.

References FullSubMatrixHandler::Add(), Vec3::Cross(), d, Vec3::dGet(), F, WithLabel::GetLabel(), StructNode::GetRRef(), Mat3x3::GetVec(), StructNode::GetWRef(), DofOwnerOwner::iGetFirstIndex(), StructDispNode::iGetFirstPositionIndex(), InitialWorkSpaceDim(), M, MatCross, MatCrossCross, MBDYN_EXCEPT_ARGS, pNode, FullSubMatrixHandler::PutCoef(), FullSubMatrixHandler::PutColIndex(), FullSubMatrixHandler::PutRowIndex(), R, R0, FullSubMatrixHandler::ResizeReset(), Rh, and VariableSubMatrixHandler::SetFull().

4531 {
4532  FullSubMatrixHandler& WM = WorkMat.SetFull();
4533 
4534  /* Dimensiona e resetta la matrice di lavoro */
4535  integer iNumRows = 0;
4536  integer iNumCols = 0;
4537  InitialWorkSpaceDim(&iNumRows, &iNumCols);
4538  WM.ResizeReset(iNumRows, iNumCols);
4539 
4540  /* Equazioni: vedi joints.dvi */
4541 
4542  /* Indici */
4543  integer iFirstPositionIndex = pNode->iGetFirstPositionIndex();
4544  integer iFirstVelocityIndex = iFirstPositionIndex+6;
4545  integer iFirstReactionIndex = iGetFirstIndex();
4546  integer iReactionPrimeIndex = iFirstReactionIndex+5;
4547 
4548  /* Setto gli indici */
4549  for (int iCnt = 1; iCnt <= 6; iCnt++) {
4550  WM.PutRowIndex(iCnt, iFirstPositionIndex+iCnt);
4551  WM.PutColIndex(iCnt, iFirstPositionIndex+iCnt);
4552  WM.PutRowIndex(6+iCnt, iFirstVelocityIndex+iCnt);
4553  WM.PutColIndex(6+iCnt, iFirstVelocityIndex+iCnt);
4554  }
4555 
4556  for (int iCnt = 1; iCnt <= 10; iCnt++) {
4557  WM.PutRowIndex(12+iCnt, iFirstReactionIndex+iCnt);
4558  WM.PutColIndex(12+iCnt, iFirstReactionIndex+iCnt);
4559  }
4560 
4561  /* Matrici identita' */
4562 
4563  for (int iCnt = 1; iCnt <= 3; iCnt++) {
4564  /* Contributo di forza all'equazione della forza */
4565  WM.PutCoef(iCnt, 12+iCnt, 1.);
4566 
4567  /* Contrib. di der. di forza all'eq. della der. della forza */
4568  WM.PutCoef(6+iCnt, 17+iCnt, 1.);
4569 
4570  /* Equazione di vincolo */
4571  WM.PutCoef(12+iCnt, iCnt, -1.);
4572 
4573  /* Derivata dell'equazione di vincolo */
4574  WM.PutCoef(17+iCnt, 6+iCnt, -1.);
4575  }
4576 
4577  /* Recupera i dati */
4578  const Mat3x3& R(pNode->GetRRef());
4579  const Vec3& Omega(pNode->GetWRef());
4580  /* F, M sono state aggiornate da InitialAssRes */
4581  Vec3 FPrime(XCurr, iReactionPrimeIndex+1);
4582  Vec3 MPrime(XCurr(iReactionPrimeIndex+4),
4583  XCurr(iReactionPrimeIndex+5),
4584  0.);
4585 
4586  /* Distanza nel sistema globale */
4587  Vec3 dTmp(R*d);
4588  Mat3x3 RhTmp(R*Rh);
4589 
4590  Vec3 e3(R0.GetVec(3));
4591  Vec3 e1(RhTmp.GetVec(1));
4592  Vec3 e2(RhTmp.GetVec(2));
4593 
4594  /* Vettori temporanei */
4595  Vec3 Tmp1(e2.Cross(e3));
4596  Vec3 Tmp2(e3.Cross(e1));
4597 
4598  /* Prodotto vettore tra il versore 3 della cerniera secondo il nodo 1
4599  * ed il versore 1 della cerniera secondo il nodo 2. A convergenza
4600  * devono essere ortogonali, quindi il loro prodotto vettore deve essere
4601  * unitario */
4602 
4603  /* Error handling: il programma si ferma, pero' segnala dov'e' l'errore */
4604  if (Tmp1.Dot() <= std::numeric_limits<doublereal>::epsilon() || Tmp2.Dot() <= std::numeric_limits<doublereal>::epsilon()) {
4605  silent_cerr("PlanePinJoint(" << GetLabel() << "): "
4606  "node and fixed point hinge axes are (nearly) orthogonal"
4607  << std::endl);
4609  }
4610 
4611  Vec3 TmpPrime1(e3.Cross(e2.Cross(Omega)));
4612  Vec3 TmpPrime2(e3.Cross(Omega.Cross(e1)));
4613 
4614  /* Ruota il momento e la sua derivata con le matrici della cerniera
4615  * rispetto ai nodi */
4616  Vec3 MTmp(e2*M.dGet(1)-e1*M.dGet(2));
4617  Vec3 MPrimeTmp(e2*MPrime.dGet(1)-e1*MPrime.dGet(2));
4618 
4619  Mat3x3 MDeltag(Mat3x3(MatCrossCross, e3, MPrimeTmp) + e3.Cross(Mat3x3(MatCrossCross, Omega, MTmp)));
4620 
4621  /* Matrici F/\d/\ */
4622  Mat3x3 FWedgedWedge(MatCrossCross, F, dTmp);
4623 
4624  /* Matrici (omega/\d)/\ */
4625  Mat3x3 OWedgedWedge(MatCross, Omega.Cross(dTmp));
4626 
4627  /* Equazione di momento */
4628  WM.Add(4, 4, FWedgedWedge + Mat3x3(MatCrossCross, e3, MTmp));
4629  WM.Add(4, 13, Mat3x3(MatCross, dTmp));
4630 
4631  /* Derivata dell'equazione di momento */
4632  WM.Add(10, 4, (Mat3x3(MatCross, FPrime) + Mat3x3(MatCrossCross, F, Omega))*Mat3x3(MatCross, dTmp) + MDeltag);
4633  WM.Add(10, 10, FWedgedWedge + Mat3x3(MatCrossCross, e3, MTmp));
4634  WM.Add(10, 13, OWedgedWedge);
4635  WM.Add(10, 18, Mat3x3(MatCross, dTmp));
4636 
4637  for (int iCnt = 1; iCnt <= 3; iCnt++) {
4638  doublereal d = Tmp1(iCnt);
4639  WM.PutCoef(3+iCnt, 16, d);
4640  WM.PutCoef(9+iCnt, 21, d);
4641 
4642  d = Tmp2(iCnt);
4643  WM.PutCoef(3+iCnt, 17, d);
4644  WM.PutCoef(9+iCnt, 22, d);
4645 
4646  WM.PutCoef(9+iCnt, 16, TmpPrime1(iCnt));
4647  WM.PutCoef(9+iCnt, 17, TmpPrime2(iCnt));
4648  }
4649 
4650  /* Equazione di vincolo */
4651  WM.Add(13, 4, Mat3x3(MatCross, dTmp));
4652 
4653  /* Derivata dell'equazione di vincolo */
4654  WM.Add(18, 4, OWedgedWedge);
4655  WM.Add(18, 10, Mat3x3(MatCross, dTmp));
4656 
4657  /* Equazioni di vincolo di rotazione: e1b~e3a, e2b~e3a */
4658  for (int iCnt = 1; iCnt <= 3; iCnt++) {
4659  doublereal d = -Tmp1(iCnt);
4660  WM.PutCoef(16, 3+iCnt, d);
4661 
4662  /* Queste sono per la derivata dell'equazione, sono qui solo per
4663  * ottimizzazione */
4664  WM.PutCoef(21, 9+iCnt, d);
4665 
4666  d = Tmp2(iCnt);
4667  WM.PutCoef(17, 3+iCnt, d);
4668 
4669  /* Queste sono per la derivata dell'equazione, sono qui solo per
4670  * ottimizzazione */
4671  WM.PutCoef(22, 9+iCnt, d);
4672  }
4673 
4674  /* Derivate delle equazioni di vincolo di rotazione: e1b~e3a, e2b~e3a */
4675  TmpPrime2 = e2.Cross(Omega.Cross(e3));
4676  for (int iCnt = 1; iCnt <= 3; iCnt++) {
4677  WM.PutCoef(21, 3+iCnt, TmpPrime2(iCnt));
4678  }
4679 
4680  TmpPrime2 = e1.Cross(Omega.Cross(e3));
4681  for (int iCnt = 1; iCnt <= 3; iCnt++) {
4682  WM.PutCoef(22, 3+iCnt, TmpPrime2(iCnt));
4683  }
4684 
4685  return WorkMat;
4686 }
void PutColIndex(integer iSubCol, integer iCol)
Definition: submat.h:325
virtual const Mat3x3 & GetRRef(void) const
Definition: strnode.h:1006
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Definition: matvec3.h:98
const MatCross_Manip MatCross
Definition: matvec3.cc:639
FullSubMatrixHandler & SetFull(void)
Definition: submat.h:1168
void Add(integer iRow, integer iCol, const Vec3 &v)
Definition: submat.cc:209
void PutCoef(integer iRow, integer iCol, const doublereal &dCoef)
Definition: submat.h:672
virtual const Vec3 & GetWRef(void) const
Definition: strnode.h:1024
Vec3 GetVec(unsigned short int i) const
Definition: matvec3.h:893
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: planej.h:613
const StructNode * pNode
Definition: planej.h:523
Mat3x3 Rh
Definition: planej.h:527
const doublereal & dGet(unsigned short int iRow) const
Definition: matvec3.h:285
Mat3x3 R0
Definition: planej.h:525
virtual integer iGetFirstPositionIndex(void) const
Definition: strnode.h:452
virtual void ResizeReset(integer, integer)
Definition: submat.cc:182
const MatCrossCross_Manip MatCrossCross
Definition: matvec3.cc:640
void PutRowIndex(integer iSubRow, integer iRow)
Definition: submat.h:311
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
unsigned int GetLabel(void) const
Definition: withlab.cc:62
Mat3x3 R

Here is the call graph for this function:

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

Implements SubjectToInitialAssembly.

Definition at line 4691 of file planej.cc.

References VectorHandler::Add(), Vec3::Cross(), d, DEBUGCOUT, Vec3::dGet(), F, StructNode::GetRCurr(), StructDispNode::GetVCurr(), Mat3x3::GetVec(), StructNode::GetWCurr(), StructDispNode::GetXCurr(), DofOwnerOwner::iGetFirstIndex(), StructDispNode::iGetFirstPositionIndex(), InitialWorkSpaceDim(), M, pNode, VectorHandler::PutCoef(), SubVectorHandler::PutRowIndex(), R, R0, VectorHandler::ResizeReset(), Rh, VectorHandler::Sub(), and X0.

4693 {
4694  DEBUGCOUT("Entering PlanePinJoint::InitialAssRes()" << std::endl);
4695 
4696  /* Dimensiona e resetta la matrice di lavoro */
4697  integer iNumRows = 0;
4698  integer iNumCols = 0;
4699  InitialWorkSpaceDim(&iNumRows, &iNumCols);
4700  WorkVec.ResizeReset(iNumRows);
4701 
4702  /* Indici */
4703  integer iFirstPositionIndex = pNode->iGetFirstPositionIndex();
4704  integer iFirstVelocityIndex = iFirstPositionIndex+6;
4705  integer iFirstReactionIndex = iGetFirstIndex();
4706  integer iReactionPrimeIndex = iFirstReactionIndex+5;
4707 
4708  /* Setta gli indici */
4709  for (int iCnt = 1; iCnt <= 6; iCnt++) {
4710  WorkVec.PutRowIndex(iCnt, iFirstPositionIndex+iCnt);
4711  WorkVec.PutRowIndex(6+iCnt, iFirstVelocityIndex+iCnt);
4712  }
4713 
4714  for (int iCnt = 1; iCnt <= 10; iCnt++) {
4715  WorkVec.PutRowIndex(12+iCnt, iFirstReactionIndex+iCnt);
4716  }
4717 
4718  /* Recupera i dati */
4719  const Vec3& x(pNode->GetXCurr());
4720  const Vec3& v(pNode->GetVCurr());
4721  const Mat3x3& R(pNode->GetRCurr());
4722  const Vec3& Omega(pNode->GetWCurr());
4723 
4724  Mat3x3 RhTmp(R*Rh);
4725 
4726  F = Vec3(XCurr, iFirstReactionIndex+1);
4727  M = Vec3(XCurr(iFirstReactionIndex+4),
4728  XCurr(iFirstReactionIndex+5),
4729  0.);
4730  Vec3 FPrime(XCurr, iReactionPrimeIndex+1);
4731  Vec3 MPrime(XCurr(iReactionPrimeIndex+4),
4732  XCurr(iReactionPrimeIndex+5),
4733  0.);
4734 
4735  /* Versori delle cerniere */
4736  Vec3 e3(R0.GetVec(3));
4737  Vec3 e1(RhTmp.GetVec(1));
4738  Vec3 e2(RhTmp.GetVec(2));
4739 
4740  /* Vettori temporanei */
4741  Vec3 Tmp1(e2.Cross(e3));
4742  Vec3 Tmp2(e3.Cross(e1));
4743 
4744  Vec3 TmpPrime1(e3.Cross(e2.Cross(Omega)));
4745  Vec3 TmpPrime2(e3.Cross(Omega.Cross(e1)));
4746 
4747  /* Distanza nel sistema globale */
4748  Vec3 dTmp(R*d);
4749 
4750  /* Vettori omega/\d */
4751  Vec3 OWedged(Omega.Cross(dTmp));
4752 
4753  /* Ruota il momento e la sua derivata con le matrici della cerniera
4754  * rispetto ai nodi */
4755  Vec3 MTmp(e2*M.dGet(1)-e1*M.dGet(2));
4756  Vec3 MPrimeTmp(e3.Cross(MTmp.Cross(Omega))+
4757  e2.Cross(e3)*MPrime.dGet(1)+e3.Cross(e1)*MPrime.dGet(2));
4758 
4759  /* Equazioni di equilibrio */
4760  WorkVec.Sub(1, F);
4761  WorkVec.Add(4, F.Cross(dTmp)-MTmp.Cross(e3)); /* Sfrutto il fatto che F/\d = -d/\F */
4762 
4763  /* Derivate delle equazioni di equilibrio, nodo 1 */
4764  WorkVec.Sub(7, FPrime);
4765  WorkVec.Add(10, FPrime.Cross(dTmp)-OWedged.Cross(F)-MPrimeTmp);
4766 
4767  /* Equazione di vincolo di posizione */
4768  WorkVec.Add(13, x+dTmp-X0);
4769 
4770  /* Equazioni di vincolo di rotazione */
4771  WorkVec.PutCoef(16, e2.Dot(e3));
4772  WorkVec.PutCoef(17, e1.Dot(e3));
4773 
4774  /* Derivata dell'equazione di vincolo di posizione */
4775  WorkVec.Add(18, v+OWedged);
4776 
4777  /* Derivate delle equazioni di vincolo di rotazione: e1b~e3a, e2b~e3a */
4778  Vec3 Tmp(e3.Cross(Omega));
4779  WorkVec.PutCoef(21, e2.Dot(Tmp));
4780  WorkVec.PutCoef(22, e1.Dot(Tmp));
4781 
4782  return WorkVec;
4783 }
Vec3 Cross(const Vec3 &v) const
Definition: matvec3.h:218
Definition: matvec3.h:98
virtual void ResizeReset(integer)
Definition: vh.cc:55
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
virtual void Sub(integer iRow, const Vec3 &v)
Definition: vh.cc:78
Vec3 GetVec(unsigned short int i) const
Definition: matvec3.h:893
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: planej.h:613
const StructNode * pNode
Definition: planej.h:523
Mat3x3 Rh
Definition: planej.h:527
virtual void PutRowIndex(integer iSubRow, integer iRow)=0
const doublereal & dGet(unsigned short int iRow) const
Definition: matvec3.h:285
#define DEBUGCOUT(msg)
Definition: myassert.h:232
Mat3x3 R0
Definition: planej.h:525
virtual integer iGetFirstPositionIndex(void) const
Definition: strnode.h:452
virtual const Vec3 & GetWCurr(void) const
Definition: strnode.h:1030
virtual void PutCoef(integer iRow, const doublereal &dCoef)=0
virtual const Vec3 & GetXCurr(void) const
Definition: strnode.h:310
virtual void Add(integer iRow, const Vec3 &v)
Definition: vh.cc:63
virtual const Vec3 & GetVCurr(void) const
Definition: strnode.h:322
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
long int integer
Definition: colamd.c:51
Mat3x3 R

Here is the call graph for this function:

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

Implements SubjectToInitialAssembly.

Definition at line 613 of file planej.h.

Referenced by InitialAssJac(), and InitialAssRes().

614  {
615  *piNumRows = 22;
616  *piNumCols = 22;
617  };
void PlanePinJoint::Output ( OutputHandler OH) const
virtual

Reimplemented from ToBeOutput.

Definition at line 4513 of file planej.cc.

References ToBeOutput::bToBeOutput(), dRaDegr, F, WithLabel::GetLabel(), StructNode::GetRCurr(), StructNode::GetWCurr(), OutputHandler::Joints(), M, MatR2EulerAngles(), Mat3x3::MulTM(), Joint::Output(), pNode, R0, and Rh.

4514 {
4515  if (bToBeOutput()) {
4516  Mat3x3 RTmp(pNode->GetRCurr()*Rh);
4517  Mat3x3 R0Tmp(R0.MulTM(RTmp));
4518 
4519  Joint::Output(OH.Joints(), "PlanePin", GetLabel(),
4520  RTmp.MulTV(F), M, F, RTmp*M)
4521  << " " << MatR2EulerAngles(R0Tmp)*dRaDegr
4522  << " " << RTmp.MulTV(pNode->GetWCurr()) << std::endl;
4523  }
4524 }
virtual bool bToBeOutput(void) const
Definition: output.cc:890
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
const StructNode * pNode
Definition: planej.h:523
Mat3x3 Rh
Definition: planej.h:527
Mat3x3 R0
Definition: planej.h:525
virtual const Vec3 & GetWCurr(void) const
Definition: strnode.h:1030
const doublereal dRaDegr
Definition: matvec3.cc:884
std::ostream & Joints(void) const
Definition: output.h:443
Mat3x3 MulTM(const Mat3x3 &m) const
Definition: matvec3.cc:500
Vec3 MatR2EulerAngles(const Mat3x3 &R)
Definition: matvec3.cc:887
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

Here is the call graph for this function:

Hint * PlanePinJoint::ParseHint ( DataManager pDM,
const char *  s 
) const
virtual

Reimplemented from SimulationEntity.

Definition at line 4260 of file planej.cc.

References STRLENOF.

4261 {
4262  if (strncasecmp(s, "offset{" /*}*/, STRLENOF("offset{" /*}*/)) == 0) {
4263  s += STRLENOF("offset{" /*}*/);
4264 
4265  if (strcmp(&s[1], /* { */ "}") != 0) {
4266  return 0;
4267  }
4268 
4269  switch (s[0]) {
4270  case '1':
4271  return new Joint::OffsetHint<1>;
4272 
4273  case '0':
4274  return new Joint::OffsetHint<0>;
4275  }
4276 
4277  } else if (strncasecmp(s, "hinge{" /*}*/, STRLENOF("hinge{" /*}*/)) == 0) {
4278  s += STRLENOF("hinge{" /*}*/);
4279 
4280  if (strcmp(&s[1], /*{*/ "}") != 0) {
4281  return 0;
4282  }
4283 
4284  switch (s[0]) {
4285  case '1':
4286  return new Joint::HingeHint<1>;
4287 
4288  case '0':
4289  return new Joint::HingeHint<0>;
4290  }
4291  }
4292 
4293  return 0;
4294 }
#define STRLENOF(s)
Definition: mbdyn.h:166
void PlanePinJoint::ReadInitialState ( MBDynParser HP)
virtual

Reimplemented from SimulationEntity.

Definition at line 4329 of file planej.cc.

References F, HighParser::GetReal(), MBDynParser::GetVec3(), and M.

4330 {
4331  F = HP.GetVec3();
4332  M = Vec3(HP.GetReal(), HP.GetReal(), 0.);
4333 }
Definition: matvec3.h:98
virtual Vec3 GetVec3(void)
Definition: mbpar.cc:2220
virtual doublereal GetReal(const doublereal &dDefval=0.0)
Definition: parser.cc:1056

Here is the call graph for this function:

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

Implements Elem.

Definition at line 4336 of file planej.cc.

References d, Vec3::dGet(), dTheta, F, WithLabel::GetLabel(), Mat3x3::GetVec(), M, pNode, R0, Joint::Restart(), Rh, Write(), Vec3::Write(), and X0.

4337 {
4338  Joint::Restart(out) << ", revolute pin, "
4339  << pNode->GetLabel()
4340  << ", reference, node, ", d.Write(out, ", ")
4341  << ", hinge, reference, node, 1, ",
4342  (Rh.GetVec(1)).Write(out, ", ") << ", 2, ",
4343  (Rh.GetVec(2)).Write(out, ", ")
4344  << ", reference, global, ", X0.Write(out, ", ")
4345  << ",hinge, reference, global, 1, ",
4346  (R0.GetVec(1)).Write(out, ", ") << ", 2, ",
4347  (R0.GetVec(2)).Write(out, ", ") << ", "
4348  << "initial theta, " << dTheta << ", "
4349  << "initial state, ", F.Write(out, ", ")
4350  << ", " << M.dGet(1) << ", " << M.dGet(2) << ';' << std::endl;
4351 
4352  return out;
4353 }
std::ostream & Write(std::ostream &out, const char *sFill=" ") const
Definition: matvec3.cc:738
std::ostream & Write(std::ostream &out, const FullMatrixHandler &m, const char *s, const char *s2)
Definition: fullmh.cc:376
Vec3 GetVec(unsigned short int i) const
Definition: matvec3.h:893
const StructNode * pNode
Definition: planej.h:523
Mat3x3 Rh
Definition: planej.h:527
const doublereal & dGet(unsigned short int iRow) const
Definition: matvec3.h:285
Mat3x3 R0
Definition: planej.h:525
virtual std::ostream & Restart(std::ostream &out) const
Definition: joint.h:195
doublereal dTheta
Definition: planej.h:532
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

void PlanePinJoint::SetValue ( DataManager pDM,
VectorHandler X,
VectorHandler XP,
SimulationEntity::Hints ph = 0 
)
virtual

Reimplemented from Joint.

Definition at line 4219 of file planej.cc.

References calcInitdTheta, d, dTheta, dThetaWrapped, StructNode::GetRCurr(), StructDispNode::GetXCurr(), Mat3x3::MulTM(), Mat3x3::MulTV(), pNode, R, R0, Rh, RotManip::VecRot(), and X0.

4222 {
4223  if (ph) {
4224  for (unsigned i = 0; i < ph->size(); i++) {
4225  Joint::JointHint *pjh = dynamic_cast<Joint::JointHint *>((*ph)[i]);
4226 
4227  if (pjh == 0) {
4228  continue;
4229  }
4230 
4231  if (dynamic_cast<Joint::OffsetHint<1> *>(pjh)) {
4232  const Mat3x3& R(pNode->GetRCurr());
4233 
4234  d = R.MulTV(X0 - pNode->GetXCurr());
4235 
4236  } else if (dynamic_cast<Joint::OffsetHint<0> *>(pjh)) {
4237  Vec3 dTmp(pNode->GetRCurr()*d);
4238 
4239  X0 = R0.MulTV(pNode->GetXCurr() + dTmp);
4240 
4241  } else if (dynamic_cast<Joint::HingeHint<1> *>(pjh)) {
4242  Rh = pNode->GetRCurr().MulTM(R0);
4243 
4244  } else if (dynamic_cast<Joint::HingeHint<2> *>(pjh)) {
4245  R0 = pNode->GetRCurr()*Rh;
4246 
4247  } else if (dynamic_cast<Joint::ReactionsHint *>(pjh)) {
4248  /* TODO */
4249  }
4250  }
4251  }
4252 
4253  if (calcInitdTheta) {
4255  dThetaWrapped = dTheta = v.dGet(3);
4256  }
4257 }
Definition: matvec3.h:98
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
Vec3 VecRot(const Mat3x3 &Phi)
Definition: Rot.cc:136
Vec3 MulTV(const Vec3 &v) const
Definition: matvec3.cc:482
const StructNode * pNode
Definition: planej.h:523
Mat3x3 Rh
Definition: planej.h:527
bool calcInitdTheta
Definition: planej.h:530
Mat3x3 R0
Definition: planej.h:525
Mat3x3 MulTM(const Mat3x3 &m) const
Definition: matvec3.cc:500
virtual const Vec3 & GetXCurr(void) const
Definition: strnode.h:310
doublereal dThetaWrapped
Definition: planej.h:532
doublereal dTheta
Definition: planej.h:532
Mat3x3 R

Here is the call graph for this function:

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

Implements Elem.

Definition at line 591 of file planej.h.

Referenced by AssRes().

591  {
592  *piNumRows = 11;
593  *piNumCols = 11;
594  };

Member Data Documentation

bool PlanePinJoint::calcInitdTheta
private

Definition at line 530 of file planej.h.

Referenced by SetValue().

Vec3 PlanePinJoint::d
private

Definition at line 526 of file planej.h.

Referenced by AssJac(), AssRes(), InitialAssJac(), InitialAssRes(), Restart(), and SetValue().

doublereal PlanePinJoint::dTheta
mutableprivate

Definition at line 532 of file planej.h.

Referenced by AfterConvergence(), Restart(), and SetValue().

doublereal PlanePinJoint::dThetaWrapped
mutableprivate

Definition at line 532 of file planej.h.

Referenced by AfterConvergence(), dGetPrivData(), and SetValue().

Vec3 PlanePinJoint::F
private
Vec3 PlanePinJoint::M
private
int PlanePinJoint::NTheta
mutableprivate

Definition at line 531 of file planej.h.

Referenced by AfterConvergence(), and dGetPrivData().

const StructNode* PlanePinJoint::pNode
private
Mat3x3 PlanePinJoint::R0
private
Mat3x3 PlanePinJoint::Rh
private
Vec3 PlanePinJoint::X0
private

Definition at line 524 of file planej.h.

Referenced by AssRes(), InitialAssRes(), Restart(), and SetValue().


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