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

#include <planej.h>

Inheritance diagram for PlaneHingeJoint:
Collaboration diagram for PlaneHingeJoint:

Public Member Functions

 PlaneHingeJoint (unsigned int uL, const DofOwner *pDO, const StructNode *pN1, const StructNode *pN2, const Vec3 &dTmp1, const Vec3 &dTmp2, const Mat3x3 &R1hTmp, const Mat3x3 &R2hTmp, const OrientationDescription &od, flag fOut, const bool _calcInitdTheta=true, const doublereal initDTheta=0., const doublereal rr=0., const doublereal pref=0., BasicShapeCoefficient *const sh=0, BasicFriction *const f=0)
 
 ~PlaneHingeJoint (void)
 
virtual void ReadInitialState (MBDynParser &HP)
 
virtual std::ostream & Restart (std::ostream &out) const
 
virtual Joint::Type GetJointType (void) 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
 
DofOrder::Order GetDofType (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)
 
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)
 
DofOrder::Order GetEqType (unsigned int i) const
 
void OutputPrepare (OutputHandler &OH)
 
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 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)
 

Protected Attributes

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
 

Private Attributes

const StructNodepNode1
 
const StructNodepNode2
 
Vec3 d1
 
Mat3x3 R1h
 
Vec3 d2
 
Mat3x3 R2h
 
Vec3 F
 
Vec3 M
 
bool calcInitdTheta
 
int NTheta
 
doublereal dTheta
 
doublereal dThetaWrapped
 
BasicShapeCoefficient *const Sh_c
 
BasicFriction *const fc
 
const doublereal preF
 
const doublereal r
 
doublereal M3
 

Static Private Attributes

static const unsigned int NumSelfDof
 
static const unsigned int NumDof
 

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
 

Detailed Description

Definition at line 43 of file planej.h.

Constructor & Destructor Documentation

PlaneHingeJoint::PlaneHingeJoint ( unsigned int  uL,
const DofOwner pDO,
const StructNode pN1,
const StructNode pN2,
const Vec3 dTmp1,
const Vec3 dTmp2,
const Mat3x3 R1hTmp,
const Mat3x3 R2hTmp,
const OrientationDescription od,
flag  fOut,
const bool  _calcInitdTheta = true,
const doublereal  initDTheta = 0.,
const doublereal  rr = 0.,
const doublereal  pref = 0.,
BasicShapeCoefficient *const  sh = 0,
BasicFriction *const  f = 0 
)

Definition at line 49 of file planej.cc.

References NO_OP, SAFEDELETEARR, SAFENEWARR, and STRLENOF.

61 : Elem(uL, fOut),
62 Joint(uL, pDO, fOut),
63 pNode1(pN1), pNode2(pN2),
64 d1(dTmp1), R1h(R1hTmp), d2(dTmp2), R2h(R2hTmp), F(Zero3), M(Zero3),
65 #ifdef USE_NETCDF
66 Var_Phi(0),
67 Var_Omega(0),
68 //Var_MFR(0),
69 //Var_MU(0),
70 #endif // USE_NETCDF
71 calcInitdTheta(_calcInitdTheta), NTheta(0), dTheta(initDTheta), dThetaWrapped(initDTheta),
72 Sh_c(sh), fc(f), preF(pref), r(rr),
73 od(od)
74 {
75  NO_OP;
76  char * fname = NULL;
77  int n = (uL > 0 ? 1 + (int)log10(uL) : 1);
78  int len = STRLENOF("hinge") + n + STRLENOF(".out") + 1;
79  SAFENEWARR(fname, char, len);
80  snprintf(fname, len, "hinge%.*d.out", n, uL);
81  SAFEDELETEARR(fname);
82 }
const doublereal preF
Definition: planej.h:75
const Vec3 Zero3(0., 0., 0.)
const StructNode * pNode2
Definition: planej.h:54
BasicShapeCoefficient *const Sh_c
Definition: planej.h:73
const doublereal r
Definition: planej.h:76
#define SAFEDELETEARR(pnt)
Definition: mynewmem.h:713
Joint(unsigned int uL, const DofOwner *pD, flag fOut)
Definition: joint.cc:83
#define NO_OP
Definition: myassert.h:74
bool calcInitdTheta
Definition: planej.h:68
BasicFriction *const fc
Definition: planej.h:74
OrientationDescription od
Definition: planej.h:83
doublereal dThetaWrapped
Definition: planej.h:70
#define STRLENOF(s)
Definition: mbdyn.h:166
Mat3x3 R2h
Definition: planej.h:58
#define SAFENEWARR(pnt, item, sz)
Definition: mynewmem.h:701
Elem(unsigned int uL, flag fOut)
Definition: elem.cc:41
Mat3x3 R1h
Definition: planej.h:56
const StructNode * pNode1
Definition: planej.h:53
doublereal dTheta
Definition: planej.h:70
PlaneHingeJoint::~PlaneHingeJoint ( void  )

Definition at line 86 of file planej.cc.

References fc, and Sh_c.

87 {
88  if (Sh_c) {
89  delete Sh_c;
90  }
91 
92  if (fc) {
93  delete fc;
94  }
95 }
BasicShapeCoefficient *const Sh_c
Definition: planej.h:73
BasicFriction *const fc
Definition: planej.h:74

Member Function Documentation

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

Reimplemented from SimulationEntity.

Definition at line 473 of file planej.cc.

References BasicFriction::AfterConvergence(), grad::Dot(), dTheta, dThetaWrapped, F, fc, StructNode::GetRCurr(), StructNode::GetWCurr(), DofOwnerOwner::iGetFirstIndex(), M_PI, Vec3::Norm(), NTheta, NumSelfDof, pNode1, pNode2, preF, r, R1h, R2h, and RotManip::VecRot().

475 {
477  doublereal dThetaTmp(v(3));
478 
479  // unwrap
480  if (dThetaTmp - dThetaWrapped < -M_PI) {
481  NTheta++;
482  }
483 
484  if (dThetaTmp - dThetaWrapped > M_PI) {
485  NTheta--;
486  }
487 
488  // save new wrapped angle
489  dThetaWrapped = dThetaTmp;
490 
491  // compute new unwrapped angle
493 
494  if (fc) {
495  Mat3x3 R1(pNode1->GetRCurr());
496  Mat3x3 R1hTmp(R1*R1h);
497  Vec3 e3a(R1hTmp.GetVec(3));
498  Vec3 Omega1(pNode1->GetWCurr());
499  Vec3 Omega2(pNode2->GetWCurr());
500  //relative velocity
501  doublereal v = (Omega1-Omega2).Dot(e3a)*r;
502  //reaction norm
503  doublereal modF = std::max(F.Norm(), preF);;
505  }
506 }
const doublereal preF
Definition: planej.h:75
#define M_PI
Definition: gradienttest.cc:67
Definition: matvec3.h:98
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
doublereal Norm(void) const
Definition: matvec3.h:263
const StructNode * pNode2
Definition: planej.h:54
const doublereal r
Definition: planej.h:76
Vec3 VecRot(const Mat3x3 &Phi)
Definition: Rot.cc:136
virtual void AfterConvergence(const doublereal F, const doublereal v, const VectorHandler &X, const VectorHandler &XP, const unsigned int solution_startdof)
Definition: friction.h:96
BasicFriction *const fc
Definition: planej.h:74
virtual const Vec3 & GetWCurr(void) const
Definition: strnode.h:1030
DotTraits< VectorExprLhs, VectorExprRhs, N_rows, N_rows >::ExpressionType Dot(const VectorExpression< VectorExprLhs, N_rows > &u, const VectorExpression< VectorExprRhs, N_rows > &v)
Definition: matvec.h:3133
doublereal dThetaWrapped
Definition: planej.h:70
Mat3x3 R2h
Definition: planej.h:58
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
double doublereal
Definition: colamd.c:52
Mat3x3 R1h
Definition: planej.h:56
const StructNode * pNode1
Definition: planej.h:53
doublereal dTheta
Definition: planej.h:70
static const unsigned int NumSelfDof
Definition: planej.h:78

Here is the call graph for this function:

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

Implements Elem.

Definition at line 540 of file planej.cc.

References ExpandableMatrix::Add(), FullSubMatrixHandler::Add(), BasicFriction::AssJac(), d1, d2, DEBUGCOUT, Vec3::dGet(), grad::Dot(), BasicShapeCoefficient::dSh_c(), F, BasicFriction::fc(), fc, StructNode::GetRRef(), Mat3x3::GetVec(), StructNode::GetWCurr(), DofOwnerOwner::iGetFirstIndex(), StructDispNode::iGetFirstMomentumIndex(), StructDispNode::iGetFirstPositionIndex(), iGetNumDof(), ExpandableMatrix::Link(), M, MatCross, MatCrossCross, Vec3::Norm(), NumSelfDof, pNode1, pNode2, preF, FullSubMatrixHandler::PutCoef(), FullSubMatrixHandler::PutColIndex(), FullSubMatrixHandler::PutRowIndex(), r, R1h, R2h, ExpandableRowVector::ReDim(), ExpandableMatrix::ReDim(), FullSubMatrixHandler::ResizeReset(), ExpandableRowVector::Set(), ExpandableMatrix::Set(), ExpandableMatrix::SetBlockDim(), VariableSubMatrixHandler::SetFull(), Sh_c, BasicShapeCoefficient::Sh_c(), ExpandableMatrix::Sub(), FullSubMatrixHandler::Sub(), WorkSpaceDim(), and Zero3.

544 {
545  DEBUGCOUT("Entering PlaneHingeJoint::AssJac()" << std::endl);
546 
547  /* Setta la sottomatrice come piena (e' un po' dispersivo, ma lo jacobiano
548  * e' complicato */
549  FullSubMatrixHandler& WM = WorkMat.SetFull();
550 
551  /* Ridimensiona la sottomatrice in base alle esigenze */
552  integer iNumRows = 0;
553  integer iNumCols = 0;
554  WorkSpaceDim(&iNumRows, &iNumCols);
555  WM.ResizeReset(iNumRows, iNumCols);
556 
557  /* Recupera gli indici delle varie incognite */
558  integer iNode1FirstPosIndex = pNode1->iGetFirstPositionIndex();
559  integer iNode1FirstMomIndex = pNode1->iGetFirstMomentumIndex();
560  integer iNode2FirstPosIndex = pNode2->iGetFirstPositionIndex();
561  integer iNode2FirstMomIndex = pNode2->iGetFirstMomentumIndex();
562  integer iFirstReactionIndex = iGetFirstIndex();
563 
564  /* Setta gli indici delle equazioni */
565  for (unsigned int iCnt = 1; iCnt <= 6; iCnt++) {
566  WM.PutRowIndex(iCnt, iNode1FirstMomIndex+iCnt);
567  WM.PutColIndex(iCnt, iNode1FirstPosIndex+iCnt);
568  WM.PutRowIndex(6+iCnt, iNode2FirstMomIndex+iCnt);
569  WM.PutColIndex(6+iCnt, iNode2FirstPosIndex+iCnt);
570  }
571 
572  for (unsigned int iCnt = 1; iCnt <= iGetNumDof(); iCnt++) {
573  WM.PutRowIndex(12+iCnt, iFirstReactionIndex+iCnt);
574  WM.PutColIndex(12+iCnt, iFirstReactionIndex+iCnt);
575  }
576 
577  /* Recupera i dati che servono */
578  const Mat3x3& R1(pNode1->GetRRef());
579  const Mat3x3& R2(pNode2->GetRRef());
580  Vec3 d1Tmp(R1*d1);
581  Vec3 d2Tmp(R2*d2);
582  Mat3x3 R1hTmp(R1*R1h);
583  Mat3x3 R2hTmp(R2*R2h);
584 
585  /* Suppongo che le reazioni F, M siano gia' state aggiornate da AssRes;
586  * ricordo che la forza F e' nel sistema globale, mentre la coppia M
587  * e' nel sistema locale ed il terzo termine, M(3), e' nullo in quanto
588  * diretto come l'asse attorno al quale la rotazione e' consentita */
589 
590 
591  /*
592  * La cerniera piana ha le prime 3 equazioni uguali alla cerniera sferica;
593  * inoltre ha due equazioni che affermano la coincidenza dell'asse 3 del
594  * riferimento solidale con la cerniera visto dai due nodi.
595  *
596  * (R1 * R1h * e1)^T * (R2 * R2h * e3) = 0
597  * (R1 * R1h * e2)^T * (R2 * R2h * e3) = 0
598  *
599  * A queste equazioni corrisponde una reazione di coppia agente attorno
600  * agli assi 1 e 2 del riferimento della cerniera. La coppia attorno
601  * all'asse 3 e' nulla per definizione. Quindi la coppia nel sistema
602  * globale e':
603  * -R1 * R1h * M per il nodo 1,
604  * R2 * R2h * M per il nodo 2
605  *
606  *
607  * xa ga xb gb F M
608  * Qa | 0 0 0 0 I 0 | | xa | | -F |
609  * Ga | 0 c*(F/\da/\-(Sa*M)/\) 0 0 da/\ Sa | | ga | | -da/\F-Sa*M |
610  * Qb | 0 0 0 0 -I 0 | | xb | = | F |
611  * Gb | 0 0 0 -c*(F/\db/\-(Sb*M)/\) -db/\ -Sb | | gb | | db/\F+Sb*M |
612  * F | -c*I c*da/\ c*I -c*db/\ 0 0 | | F | | xa+da-xb-db |
613  * M1 | 0 c*Tb1^T*Ta3/\ 0 c*Ta3^T*Tb1/\ 0 0 | | M | | Sb^T*Ta3 |
614  * M2 | 0 c*Tb2^T*Ta3/\ 0 c*Ta3^T*Tb2/\ 0 0 |
615  *
616  * con da = R1*d01, db = R2*d02, c = dCoef,
617  * Sa = R1*R1h*[e1,e2], Sb = R2*R2h*[e1, e2],
618  * Ta3 = R1*R1h*e3, Tb1 = R2*R2h*e1, Tb2 = R2*R2h*e2
619  */
620 
621  /* Contributo della forza alle equazioni di equilibrio dei due nodi */
622  for (int iCnt = 1; iCnt <= 3; iCnt++) {
623  WM.PutCoef(iCnt, 12+iCnt, 1.);
624  WM.PutCoef(6+iCnt, 12+iCnt, -1.);
625  }
626 
627  WM.Add(4, 13, Mat3x3(MatCross, d1Tmp));
628  WM.Sub(10, 13, Mat3x3(MatCross, d2Tmp));
629 
630  /* Moltiplica la forza ed il momento per il coefficiente
631  * del metodo */
632  Vec3 FTmp = F*dCoef;
633  Vec3 MTmp = M*dCoef;
634 
635  Vec3 e3a(R1hTmp.GetVec(3));
636  Vec3 e1b(R2hTmp.GetVec(1));
637  Vec3 e2b(R2hTmp.GetVec(2));
638  MTmp = e2b*MTmp.dGet(1)-e1b*MTmp.dGet(2);
639 
640  Mat3x3 MWedgee3aWedge(MatCrossCross, MTmp, e3a);
641  Mat3x3 e3aWedgeMWedge(MatCrossCross, e3a, MTmp);
642 
643  WM.Add(4, 4, Mat3x3(MatCrossCross, FTmp, d1Tmp) - MWedgee3aWedge);
644  WM.Add(4, 10, e3aWedgeMWedge);
645 
646  WM.Add(10, 4, MWedgee3aWedge);
647  WM.Sub(10, 10, Mat3x3(MatCrossCross, FTmp, d2Tmp) + e3aWedgeMWedge);
648 
649  /* Contributo del momento alle equazioni di equilibrio dei nodi */
650  Vec3 Tmp1(e2b.Cross(e3a));
651  Vec3 Tmp2(e3a.Cross(e1b));
652 
653  for (int iCnt = 1; iCnt <= 3; iCnt++) {
654  doublereal d = Tmp1.dGet(iCnt);
655  WM.PutCoef(3+iCnt, 16, d);
656  WM.PutCoef(9+iCnt, 16, -d);
657  d = Tmp2.dGet(iCnt);
658  WM.PutCoef(3+iCnt, 17, d);
659  WM.PutCoef(9+iCnt, 17, -d);
660  }
661 
662  /* Modifica: divido le equazioni di vincolo per dCoef */
663 
664  /* Equazioni di vincolo degli spostamenti */
665  for (int iCnt = 1; iCnt <= 3; iCnt++) {
666  WM.PutCoef(12+iCnt, iCnt, -1.);
667  WM.PutCoef(12+iCnt, 6+iCnt, 1.);
668  }
669 
670  WM.Add(13, 4, Mat3x3(MatCross, d1Tmp));
671  WM.Sub(13, 10, Mat3x3(MatCross, d2Tmp));
672 
673  /* Equazione di vincolo del momento
674  *
675  * Attenzione: bisogna scrivere il vettore trasposto
676  * (Sb[1]^T*(Sa[3]/\))*dCoef
677  * Questo pero' e' uguale a:
678  * (-Sa[3]/\*Sb[1])^T*dCoef,
679  * che puo' essere ulteriormente semplificato:
680  * (Sa[3].Cross(Sb[1])*(-dCoef))^T;
681  */
682 
683  for (int iCnt = 1; iCnt <= 3; iCnt++) {
684  doublereal d = Tmp1.dGet(iCnt);
685  WM.PutCoef(16, 3+iCnt, d);
686  WM.PutCoef(16, 9+iCnt, -d);
687  d = Tmp2.dGet(iCnt);
688  WM.PutCoef(17, 3+iCnt, -d);
689  WM.PutCoef(17, 9+iCnt, d);
690  }
691 
692  if (fc) {
693  //retrive
694  //friction coef
695  doublereal f = fc->fc();
696  //shape function
697  doublereal shc = Sh_c->Sh_c();
698  //omega and omega rif
699  const Vec3& Omega1(pNode1->GetWCurr());
700  const Vec3& Omega2(pNode2->GetWCurr());
701  // const Vec3& Omega1r(pNode1->GetWRef());
702  // const Vec3& Omega2r(pNode2->GetWRef());
703  //compute
704  //relative velocity
705  doublereal v = (Omega1-Omega2).Dot(e3a)*r;
706  //reaction norm
707  doublereal modF = std::max(F.Norm(), preF);
708  //reaction moment
709  //doublereal M3 = shc*modF*r;
710 
714  //variation of reaction force
715  dF.ReDim(3);
716  if ((modF == 0.) or (F.Norm() < preF)) {
717  dF.Set(Vec3(Zero3),1,12+1);
718  } else {
719  dF.Set(F/modF,1,12+1);
720  }
721  //variation of relative velocity
722  dv.ReDim(6);
723 
724 /* old (wrong?) relative velocity linearization */
725 
726 // dv.Set((e3a.dGet(1)*1.-( e3a.dGet(2)*Omega1r.dGet(3)-e3a.dGet(3)*Omega1r.dGet(2))*dCoef)*r,1,0+4);
727 // dv.Set((e3a.dGet(2)*1.-(-e3a.dGet(1)*Omega1r.dGet(3)+e3a.dGet(3)*Omega1r.dGet(1))*dCoef)*r,2,0+5);
728 // dv.Set((e3a.dGet(3)*1.-( e3a.dGet(1)*Omega1r.dGet(2)-e3a.dGet(2)*Omega1r.dGet(1))*dCoef)*r,3,0+6);
729 //
730 // dv.Set(-(e3a.dGet(1)*1.-( e3a.dGet(2)*Omega2r.dGet(3)-e3a.dGet(3)*Omega2r.dGet(2))*dCoef)*r,4,6+4);
731 // dv.Set(-(e3a.dGet(2)*1.-(-e3a.dGet(1)*Omega2r.dGet(3)+e3a.dGet(3)*Omega2r.dGet(1))*dCoef)*r,5,6+5);
732 // dv.Set(-(e3a.dGet(3)*1.-( e3a.dGet(1)*Omega2r.dGet(2)-e3a.dGet(2)*Omega2r.dGet(1))*dCoef)*r,6,6+6);
733 
734 /* new (exact?) relative velocity linearization */
735 //
736 // ExpandableRowVector domega11, domega12, domega13;
737 // ExpandableRowVector domega21, domega22, domega23;
738 // domega11.ReDim(3); domega12.ReDim(3); domega13.ReDim(3);
739 // domega21.ReDim(3); domega22.ReDim(3); domega23.ReDim(3);
740 //
741 // domega11.Set(1., 1, 0+4);
742 // domega11.Set( Omega1r.dGet(3)*dCoef, 2, 0+5);
743 // domega11.Set(-Omega1r.dGet(2)*dCoef, 3, 0+6);
744 // domega21.Set(1., 1, 6+4);
745 // domega21.Set( Omega2r.dGet(3)*dCoef, 2, 6+5);
746 // domega21.Set(-Omega2r.dGet(2)*dCoef, 3, 6+6);
747 // domega12.Set(1., 1, 0+5);
748 // domega12.Set(-Omega1r.dGet(3)*dCoef, 2, 0+4);
749 // domega12.Set( Omega1r.dGet(1)*dCoef, 3, 0+6);
750 // domega22.Set(1., 1, 6+5);
751 // domega22.Set(-Omega2r.dGet(3)*dCoef, 2, 6+4);
752 // domega22.Set( Omega2r.dGet(1)*dCoef, 3, 6+6);
753 // domega13.Set(1., 1, 0+6);
754 // domega13.Set( Omega1r.dGet(2)*dCoef, 2, 0+4);
755 // domega13.Set(-Omega1r.dGet(1)*dCoef, 3, 0+5);
756 // domega23.Set(1., 1, 6+6);
757 // domega23.Set( Omega2r.dGet(2)*dCoef, 2, 6+4);
758 // domega23.Set(-Omega2r.dGet(1)*dCoef, 3, 6+5);
759 //
760 // Vec3 domega = Omega1-Omega2;
761 // dv.Set((e3a.dGet(1)*1.-(
762 // e3a.dGet(2)*(Omega1.dGet(3)-Omega2.dGet(3))-
763 // e3a.dGet(3)*(domega.dGet(2)))*dCoef)*r,1);
764 // dv.Link(1, &domega11);
765 // dv.Set((e3a.dGet(2)*1.-(
766 // -e3a.dGet(1)*(Omega1.dGet(3)-Omega2.dGet(3))+
767 // e3a.dGet(3)*(domega.dGet(1)))*dCoef)*r,2);
768 // dv.Link(2, &domega12);
769 // dv.Set((e3a.dGet(3)*1.-(
770 // e3a.dGet(1)*(Omega1.dGet(2)-Omega2.dGet(2))-
771 // e3a.dGet(2)*(domega.dGet(1)))*dCoef)*r,3);
772 // dv.Link(3, &domega13);
773 //
774 // dv.Set(-(e3a.dGet(1)*1.)*r,4,6+4); dv.Link(4, &domega21);
775 // dv.Set(-(e3a.dGet(2)*1.)*r,5,6+5); dv.Link(5, &domega22);
776 // dv.Set(-(e3a.dGet(3)*1.)*r,6,6+6); dv.Link(6, &domega23);
777 
778 
779 /* new (approximate: assume constant triads orientations)
780  * relative velocity linearization
781 */
782 
783  dv.Set(e3a*r,1, 0+4);
784  dv.Set(-e3a*r,4, 6+4);
785 
786  //assemble friction states
787  fc->AssJac(WM,dfc,12+NumSelfDof,iFirstReactionIndex+NumSelfDof,dCoef,modF,v,
788  XCurr,XPrimeCurr,dF,dv);
789  ExpandableMatrix dM3;
790  ExpandableRowVector dShc;
791  //compute
792  //variation of shape function
793  Sh_c->dSh_c(dShc,f,modF,v,dfc,dF,dv);
794  //variation of moment component
795  dM3.ReDim(3,2);
796  dM3.SetBlockDim(1,1);
797  dM3.SetBlockDim(2,1);
798  dM3.Set(e3a*shc*r,1,1); dM3.Link(1,&dF);
799  dM3.Set(e3a*modF*r,1,2); dM3.Link(2,&dShc);
800  //assemble first node
801  //variation of moment component
802  dM3.Add(WM, 4, 1.);
803  //assemble second node
804  //variation of moment component
805  dM3.Sub(WM, 6+4, 1.);
806  }
807 
808  return WorkMat;
809 }
const doublereal preF
Definition: planej.h:75
void PutColIndex(integer iSubCol, integer iCol)
Definition: submat.h:325
const Vec3 Zero3(0., 0., 0.)
void Set(doublereal xx, integer i, integer iidx)
Definition: JacSubMatrix.cc:95
virtual const Mat3x3 & GetRRef(void) const
Definition: strnode.h:1006
Definition: matvec3.h:98
const MatCross_Manip MatCross
Definition: matvec3.cc:639
FullSubMatrixHandler & SetFull(void)
Definition: submat.h:1168
doublereal Norm(void) const
Definition: matvec3.h:263
void Add(integer iRow, integer iCol, const Vec3 &v)
Definition: submat.cc:209
const StructNode * pNode2
Definition: planej.h:54
BasicShapeCoefficient *const Sh_c
Definition: planej.h:73
const doublereal r
Definition: planej.h:76
void Set(doublereal xx, integer eq, integer block, integer block_col=1)
virtual unsigned int iGetNumDof(void) const
Definition: planej.cc:917
void PutCoef(integer iRow, integer iCol, const doublereal &dCoef)
Definition: submat.h:672
void Sub(doublereal xx, integer eq, integer block, integer block_col=1)
virtual doublereal Sh_c(void) const =0
virtual doublereal fc(void) const =0
void ReDim(const integer n)
Definition: JacSubMatrix.cc:50
void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: planej.h:141
const doublereal & dGet(unsigned short int iRow) const
Definition: matvec3.h:285
BasicFriction *const fc
Definition: planej.h:74
#define DEBUGCOUT(msg)
Definition: myassert.h:232
virtual integer iGetFirstMomentumIndex(void) const =0
virtual integer iGetFirstPositionIndex(void) const
Definition: strnode.h:452
virtual const Vec3 & GetWCurr(void) const
Definition: strnode.h:1030
void Add(doublereal xx, integer eq, integer block, integer block_col=1)
DotTraits< VectorExprLhs, VectorExprRhs, N_rows, N_rows >::ExpressionType Dot(const VectorExpression< VectorExprLhs, N_rows > &u, const VectorExpression< VectorExprRhs, N_rows > &v)
Definition: matvec.h:3133
virtual void dSh_c(ExpandableRowVector &dShc, const doublereal f, const doublereal F, const doublereal v, const ExpandableRowVector &dfc, const ExpandableRowVector &dF, const ExpandableRowVector &dv) const =0
void ReDim(const integer n, const integer m)
virtual void ResizeReset(integer, integer)
Definition: submat.cc:182
virtual void AssJac(FullSubMatrixHandler &WorkMat, ExpandableRowVector &dfc, const unsigned int startdof, const unsigned int solution_startdof, const doublereal dCoef, const doublereal F, const doublereal v, const VectorHandler &X, const VectorHandler &XP, const ExpandableRowVector &dF, const ExpandableRowVector &dv) const =0
const MatCrossCross_Manip MatCrossCross
Definition: matvec3.cc:640
void PutRowIndex(integer iSubRow, integer iRow)
Definition: submat.h:311
Mat3x3 R2h
Definition: planej.h:58
void Sub(integer iRow, integer iCol, const Vec3 &v)
Definition: submat.cc:215
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
double doublereal
Definition: colamd.c:52
void SetBlockDim(const integer block, const integer ncols)
Mat3x3 R1h
Definition: planej.h:56
long int integer
Definition: colamd.c:51
void Link(const integer block, const ExpandableMatrix *const xp)
const StructNode * pNode1
Definition: planej.h:53
static const unsigned int NumSelfDof
Definition: planej.h:78

Here is the call graph for this function:

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

!!!!!!!!!!!!!

Implements Elem.

Definition at line 813 of file planej.cc.

References VectorHandler::Add(), ASSERT, BasicFriction::AssRes(), Vec3::Cross(), d1, d2, DEBUGCOUT, Vec3::dGet(), Vec3::Dot(), grad::Dot(), F, BasicFriction::fc(), fc, StructNode::GetRCurr(), Mat3x3::GetVec(), StructNode::GetWCurr(), StructDispNode::GetXCurr(), DofOwnerOwner::iGetFirstIndex(), StructDispNode::iGetFirstMomentumIndex(), iGetNumDof(), M, M3, MBDYN_EXCEPT_ARGS, Vec3::Norm(), NumSelfDof, pNode1, pNode2, preF, VectorHandler::PutCoef(), SubVectorHandler::PutRowIndex(), r, R1h, R2h, VectorHandler::ResizeReset(), Sh_c, BasicShapeCoefficient::Sh_c(), VectorHandler::Sub(), and WorkSpaceDim().

817 {
818  DEBUGCOUT("Entering PlaneHingeJoint::AssRes()" << std::endl);
819 
820  /* Dimensiona e resetta la matrice di lavoro */
821  integer iNumRows = 0;
822  integer iNumCols = 0;
823  WorkSpaceDim(&iNumRows, &iNumCols);
824  WorkVec.ResizeReset(iNumRows);
825 
826  /* Indici */
827  integer iNode1FirstMomIndex = pNode1->iGetFirstMomentumIndex();
828  integer iNode2FirstMomIndex = pNode2->iGetFirstMomentumIndex();
829  integer iFirstReactionIndex = iGetFirstIndex();
830 
831  /* Indici dei nodi */
832  for (int iCnt = 1; iCnt <= 6; iCnt++) {
833  WorkVec.PutRowIndex(iCnt, iNode1FirstMomIndex+iCnt);
834  WorkVec.PutRowIndex(6+iCnt, iNode2FirstMomIndex+iCnt);
835  }
836 
837  /* Indici del vincolo */
838  for (unsigned int iCnt = 1; iCnt <= iGetNumDof(); iCnt++) {
839  WorkVec.PutRowIndex(12+iCnt, iFirstReactionIndex+iCnt);
840  }
841 
842  /* Aggiorna i dati propri */
843  F = Vec3(XCurr, iFirstReactionIndex+1);
844  M = Vec3(XCurr(iFirstReactionIndex+4),
845  XCurr(iFirstReactionIndex+5),
846  0.);
847 
848  /*
849  * FIXME: provare a mettere "modificatori" di forza/momento sui gdl
850  * residui: attrito, rigidezze e smorzamenti, ecc.
851  */
852 
853  /* Recupera i dati */
854  const Vec3& x1(pNode1->GetXCurr());
855  const Vec3& x2(pNode2->GetXCurr());
856  const Mat3x3& R1(pNode1->GetRCurr());
857  const Mat3x3& R2(pNode2->GetRCurr());
858 
859  /* Costruisce i dati propri nella configurazione corrente */
860  Vec3 dTmp1(R1*d1);
861  Vec3 dTmp2(R2*d2);
862  Mat3x3 R1hTmp(R1*R1h);
863  Mat3x3 R2hTmp(R2*R2h);
864 
865  Vec3 e3a(R1hTmp.GetVec(3));
866  Vec3 e1b(R2hTmp.GetVec(1));
867  Vec3 e2b(R2hTmp.GetVec(2));
868 
869  Vec3 MTmp(e2b.Cross(e3a)*M.dGet(1)+e3a.Cross(e1b)*M.dGet(2));
870 
871  /* Equazioni di equilibrio, nodo 1 */
872  WorkVec.Sub(1, F);
873  WorkVec.Add(4, F.Cross(dTmp1)-MTmp); /* Sfrutto F/\d = -d/\F */
874 
875  /* Equazioni di equilibrio, nodo 2 */
876  WorkVec.Add(7, F);
877  WorkVec.Add(10, dTmp2.Cross(F)+MTmp);
878 
879  /* Modifica: divido le equazioni di vincolo per dCoef */
880  ASSERT(dCoef != 0.);
881 
882  /* Equazione di vincolo di posizione */
883  WorkVec.Add(13, (x1+dTmp1-x2-dTmp2)/dCoef);
884 
885  /* Equazioni di vincolo di rotazione */
886  Vec3 Tmp = R1hTmp.GetVec(3);
887  WorkVec.PutCoef(16, Tmp.Dot(R2hTmp.GetVec(2))/dCoef);
888  WorkVec.PutCoef(17, Tmp.Dot(R2hTmp.GetVec(1))/dCoef);
889 
890  if (fc) {
891  bool ChangeJac(false);
892  const Vec3& Omega1(pNode1->GetWCurr());
893  const Vec3& Omega2(pNode2->GetWCurr());
894  doublereal v = (Omega1-Omega2).Dot(e3a)*r;
895  doublereal modF = std::max(F.Norm(), preF);
896  try {
897  fc->AssRes(WorkVec,12+NumSelfDof,iFirstReactionIndex+NumSelfDof,modF,v,XCurr,XPrimeCurr);
898  }
900  ChangeJac = true;
901  }
902  doublereal f = fc->fc();
903  doublereal shc = Sh_c->Sh_c(f,modF,v);
904  M3 = shc*modF*r;
905  WorkVec.Sub(4,e3a*M3);
906  WorkVec.Add(10,e3a*M3);
908 // M += e3a*M3;
909  if (ChangeJac) {
911  }
912  }
913 
914  return WorkVec;
915 }
const doublereal preF
Definition: planej.h:75
doublereal M3
Definition: planej.h:77
Vec3 Cross(const Vec3 &v) const
Definition: matvec3.h:218
virtual void AssRes(SubVectorHandler &WorkVec, const unsigned int startdof, const unsigned int solution_startdof, const doublereal F, const doublereal v, const VectorHandler &X, const VectorHandler &XP)=0
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Definition: matvec3.h:98
virtual void ResizeReset(integer)
Definition: vh.cc:55
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
doublereal Norm(void) const
Definition: matvec3.h:263
doublereal Dot(const Vec3 &v) const
Definition: matvec3.h:243
const StructNode * pNode2
Definition: planej.h:54
BasicShapeCoefficient *const Sh_c
Definition: planej.h:73
const doublereal r
Definition: planej.h:76
virtual void Sub(integer iRow, const Vec3 &v)
Definition: vh.cc:78
virtual unsigned int iGetNumDof(void) const
Definition: planej.cc:917
virtual doublereal Sh_c(void) const =0
virtual doublereal fc(void) const =0
virtual void PutRowIndex(integer iSubRow, integer iRow)=0
void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: planej.h:141
const doublereal & dGet(unsigned short int iRow) const
Definition: matvec3.h:285
BasicFriction *const fc
Definition: planej.h:74
#define DEBUGCOUT(msg)
Definition: myassert.h:232
virtual integer iGetFirstMomentumIndex(void) const =0
virtual const Vec3 & GetWCurr(void) const
Definition: strnode.h:1030
DotTraits< VectorExprLhs, VectorExprRhs, N_rows, N_rows >::ExpressionType Dot(const VectorExpression< VectorExprLhs, N_rows > &u, const VectorExpression< VectorExprRhs, N_rows > &v)
Definition: matvec.h:3133
#define ASSERT(expression)
Definition: colamd.c:977
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
Mat3x3 R2h
Definition: planej.h:58
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
double doublereal
Definition: colamd.c:52
Mat3x3 R1h
Definition: planej.h:56
long int integer
Definition: colamd.c:51
const StructNode * pNode1
Definition: planej.h:53
static const unsigned int NumSelfDof
Definition: planej.h:78

Here is the call graph for this function:

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

Reimplemented from Elem.

Definition at line 98 of file planej.cc.

References SimulationEntity::DescribeDof(), fc, DofOwnerOwner::iGetFirstIndex(), SimulationEntity::iGetNumDof(), and NumSelfDof.

99 {
100  integer iIndex = iGetFirstIndex();
101 
102  out
103  << prefix << iIndex + 1 << "->" << iIndex + 3 << ": "
104  "reaction forces [Fx,Fy,Fz]" << std::endl
105  << prefix << iIndex + 4 << "->" << iIndex + 5 << ": "
106  "reaction couples [mx,my]" << std::endl;
107 
108  if (bInitial) {
109  iIndex += NumSelfDof;
110  out
111  << prefix << iIndex + 1 << "->" << iIndex + 3 << ": "
112  "reaction force derivatives [FPx,FPy,FPz]" << std::endl
113  << prefix << iIndex + 4 << "->" << iIndex + 5 << ": "
114  "reaction couple derivatives [mPx,mPy]" << std::endl;
115  }
116 
117  iIndex += NumSelfDof;
118  if (fc) {
119  integer iFCDofs = fc->iGetNumDof();
120  if (iFCDofs > 0) {
121  out << prefix << iIndex + 1;
122  if (iFCDofs > 1) {
123  out << "->" << iIndex + iFCDofs;
124  }
125  out << ": friction dof(s)" << std::endl
126  << " ", fc->DescribeDof(out, prefix, bInitial);
127  }
128  }
129 
130  return out;
131 }
BasicFriction *const fc
Definition: planej.h:74
virtual std::ostream & DescribeDof(std::ostream &out, const char *prefix="", bool bInitial=false) const =0
virtual unsigned int iGetNumDof(void) const =0
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
long int integer
Definition: colamd.c:51
static const unsigned int NumSelfDof
Definition: planej.h:78

Here is the call graph for this function:

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

Reimplemented from Elem.

Definition at line 136 of file planej.cc.

References SimulationEntity::DescribeDof(), fc, WithLabel::GetLabel(), MBDYN_EXCEPT_ARGS, NumSelfDof, and xyz.

137 {
138  std::ostringstream os;
139  os << "PlaneHingeJoint(" << GetLabel() << ")";
140 
141  unsigned short nself = NumSelfDof;
142  if (bInitial) {
143  nself *= 2;
144  }
145  if (fc && (i == -1 || i >= nself)) {
146  fc->DescribeDof(desc, bInitial, i - nself);
147  if (i != -1) {
148  desc[0] = os.str() + ": " + desc[0];
149  return;
150  }
151  }
152 
153  if (i == -1) {
154  // move fc desc to the end
155  unsigned short nfc = 0;
156  if (fc) {
157  nfc = desc.size();
158  }
159  desc.resize(nfc + nself);
160  for (unsigned i = nfc; i-- > 0; ) {
161  desc[nself + i] = os.str() + ": " + desc[nfc];
162  }
163 
164  std::string name = os.str();
165 
166  for (unsigned i = 0; i < 3; i++) {
167  os.str(name);
168  os.seekp(0, std::ios_base::end);
169  os << ": reaction force f" << xyz[i];
170  desc[i] = os.str();
171  }
172 
173  for (unsigned i = 0; i < 2; i++) {
174  os.str(name);
175  os.seekp(0, std::ios_base::end);
176  os << ": reaction couple m" << xyz[i];
177  desc[3 + i] = os.str();
178  }
179 
180  if (bInitial) {
181  for (unsigned i = 0; i < 3; i++) {
182  os.str(name);
183  os.seekp(0, std::ios_base::end);
184  os << ": reaction force derivative fP" << xyz[i];
185  desc[3 + 2 + i] = os.str();
186  }
187 
188  for (unsigned i = 0; i < 2; i++) {
189  os.str(name);
190  os.seekp(0, std::ios_base::end);
191  os << ": reaction couple derivative mP" << xyz[i];
192  desc[3 + 2 + 3 + i] = os.str();
193  }
194  }
195 
196  } else {
197  if (i < -1) {
198  // error
200  }
201 
202  if (i >= nself) {
203  // error
205  }
206 
207  desc.resize(1);
208 
209  switch (i) {
210  case 0:
211  case 1:
212  case 2:
213  os << ": reaction force f" << xyz[i];
214  break;
215 
216  case 3:
217  case 4:
218  os << ": reaction couple m" << xyz[i - 3];
219  break;
220 
221  case 5:
222  case 6:
223  case 7:
224  os << ": reaction force derivative fP" << xyz[i - 3 - 2];
225  break;
226 
227  case 8:
228  case 9:
229  os << ": reaction couple derivative mP" << xyz[i - 3 - 2 - 3];
230  break;
231  }
232  desc[0] = os.str();
233  }
234 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
static const char xyz[]
Definition: planej.cc:133
BasicFriction *const fc
Definition: planej.h:74
virtual std::ostream & DescribeDof(std::ostream &out, const char *prefix="", bool bInitial=false) const =0
unsigned int GetLabel(void) const
Definition: withlab.cc:62
static const unsigned int NumSelfDof
Definition: planej.h:78

Here is the call graph for this function:

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

Reimplemented from Elem.

Definition at line 237 of file planej.cc.

References SimulationEntity::DescribeEq(), fc, DofOwnerOwner::iGetFirstIndex(), SimulationEntity::iGetNumDof(), and NumSelfDof.

238 {
239  integer iIndex = iGetFirstIndex();
240 
241  out
242  << prefix << iIndex + 1 << "->" << iIndex + 3 << ": "
243  "position constraints [Px1=Px2,Py1=Py2,Pz1=Pz2]" << std::endl
244  << prefix << iIndex + 4 << "->" << iIndex + 5 << ": "
245  "orientation constraints [gx1=gx2,gy1=gy2]" << std::endl;
246 
247  if (bInitial) {
248  iIndex += NumSelfDof;
249  out
250  << prefix << iIndex + 1 << "->" << iIndex + 3 << ": "
251  "velocity constraints [vx1=vx2,vy1=vy2,vz1=vz2]" << std::endl
252  << prefix << iIndex + 4 << "->" << iIndex + 5 << ": "
253  "angular velocity constraints [wx1=wx2,wy1=wy2]" << std::endl;
254  }
255 
256  iIndex += NumSelfDof;
257  if (fc) {
258  integer iFCDofs = fc->iGetNumDof();
259  if (iFCDofs > 0) {
260  out << prefix << iIndex + 1;
261  if (iFCDofs > 1) {
262  out << "->" << iIndex + iFCDofs;
263  }
264  out << ": friction equation(s)" << std::endl
265  << " ", fc->DescribeEq(out, prefix, bInitial);
266  }
267  }
268 
269  return out;
270 }
BasicFriction *const fc
Definition: planej.h:74
virtual std::ostream & DescribeEq(std::ostream &out, const char *prefix="", bool bInitial=false) const =0
virtual unsigned int iGetNumDof(void) const =0
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
long int integer
Definition: colamd.c:51
static const unsigned int NumSelfDof
Definition: planej.h:78

Here is the call graph for this function:

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

Reimplemented from Elem.

Definition at line 273 of file planej.cc.

References SimulationEntity::DescribeEq(), fc, WithLabel::GetLabel(), MBDYN_EXCEPT_ARGS, NumSelfDof, and xyz.

274 {
275  std::ostringstream os;
276  os << "PlaneHingeJoint(" << GetLabel() << ")";
277 
278  unsigned short nself = NumSelfDof;
279  if (bInitial) {
280  nself *= 2;
281  }
282  if (fc && (i == -1 || i >= nself)) {
283  fc->DescribeEq(desc, bInitial, i - nself);
284  if (i != -1) {
285  desc[0] = os.str() + ": " + desc[0];
286  return;
287  }
288  }
289 
290  if (i == -1) {
291  // move fc desc to the end
292  unsigned short nfc = 0;
293  if (fc) {
294  nfc = desc.size();
295  }
296  desc.resize(nfc + nself);
297  for (unsigned i = nfc; i-- > 0; ) {
298  desc[nself + i] = os.str() + ": " + desc[nfc];
299  }
300 
301  std::string name = os.str();
302 
303  for (unsigned i = 0; i < 3; i++) {
304  os.str(name);
305  os.seekp(0, std::ios_base::end);
306  os << ": position constraint P" << xyz[i];
307  desc[i] = os.str();
308  }
309 
310  for (unsigned i = 0; i < 2; i++) {
311  os.str(name);
312  os.seekp(0, std::ios_base::end);
313  os << ": orientation constraint g" << xyz[i];
314  desc[3 + i] = os.str();
315  }
316 
317  if (bInitial) {
318  for (unsigned i = 0; i < 3; i++) {
319  os.str(name);
320  os.seekp(0, std::ios_base::end);
321  os << ": position constraint derivative v" << xyz[i];
322  desc[3 + 2 + i] = os.str();
323  }
324 
325  for (unsigned i = 0; i < 2; i++) {
326  os.str(name);
327  os.seekp(0, std::ios_base::end);
328  os << ": orientation constraint derivative w" << xyz[i];
329  desc[3 + 2 + 3 + i] = os.str();
330  }
331  }
332 
333  } else {
334  if (i < -1) {
335  // error
337  }
338 
339  if (i >= nself) {
340  // error
342  }
343 
344  desc.resize(1);
345 
346  switch (i) {
347  case 0:
348  case 1:
349  case 2:
350  os << ": position constraint P" << xyz[i];
351  break;
352 
353  case 3:
354  case 4:
355  os << ": orientation constraint g" << xyz[i - 3];
356  break;
357 
358  case 5:
359  case 6:
360  case 7:
361  os << ": position constraint derivative v" << xyz[i - 3 - 2];
362  break;
363 
364  case 8:
365  case 9:
366  os << ": orientation constraint derivative w" << xyz[i - 3 - 2 - 3];
367  break;
368  }
369  desc[0] = os.str();
370  }
371 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
static const char xyz[]
Definition: planej.cc:133
BasicFriction *const fc
Definition: planej.h:74
virtual std::ostream & DescribeEq(std::ostream &out, const char *prefix="", bool bInitial=false) const =0
unsigned int GetLabel(void) const
Definition: withlab.cc:62
static const unsigned int NumSelfDof
Definition: planej.h:78

Here is the call graph for this function:

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

Reimplemented from SimulationEntity.

Definition at line 1482 of file planej.cc.

References ASSERT, dThetaWrapped, F, WithLabel::GetLabel(), StructNode::GetRCurr(), StructNode::GetWCurr(), iGetNumPrivData(), M, M_PI, MBDYN_EXCEPT_ARGS, Mat3x3::MulTV(), NTheta, pNode1, pNode2, R1h, R2h, and RotManip::VecRot().

1483 {
1484  ASSERT(i >= 1 && i <= iGetNumPrivData());
1485 
1486  switch (i) {
1487  case 1: {
1489  doublereal dThetaTmp(v(3));
1490 
1491  int n = 0;
1492 
1493  if (dThetaTmp - dThetaWrapped < -M_PI) {
1494  n++;
1495  }
1496 
1497  if (dThetaTmp - dThetaWrapped > M_PI) {
1498  n--;
1499  }
1500 
1501  return 2*M_PI*(NTheta + n) + dThetaTmp;
1502  }
1503 
1504  case 2: {
1505  Mat3x3 R2Tmp((pNode2->GetRCurr()*R2h));
1506  Vec3 v(R2Tmp.MulTV(pNode2->GetWCurr()-pNode1->GetWCurr()));
1507 
1508  return v(3);
1509  }
1510 
1511  case 3:
1512  case 4:
1513  case 5:
1514  return F(i - 2);
1515 
1516  case 6:
1517  case 7:
1518  case 8:
1519  return M(i - 5);
1520  }
1521 
1522  silent_cerr("PlaneHingeJoint(" << GetLabel() << "): "
1523  "illegal private data " << i << std::endl);
1525 }
#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
const StructNode * pNode2
Definition: planej.h:54
virtual unsigned int iGetNumPrivData(void) const
Definition: planej.cc:1440
Vec3 VecRot(const Mat3x3 &Phi)
Definition: Rot.cc:136
virtual const Vec3 & GetWCurr(void) const
Definition: strnode.h:1030
#define ASSERT(expression)
Definition: colamd.c:977
doublereal dThetaWrapped
Definition: planej.h:70
Mat3x3 R2h
Definition: planej.h:58
double doublereal
Definition: colamd.c:52
Mat3x3 R1h
Definition: planej.h:56
unsigned int GetLabel(void) const
Definition: withlab.cc:62
const StructNode * pNode1
Definition: planej.h:53

Here is the call graph for this function:

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

Reimplemented from Elem.

Definition at line 193 of file planej.h.

References pNode1, and pNode2.

193  {
194  connectedNodes.resize(2);
195  connectedNodes[0] = pNode1;
196  connectedNodes[1] = pNode2;
197  };
const StructNode * pNode2
Definition: planej.h:54
const StructNode * pNode1
Definition: planej.h:53
DofOrder::Order PlaneHingeJoint::GetDofType ( unsigned int  i) const
virtual

Reimplemented from Elem.

Definition at line 927 of file planej.cc.

References DofOrder::ALGEBRAIC, ASSERT, fc, SimulationEntity::GetDofType(), iGetNumDof(), and NumSelfDof.

927  {
928  ASSERT(i >= 0 && i < iGetNumDof());
929  if (i<NumSelfDof) {
930  return DofOrder::ALGEBRAIC;
931  } else {
932  return fc->GetDofType(i-NumSelfDof);
933  }
934 };
virtual unsigned int iGetNumDof(void) const
Definition: planej.cc:917
BasicFriction *const fc
Definition: planej.h:74
virtual DofOrder::Order GetDofType(unsigned int i) const =0
#define ASSERT(expression)
Definition: colamd.c:977
static const unsigned int NumSelfDof
Definition: planej.h:78

Here is the call graph for this function:

DofOrder::Order PlaneHingeJoint::GetEqType ( unsigned int  i) const
virtual

Reimplemented from SimulationEntity.

Definition at line 937 of file planej.cc.

References DofOrder::ALGEBRAIC, ASSERTMSGBREAK, fc, SimulationEntity::GetEqType(), iGetNumDof(), and NumSelfDof.

938 {
939  ASSERTMSGBREAK(i < iGetNumDof(),
940  "INDEX ERROR in PlaneHingeJoint::GetEqType");
941  if (i<NumSelfDof) {
942  return DofOrder::ALGEBRAIC;
943  } else {
944  return fc->GetEqType(i-NumSelfDof);
945  }
946 }
virtual DofOrder::Order GetEqType(unsigned int i) const
Definition: simentity.h:138
#define ASSERTMSGBREAK(expr, msg)
Definition: myassert.h:222
virtual unsigned int iGetNumDof(void) const
Definition: planej.cc:917
BasicFriction *const fc
Definition: planej.h:74
static const unsigned int NumSelfDof
Definition: planej.h:78

Here is the call graph for this function:

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

Implements Joint.

Definition at line 109 of file planej.h.

References Joint::PLANEHINGE.

109  {
110  return Joint::PLANEHINGE;
111  };
virtual unsigned int PlaneHingeJoint::iGetInitialNumDof ( void  ) const
inlinevirtual

Implements SubjectToInitialAssembly.

Definition at line 168 of file planej.h.

168  {
169  return 10;
170  };
unsigned int PlaneHingeJoint::iGetNumDof ( void  ) const
virtual

Reimplemented from Elem.

Definition at line 917 of file planej.cc.

References fc, SimulationEntity::iGetNumDof(), and NumSelfDof.

Referenced by AssJac(), AssRes(), GetDofType(), and GetEqType().

917  {
918  unsigned int i = NumSelfDof;
919  if (fc) {
920  i+=fc->iGetNumDof();
921  }
922  return i;
923 };
BasicFriction *const fc
Definition: planej.h:74
virtual unsigned int iGetNumDof(void) const =0
static const unsigned int NumSelfDof
Definition: planej.h:78

Here is the call graph for this function:

unsigned int PlaneHingeJoint::iGetNumPrivData ( void  ) const
virtual

Reimplemented from SimulationEntity.

Definition at line 1440 of file planej.cc.

Referenced by dGetPrivData().

1441 {
1442  return 8;
1443 }
unsigned int PlaneHingeJoint::iGetPrivDataIdx ( const char *  s) const
virtual

Reimplemented from SimulationEntity.

Definition at line 1446 of file planej.cc.

References ASSERT.

1447 {
1448  ASSERT(s != NULL);
1449 
1450  unsigned int idx = 0;
1451 
1452  switch (s[0]) {
1453  case 'w':
1454  idx++;
1455  case 'r':
1456  idx++;
1457  if (s[1] == 'z') {
1458  return idx;
1459  }
1460  break;
1461 
1462  case 'M':
1463  idx += 3;
1464  case 'F':
1465  idx += 2;
1466 
1467  switch (s[1]) {
1468  case 'x':
1469  return idx + 1;
1470 
1471  case 'y':
1472  return idx + 2;
1473 
1474  case 'z':
1475  return idx + 3;
1476  }
1477  }
1478 
1479  return 0;
1480 }
#define ASSERT(expression)
Definition: colamd.c:977
VariableSubMatrixHandler & PlaneHingeJoint::InitialAssJac ( VariableSubMatrixHandler WorkMat,
const VectorHandler XCurr 
)
virtual

Implements SubjectToInitialAssembly.

Definition at line 1079 of file planej.cc.

References FullSubMatrixHandler::Add(), Vec3::Cross(), d1, d2, Vec3::dGet(), F, WithLabel::GetLabel(), StructNode::GetRRef(), Mat3x3::GetVec(), StructNode::GetWRef(), DofOwnerOwner::iGetFirstIndex(), StructDispNode::iGetFirstPositionIndex(), InitialWorkSpaceDim(), M, MatCross, MatCrossCross, MBDYN_EXCEPT_ARGS, pNode1, pNode2, FullSubMatrixHandler::PutCoef(), FullSubMatrixHandler::PutColIndex(), FullSubMatrixHandler::PutRowIndex(), R1h, R2h, FullSubMatrixHandler::ResizeReset(), VariableSubMatrixHandler::SetFull(), and FullSubMatrixHandler::Sub().

1081 {
1082  /* Per ora usa la matrice piena; eventualmente si puo'
1083  * passare a quella sparsa quando si ottimizza */
1084  FullSubMatrixHandler& WM = WorkMat.SetFull();
1085 
1086  /* Dimensiona e resetta la matrice di lavoro */
1087  integer iNumRows = 0;
1088  integer iNumCols = 0;
1089  InitialWorkSpaceDim(&iNumRows, &iNumCols);
1090  WM.ResizeReset(iNumRows, iNumCols);
1091 
1092  /* Equazioni: vedi joints.dvi */
1093 
1094  /* equazioni ed incognite
1095  * F1 Delta_x1 0+1 = 1
1096  * M1 Delta_g1 3+1 = 4
1097  * FP1 Delta_xP1 6+1 = 7
1098  * MP1 Delta_w1 9+1 = 10
1099  * F2 Delta_x2 12+1 = 13
1100  * M2 Delta_g2 15+1 = 16
1101  * FP2 Delta_xP2 18+1 = 19
1102  * MP2 Delta_w2 21+1 = 22
1103  * vincolo spostamento Delta_F 24+1 = 25
1104  * vincolo rotazione Delta_M 27+1 = 28
1105  * derivata vincolo spostamento Delta_FP 29+1 = 30
1106  * derivata vincolo rotazione Delta_MP 32+1 = 33
1107  */
1108 
1109 
1110  /* Indici */
1111  integer iNode1FirstPosIndex = pNode1->iGetFirstPositionIndex();
1112  integer iNode1FirstVelIndex = iNode1FirstPosIndex+6;
1113  integer iNode2FirstPosIndex = pNode2->iGetFirstPositionIndex();
1114  integer iNode2FirstVelIndex = iNode2FirstPosIndex+6;
1115  integer iFirstReactionIndex = iGetFirstIndex();
1116  integer iReactionPrimeIndex = iFirstReactionIndex+5;
1117 
1118  /* Nota: le reazioni vincolari sono:
1119  * Forza, 3 incognite, riferimento globale,
1120  * Momento, 2 incognite, riferimento locale
1121  */
1122 
1123  /* Setta gli indici dei nodi */
1124  for (int iCnt = 1; iCnt <= 6; iCnt++) {
1125  WM.PutRowIndex(iCnt, iNode1FirstPosIndex+iCnt);
1126  WM.PutColIndex(iCnt, iNode1FirstPosIndex+iCnt);
1127  WM.PutRowIndex(6+iCnt, iNode1FirstVelIndex+iCnt);
1128  WM.PutColIndex(6+iCnt, iNode1FirstVelIndex+iCnt);
1129  WM.PutRowIndex(12+iCnt, iNode2FirstPosIndex+iCnt);
1130  WM.PutColIndex(12+iCnt, iNode2FirstPosIndex+iCnt);
1131  WM.PutRowIndex(18+iCnt, iNode2FirstVelIndex+iCnt);
1132  WM.PutColIndex(18+iCnt, iNode2FirstVelIndex+iCnt);
1133  }
1134 
1135  /* Setta gli indici delle reazioni */
1136  for (int iCnt = 1; iCnt <= 10; iCnt++) {
1137  WM.PutRowIndex(24+iCnt, iFirstReactionIndex+iCnt);
1138  WM.PutColIndex(24+iCnt, iFirstReactionIndex+iCnt);
1139  }
1140 
1141 
1142  /* Recupera i dati */
1143  const Mat3x3& R1(pNode1->GetRRef());
1144  const Mat3x3& R2(pNode2->GetRRef());
1145  const Vec3& Omega1(pNode1->GetWRef());
1146  const Vec3& Omega2(pNode2->GetWRef());
1147 
1148  /* F ed M sono gia' state aggiornate da InitialAssRes */
1149  Vec3 FPrime(XCurr, iReactionPrimeIndex+1);
1150  Vec3 MPrime(XCurr(iReactionPrimeIndex+4),
1151  XCurr(iReactionPrimeIndex+5),
1152  0.);
1153 
1154  /* Matrici identita' */
1155  for (int iCnt = 1; iCnt <= 3; iCnt++) {
1156  /* Contributo di forza all'equazione della forza, nodo 1 */
1157  WM.PutCoef(iCnt, 24+iCnt, 1.);
1158 
1159  /* Contrib. di der. di forza all'eq. della der. della forza, nodo 1 */
1160  WM.PutCoef(6+iCnt, 29+iCnt, 1.);
1161 
1162  /* Contributo di forza all'equazione della forza, nodo 2 */
1163  WM.PutCoef(12+iCnt, 24+iCnt, -1.);
1164 
1165  /* Contrib. di der. di forza all'eq. della der. della forza, nodo 2 */
1166  WM.PutCoef(18+iCnt, 29+iCnt, -1.);
1167 
1168  /* Equazione di vincolo, nodo 1 */
1169  WM.PutCoef(24+iCnt, iCnt, -1.);
1170 
1171  /* Derivata dell'equazione di vincolo, nodo 1 */
1172  WM.PutCoef(29+iCnt, 6+iCnt, -1.);
1173 
1174  /* Equazione di vincolo, nodo 2 */
1175  WM.PutCoef(24+iCnt, 12+iCnt, 1.);
1176 
1177  /* Derivata dell'equazione di vincolo, nodo 2 */
1178  WM.PutCoef(29+iCnt, 18+iCnt, 1.);
1179  }
1180 
1181  /* Distanze e matrici di rotazione dai nodi alla cerniera
1182  * nel sistema globale */
1183  Vec3 d1Tmp(R1*d1);
1184  Vec3 d2Tmp(R2*d2);
1185  Mat3x3 R1hTmp(R1*R1h);
1186  Mat3x3 R2hTmp(R2*R2h);
1187 
1188  Vec3 e3a(R1hTmp.GetVec(3));
1189  Vec3 e1b(R2hTmp.GetVec(1));
1190  Vec3 e2b(R2hTmp.GetVec(2));
1191 
1192  /* Ruota il momento e la sua derivata con le matrici della cerniera
1193  * rispetto ai nodi */
1194  Vec3 MTmp(e2b*M.dGet(1)-e1b*M.dGet(2));
1195  Vec3 MPrimeTmp(e2b*MPrime.dGet(1)-e1b*MPrime.dGet(2));
1196 
1197  /* Matrici F/\d1/\, -F/\d2/\ */
1198  Mat3x3 FWedged1Wedge(MatCrossCross, F, d1Tmp);
1199  Mat3x3 FWedged2Wedge(MatCrossCross, F, -d2Tmp);
1200 
1201  /* Matrici (omega1/\d1)/\, -(omega2/\d2)/\ */
1202  Mat3x3 O1Wedged1Wedge(MatCross, Omega1.Cross(d1Tmp));
1203  Mat3x3 O2Wedged2Wedge(MatCross, d2Tmp.Cross(Omega2));
1204 
1205  Mat3x3 MDeltag1((Mat3x3(MatCross, Omega2.Cross(MTmp) + MPrimeTmp)
1206  + Mat3x3(MatCrossCross, MTmp, Omega1))*Mat3x3(MatCross, e3a));
1207  Mat3x3 MDeltag2(Mat3x3(MatCrossCross, Omega1.Cross(e3a), MTmp)
1208  + Mat3x3(MatCrossCross, e3a, MPrimeTmp)
1209  + e3a.Cross(Mat3x3(MatCrossCross, Omega2, MTmp)));
1210 
1211  /* Vettori temporanei */
1212  Vec3 Tmp1(e2b.Cross(e3a));
1213  Vec3 Tmp2(e3a.Cross(e1b));
1214 
1215  /* Prodotto vettore tra il versore 3 della cerniera secondo il nodo 1
1216  * ed il versore 1 della cerniera secondo il nodo 2. A convergenza
1217  * devono essere ortogonali, quindi il loro prodotto vettore deve essere
1218  * unitario */
1219 
1220  /* Error handling: il programma si ferma, pero' segnala dov'e' l'errore */
1221  if (Tmp1.Dot() <= std::numeric_limits<doublereal>::epsilon() || Tmp2.Dot() <= std::numeric_limits<doublereal>::epsilon()) {
1222  silent_cerr("PlaneHingeJoint(" << GetLabel() << "): "
1223  "first and second node hinge axes are (nearly) orthogonal"
1224  << std::endl);
1226  }
1227 
1228  Vec3 TmpPrime1(e2b.Cross(Omega1.Cross(e3a))-e3a.Cross(Omega2.Cross(e2b)));
1229  Vec3 TmpPrime2(e3a.Cross(Omega2.Cross(e1b))-e1b.Cross(Omega1.Cross(e3a)));
1230 
1231  /* Equazione di momento, nodo 1 */
1232  WM.Add(4, 4, FWedged1Wedge - Mat3x3(MatCrossCross, MTmp, e3a));
1233  WM.Add(4, 16, Mat3x3(MatCrossCross, e3a, MTmp));
1234  WM.Add(4, 25, Mat3x3(MatCross, d1Tmp));
1235  for (int iCnt = 1; iCnt <= 3; iCnt++) {
1236  WM.PutCoef(3+iCnt, 28, Tmp1(iCnt));
1237  WM.PutCoef(3+iCnt, 29, Tmp2(iCnt));
1238  }
1239 
1240  /* Equazione di momento, nodo 2 */
1241  WM.Add(16, 4, Mat3x3(MatCrossCross, MTmp, e3a));
1242  WM.Add(16, 16, FWedged2Wedge - Mat3x3(MatCrossCross, e3a, MTmp));
1243  WM.Sub(16, 25, Mat3x3(MatCross, d2Tmp));
1244  for (int iCnt = 1; iCnt <= 3; iCnt++) {
1245  WM.PutCoef(15+iCnt, 28, -Tmp1(iCnt));
1246  WM.PutCoef(15+iCnt, 29, -Tmp2(iCnt));
1247  }
1248 
1249  /* Derivata dell'equazione di momento, nodo 1 */
1250  WM.Add(10, 4, (Mat3x3(MatCross, FPrime) + Mat3x3(MatCrossCross, F, Omega1))*Mat3x3(MatCross, d1Tmp) - MDeltag1);
1251  WM.Add(10, 10, FWedged1Wedge - Mat3x3(MatCrossCross, MTmp, e3a));
1252  WM.Add(10, 16, MDeltag2);
1253  WM.Add(10, 22, Mat3x3(MatCrossCross, e3a, MTmp));
1254  WM.Add(10, 25, O1Wedged1Wedge);
1255  WM.Add(10, 30, Mat3x3(MatCross, d1Tmp));
1256 
1257  for (int iCnt = 1; iCnt <= 3; iCnt++) {
1258  WM.PutCoef(9+iCnt, 28, TmpPrime1(iCnt));
1259  WM.PutCoef(9+iCnt, 29, TmpPrime2(iCnt));
1260  WM.PutCoef(9+iCnt, 33, Tmp1(iCnt));
1261  WM.PutCoef(9+iCnt, 34, Tmp2(iCnt));
1262  }
1263 
1264  /* Derivata dell'equazione di momento, nodo 2 */
1265  WM.Add(22, 4, MDeltag1);
1266  WM.Add(22, 10, Mat3x3(MatCrossCross, MTmp, e3a));
1267  WM.Sub(22, 16, (Mat3x3(MatCross, FPrime) + Mat3x3(MatCrossCross, F, Omega2))*Mat3x3(MatCross, d2Tmp) + MDeltag2);
1268  WM.Add(22, 22, FWedged2Wedge - Mat3x3(MatCrossCross, e3a, MTmp));
1269  WM.Add(22, 25, O2Wedged2Wedge);
1270  WM.Sub(22, 30, Mat3x3(MatCross, d2Tmp));
1271 
1272  for (int iCnt = 1; iCnt <= 3; iCnt++) {
1273  WM.PutCoef(21+iCnt, 28, -TmpPrime1(iCnt));
1274  WM.PutCoef(21+iCnt, 29, -TmpPrime2(iCnt));
1275  WM.PutCoef(21+iCnt, 33, -Tmp1(iCnt));
1276  WM.PutCoef(21+iCnt, 34, -Tmp2(iCnt));
1277  }
1278 
1279  /* Equazione di vincolo di posizione */
1280  WM.Add(25, 4, Mat3x3(MatCross, d1Tmp));
1281  WM.Sub(25, 16, Mat3x3(MatCross, d2Tmp));
1282 
1283  /* Derivata dell'equazione di vincolo di posizione */
1284  WM.Add(30, 4, O1Wedged1Wedge);
1285  WM.Add(30, 10, Mat3x3(MatCross, d1Tmp));
1286  WM.Add(30, 16, O2Wedged2Wedge);
1287  WM.Sub(30, 22, Mat3x3(MatCross, d2Tmp));
1288 
1289  /* Equazioni di vincolo di rotazione: e1b~e3a, e2b~e3a */
1290 
1291  for (int iCnt = 1; iCnt <= 3; iCnt++) {
1292  doublereal d = Tmp1(iCnt);
1293  WM.PutCoef(28, 3+iCnt, d);
1294  WM.PutCoef(28, 15+iCnt, -d);
1295 
1296  /* Queste sono per la derivata dell'equazione, sono qui solo per
1297  * ottimizzazione */
1298  WM.PutCoef(33, 9+iCnt, d);
1299  WM.PutCoef(33, 21+iCnt, -d);
1300 
1301  d = Tmp2.dGet(iCnt);
1302  WM.PutCoef(29, 3+iCnt, -d);
1303  WM.PutCoef(29, 15+iCnt, d);
1304 
1305  /* Queste sono per la derivata dell'equazione, sono qui solo per
1306  * ottimizzazione */
1307  WM.PutCoef(34, 9+iCnt, -d);
1308  WM.PutCoef(34, 21+iCnt, d);
1309  }
1310 
1311  /* Derivate delle equazioni di vincolo di rotazione: e1b~e3a, e2b~e3a */
1312  Vec3 O1mO2(Omega1-Omega2);
1313  TmpPrime1 = e3a.Cross(O1mO2.Cross(e2b));
1314  TmpPrime2 = e2b.Cross(e3a.Cross(O1mO2));
1315  for (int iCnt = 1; iCnt <= 3; iCnt++) {
1316  WM.PutCoef(33, 3+iCnt, TmpPrime1.dGet(iCnt));
1317  WM.PutCoef(33, 15+iCnt, TmpPrime2.dGet(iCnt));
1318  }
1319 
1320  TmpPrime1 = e3a.Cross(O1mO2.Cross(e1b));
1321  TmpPrime2 = e1b.Cross(e3a.Cross(O1mO2));
1322  for (int iCnt = 1; iCnt <= 3; iCnt++) {
1323  WM.PutCoef(34, 3+iCnt, TmpPrime1.dGet(iCnt));
1324  WM.PutCoef(34, 15+iCnt, TmpPrime2.dGet(iCnt));
1325  }
1326 
1327  return WorkMat;
1328 }
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
const StructNode * pNode2
Definition: planej.h:54
void PutCoef(integer iRow, integer iCol, const doublereal &dCoef)
Definition: submat.h:672
virtual const Vec3 & GetWRef(void) const
Definition: strnode.h:1024
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: planej.h:171
const doublereal & dGet(unsigned short int iRow) const
Definition: matvec3.h:285
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
Mat3x3 R2h
Definition: planej.h:58
void Sub(integer iRow, integer iCol, const Vec3 &v)
Definition: submat.cc:215
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
double doublereal
Definition: colamd.c:52
Mat3x3 R1h
Definition: planej.h:56
long int integer
Definition: colamd.c:51
unsigned int GetLabel(void) const
Definition: withlab.cc:62
const StructNode * pNode1
Definition: planej.h:53

Here is the call graph for this function:

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

Implements SubjectToInitialAssembly.

Definition at line 1333 of file planej.cc.

References VectorHandler::Add(), Vec3::Cross(), grad::Cross(), d1, d2, DEBUGCOUT, Vec3::dGet(), F, StructNode::GetRCurr(), StructDispNode::GetVCurr(), Mat3x3::GetVec(), StructNode::GetWCurr(), StructDispNode::GetXCurr(), DofOwnerOwner::iGetFirstIndex(), StructDispNode::iGetFirstPositionIndex(), InitialWorkSpaceDim(), M, pNode1, pNode2, VectorHandler::PutCoef(), SubVectorHandler::PutRowIndex(), R1h, R2h, VectorHandler::ResizeReset(), and VectorHandler::Sub().

1335 {
1336  DEBUGCOUT("Entering PlaneHingeJoint::InitialAssRes()" << std::endl);
1337 
1338  /* Dimensiona e resetta la matrice di lavoro */
1339  integer iNumRows = 0;
1340  integer iNumCols = 0;
1341  InitialWorkSpaceDim(&iNumRows, &iNumCols);
1342  WorkVec.ResizeReset(iNumRows);
1343 
1344  /* Indici */
1345  integer iNode1FirstPosIndex = pNode1->iGetFirstPositionIndex();
1346  integer iNode1FirstVelIndex = iNode1FirstPosIndex+6;
1347  integer iNode2FirstPosIndex = pNode2->iGetFirstPositionIndex();
1348  integer iNode2FirstVelIndex = iNode2FirstPosIndex+6;
1349  integer iFirstReactionIndex = iGetFirstIndex();
1350  integer iReactionPrimeIndex = iFirstReactionIndex+5;
1351 
1352  /* Setta gli indici */
1353  for (int iCnt = 1; iCnt <= 6; iCnt++) {
1354  WorkVec.PutRowIndex(iCnt, iNode1FirstPosIndex+iCnt);
1355  WorkVec.PutRowIndex(6+iCnt, iNode1FirstVelIndex+iCnt);
1356  WorkVec.PutRowIndex(12+iCnt, iNode2FirstPosIndex+iCnt);
1357  WorkVec.PutRowIndex(18+iCnt, iNode2FirstVelIndex+iCnt);
1358  }
1359 
1360  for (int iCnt = 1; iCnt <= 10; iCnt++) {
1361  WorkVec.PutRowIndex(24+iCnt, iFirstReactionIndex+iCnt);
1362  }
1363 
1364  /* Recupera i dati */
1365  const Vec3& x1(pNode1->GetXCurr());
1366  const Vec3& x2(pNode2->GetXCurr());
1367  const Vec3& v1(pNode1->GetVCurr());
1368  const Vec3& v2(pNode2->GetVCurr());
1369  const Mat3x3& R1(pNode1->GetRCurr());
1370  const Mat3x3& R2(pNode2->GetRCurr());
1371  const Vec3& Omega1(pNode1->GetWCurr());
1372  const Vec3& Omega2(pNode2->GetWCurr());
1373 
1374  /* Aggiorna F ed M, che restano anche per InitialAssJac */
1375  F = Vec3(XCurr, iFirstReactionIndex+1);
1376  M = Vec3(XCurr(iFirstReactionIndex+4),
1377  XCurr(iFirstReactionIndex+5),
1378  0.);
1379  Vec3 FPrime(XCurr, iReactionPrimeIndex+1);
1380  Vec3 MPrime(XCurr(iReactionPrimeIndex+4),
1381  XCurr(iReactionPrimeIndex+5),
1382  0.);
1383 
1384  /* Distanza nel sistema globale */
1385  Vec3 d1Tmp(R1*d1);
1386  Vec3 d2Tmp(R2*d2);
1387  Mat3x3 R1hTmp(R1*R1h);
1388  Mat3x3 R2hTmp(R2*R2h);
1389 
1390  /* Vettori omega1/\d1, -omega2/\d2 */
1391  Vec3 O1Wedged1(Omega1.Cross(d1Tmp));
1392  Vec3 O2Wedged2(Omega2.Cross(d2Tmp));
1393 
1394  Vec3 e3a(R1hTmp.GetVec(3));
1395  Vec3 e1b(R2hTmp.GetVec(1));
1396  Vec3 e2b(R2hTmp.GetVec(2));
1397 
1398  /* Ruota il momento e la sua derivata con le matrici della cerniera
1399  * rispetto ai nodi */
1400  Vec3 MTmp(e2b*M.dGet(1)-e1b*M.dGet(2));
1401  Vec3 MPrimeTmp(e3a.Cross(MTmp.Cross(Omega2))+MTmp.Cross(Omega1.Cross(e3a))+
1402  e2b.Cross(e3a)*MPrime.dGet(1)+e3a.Cross(e1b)*MPrime.dGet(2));
1403 
1404  /* Equazioni di equilibrio, nodo 1 */
1405  WorkVec.Sub(1, F);
1406  WorkVec.Add(4, F.Cross(d1Tmp)-MTmp.Cross(e3a)); /* Sfrutto il fatto che F/\d = -d/\F */
1407 
1408  /* Derivate delle equazioni di equilibrio, nodo 1 */
1409  WorkVec.Sub(7, FPrime);
1410  WorkVec.Add(10, FPrime.Cross(d1Tmp)-O1Wedged1.Cross(F)-MPrimeTmp);
1411 
1412  /* Equazioni di equilibrio, nodo 2 */
1413  WorkVec.Add(13, F);
1414  WorkVec.Add(16, d2Tmp.Cross(F)+MTmp.Cross(e3a));
1415 
1416  /* Derivate delle equazioni di equilibrio, nodo 2 */
1417  WorkVec.Add(19, FPrime);
1418  WorkVec.Add(22, d2Tmp.Cross(FPrime)+O2Wedged2.Cross(F)+MPrimeTmp);
1419 
1420  /* Equazione di vincolo di posizione */
1421  WorkVec.Add(25, x1+d1Tmp-x2-d2Tmp);
1422 
1423  /* Derivata dell'equazione di vincolo di posizione */
1424  WorkVec.Add(30, v1+O1Wedged1-v2-O2Wedged2);
1425 
1426  /* Equazioni di vincolo di rotazione */
1427  WorkVec.PutCoef(28, e2b.Dot(e3a));
1428  WorkVec.PutCoef(29, e1b.Dot(e3a));
1429 
1430  /* Derivate delle equazioni di vincolo di rotazione: e1b~e3a, e2b~e3a */
1431  Vec3 Tmp((Omega1-Omega2).Cross(e3a));
1432  WorkVec.PutCoef(33, e2b.Dot(Tmp));
1433  WorkVec.PutCoef(34, e1b.Dot(Tmp));
1434 
1435  return WorkVec;
1436 }
Definition: matvec3.h:98
virtual void ResizeReset(integer)
Definition: vh.cc:55
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
const StructNode * pNode2
Definition: planej.h:54
virtual void Sub(integer iRow, const Vec3 &v)
Definition: vh.cc:78
virtual void PutRowIndex(integer iSubRow, integer iRow)=0
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: planej.h:171
const doublereal & dGet(unsigned short int iRow) const
Definition: matvec3.h:285
#define DEBUGCOUT(msg)
Definition: myassert.h:232
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
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
Mat3x3 R2h
Definition: planej.h:58
virtual const Vec3 & GetVCurr(void) const
Definition: strnode.h:322
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
Mat3x3 R1h
Definition: planej.h:56
long int integer
Definition: colamd.c:51
const StructNode * pNode1
Definition: planej.h:53

Here is the call graph for this function:

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

Implements SubjectToInitialAssembly.

Definition at line 171 of file planej.h.

Referenced by InitialAssJac(), and InitialAssRes().

172  {
173  *piNumRows = 34;
174  *piNumCols = 34;
175  };
void PlaneHingeJoint::Output ( OutputHandler OH) const
virtual

Reimplemented from ToBeOutput.

Definition at line 975 of file planej.cc.

References ToBeOutput::bToBeOutput(), dRaDegr, EULER_123, EULER_313, EULER_321, F, BasicFriction::fc(), fc, OutputHandler::GetCurrentStep(), WithLabel::GetLabel(), StructNode::GetRCurr(), StructNode::GetWCurr(), OutputHandler::JOINTS, OutputHandler::Joints(), M, M3, MatR2EulerAngles123(), MatR2EulerAngles313(), MatR2EulerAngles321(), od, ORIENTATION_MATRIX, ORIENTATION_VECTOR, Joint::Output(), Vec3::pGetVec(), pNode1, pNode2, R1h, R2h, OutputHandler::UseNetCDF(), OutputHandler::UseText(), and RotManip::VecRot().

976 {
977  if (bToBeOutput()) {
978  Mat3x3 R2Tmp(pNode2->GetRCurr()*R2h);
979  Mat3x3 RTmp((pNode1->GetRCurr()*R1h).MulTM(R2Tmp));
980  Vec3 OmegaTmp(R2Tmp.MulTV(pNode2->GetWCurr()-pNode1->GetWCurr()));
981  Vec3 E;
982  switch (od) {
983  case EULER_123:
984  E = MatR2EulerAngles123(RTmp)*dRaDegr;
985  break;
986 
987  case EULER_313:
988  E = MatR2EulerAngles313(RTmp)*dRaDegr;
989  break;
990 
991  case EULER_321:
992  E = MatR2EulerAngles321(RTmp)*dRaDegr;
993  break;
994 
995  case ORIENTATION_VECTOR:
996  E = RotManip::VecRot(RTmp);
997  break;
998 
999  case ORIENTATION_MATRIX:
1000  break;
1001 
1002  default:
1003  /* impossible */
1004  break;
1005  }
1006 
1007 #ifdef USE_NETCDF
1008  if (OH.UseNetCDF(OutputHandler::JOINTS)) {
1009  Var_F_local->put_rec((R2Tmp.MulTV(F)).pGetVec(), OH.GetCurrentStep());
1010  Var_M_local->put_rec(M.pGetVec(), OH.GetCurrentStep());
1011  Var_F_global->put_rec(F.pGetVec(), OH.GetCurrentStep());
1012  Var_M_global->put_rec((R2Tmp*M).pGetVec(), OH.GetCurrentStep());
1013 
1014  switch (od) {
1015  case EULER_123:
1016  case EULER_313:
1017  case EULER_321:
1018  case ORIENTATION_VECTOR:
1019  Var_Phi->put_rec(E.pGetVec(), OH.GetCurrentStep());
1020  break;
1021 
1022  case ORIENTATION_MATRIX:
1023  Var_Phi->put_rec(RTmp.pGetMat(), OH.GetCurrentStep());
1024  break;
1025 
1026  default:
1027  /* impossible */
1028  break;
1029  }
1030 
1031  Var_Omega->put_rec(OmegaTmp.pGetVec(), OH.GetCurrentStep());
1032 /*
1033  if (fc) {
1034  Var_MFR->put_rec(&M3, OH.GetCurrentStep());
1035  Var_MU->put_rec(fc->fc(), OH.GetCurrentStep());
1036  }
1037  else
1038  {
1039  Var_MFR->put_rec(0, OH.GetCurrentStep());
1040  Var_MU->put_rec(0, OH.GetCurrentStep());
1041  }
1042 */
1043  }
1044 #endif // USE_NETCDF
1045  if (OH.UseText(OutputHandler::JOINTS)) {
1046  std::ostream &of = Joint::Output(OH.Joints(), "PlaneHinge", GetLabel(),
1047  R2Tmp.MulTV(F), M, F, R2Tmp*M)
1048  << " ";
1049 
1050  switch (od) {
1051  case EULER_123:
1052  case EULER_313:
1053  case EULER_321:
1054  case ORIENTATION_VECTOR:
1055  of << E;
1056  break;
1057 
1058  case ORIENTATION_MATRIX:
1059  of << RTmp;
1060  break;
1061 
1062  default:
1063  /* impossible */
1064  break;
1065  }
1066 
1067  of << " " << R2Tmp.MulTV(pNode2->GetWCurr()-pNode1->GetWCurr());
1068  if (fc) {
1069  of << " " << M3 << " " << fc->fc();
1070  }
1071  of << std::endl;
1072  }
1073  }
1074 }
doublereal M3
Definition: planej.h:77
virtual bool bToBeOutput(void) const
Definition: output.cc:890
Definition: matvec3.h:98
bool UseNetCDF(int out) const
Definition: output.cc:491
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
const StructNode * pNode2
Definition: planej.h:54
virtual doublereal fc(void) const =0
Vec3 VecRot(const Mat3x3 &Phi)
Definition: Rot.cc:136
Vec3 MatR2EulerAngles313(const Mat3x3 &R)
Definition: matvec3.cc:927
long GetCurrentStep(void) const
Definition: output.h:116
BasicFriction *const fc
Definition: planej.h:74
Vec3 MatR2EulerAngles123(const Mat3x3 &R)
Definition: matvec3.cc:893
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
OrientationDescription od
Definition: planej.h:83
const doublereal * pGetVec(void) const
Definition: matvec3.h:192
Vec3 MatR2EulerAngles321(const Mat3x3 &R)
Definition: matvec3.cc:941
Mat3x3 R2h
Definition: planej.h:58
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
Mat3x3 R1h
Definition: planej.h:56
unsigned int GetLabel(void) const
Definition: withlab.cc:62
const StructNode * pNode1
Definition: planej.h:53
bool UseText(int out) const
Definition: output.cc:446

Here is the call graph for this function:

void PlaneHingeJoint::OutputPrepare ( OutputHandler OH)
virtual

Reimplemented from ToBeOutput.

Definition at line 949 of file planej.cc.

References ToBeOutput::bToBeOutput(), OutputHandler::JOINTS, od, Joint::OutputPrepare_int(), and OutputHandler::UseNetCDF().

950 {
951  if (bToBeOutput()) {
952 #ifdef USE_NETCDF
954  std::string name;
955  OutputPrepare_int("revolute hinge", OH, name);
956 
957  Var_Phi = OH.CreateRotationVar(name, "", od, "global");
958 
959  Var_Omega = OH.CreateVar<Vec3>(name + "Omega", "radian/s",
960  "local relative angular velocity (x, y, z)");
961 
962 /* TODO
963  Var_MFR = OH.CreateVar<doublereal>(name + "MFR", "Nm",
964  "friciton moment ");
965 
966  Var_MU = OH.CreateVar<doublereal>(name + "MU", "--",
967  "friction model specific data: friction coefficient?");
968 */
969  }
970 #endif // USE_NETCDF
971  }
972 }
virtual bool bToBeOutput(void) const
Definition: output.cc:890
Definition: matvec3.h:98
bool UseNetCDF(int out) const
Definition: output.cc:491
virtual void OutputPrepare_int(const std::string &type, OutputHandler &OH, std::string &name)
Definition: joint.cc:107
OrientationDescription od
Definition: planej.h:83

Here is the call graph for this function:

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

Reimplemented from SimulationEntity.

Definition at line 432 of file planej.cc.

References fc, SimulationEntity::ParseHint(), and STRLENOF.

433 {
434  if (strncasecmp(s, "offset{" /*}*/ , STRLENOF("offset{" /*}*/ )) == 0)
435  {
436  s += STRLENOF("offset{" /*}*/ );
437 
438  if (strcmp(&s[1], /*{*/ "}") != 0) {
439  return 0;
440  }
441 
442  switch (s[0]) {
443  case '1':
444  return new Joint::OffsetHint<1>;
445 
446  case '2':
447  return new Joint::OffsetHint<2>;
448  }
449 
450  } else if (strncasecmp(s, "hinge{" /*}*/, STRLENOF("hinge{" /*}*/)) == 0) {
451  s += STRLENOF("hinge{" /*}*/);
452 
453  if (strcmp(&s[1], /* { */ "}") != 0) {
454  return 0;
455  }
456 
457  switch (s[0]) {
458  case '1':
459  return new Joint::HingeHint<1>;
460 
461  case '2':
462  return new Joint::HingeHint<2>;
463  }
464 
465  } else if (fc) {
466  return fc->ParseHint(pDM, s);
467  }
468 
469  return 0;
470 }
virtual Hint * ParseHint(DataManager *pDM, const char *s) const
Definition: simentity.cc:76
BasicFriction *const fc
Definition: planej.h:74
#define STRLENOF(s)
Definition: mbdyn.h:166

Here is the call graph for this function:

void PlaneHingeJoint::ReadInitialState ( MBDynParser HP)
virtual

Reimplemented from SimulationEntity.

Definition at line 510 of file planej.cc.

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

511 {
512  F = HP.GetVec3();
513  M = Vec3(HP.GetReal(), HP.GetReal(), 0.);
514 }
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 & PlaneHingeJoint::Restart ( std::ostream &  out) const
virtual

Implements Elem.

Definition at line 519 of file planej.cc.

References d1, d2, Vec3::dGet(), dTheta, F, WithLabel::GetLabel(), Mat3x3::GetVec(), M, pNode1, pNode2, R1h, R2h, Joint::Restart(), Write(), and Vec3::Write().

520 {
521  Joint::Restart(out) << ", revolute hinge, "
522  << pNode1->GetLabel() << ", reference, node, ",
523  d1.Write(out, ", ")
524  << ", hinge, reference, node, 1, ", (R1h.GetVec(1)).Write(out, ", ")
525  << ", 2, ", (R1h.GetVec(2)).Write(out, ", ") << ", "
526  << pNode2->GetLabel() << ", reference, node, ",
527  d2.Write(out, ", ")
528  << ", hinge, reference, node, 1, ", (R2h.GetVec(1)).Write(out, ", ")
529  << ", 2, ", (R2h.GetVec(2)).Write(out, ", ") << ", "
530  << "initial theta, " << dTheta << ", "
531  << "initial state, ", F.Write(out, ", ")
532  << ", " << M.dGet(1) << ", " << M.dGet(2) << ';' << std::endl;
533 
534  return out;
535 }
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
const StructNode * pNode2
Definition: planej.h:54
Vec3 GetVec(unsigned short int i) const
Definition: matvec3.h:893
const doublereal & dGet(unsigned short int iRow) const
Definition: matvec3.h:285
virtual std::ostream & Restart(std::ostream &out) const
Definition: joint.h:195
Mat3x3 R2h
Definition: planej.h:58
Mat3x3 R1h
Definition: planej.h:56
unsigned int GetLabel(void) const
Definition: withlab.cc:62
const StructNode * pNode1
Definition: planej.h:53
doublereal dTheta
Definition: planej.h:70

Here is the call graph for this function:

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

Reimplemented from Joint.

Definition at line 374 of file planej.cc.

References calcInitdTheta, d1, d2, Vec3::dGet(), dTheta, dThetaWrapped, F, fc, StructNode::GetRCurr(), StructDispNode::GetXCurr(), DofOwnerOwner::iGetFirstIndex(), M, Mat3x3::MulTM(), NumSelfDof, pNode1, pNode2, VectorHandler::Put(), VectorHandler::PutCoef(), R1h, R2h, BasicFriction::SetValue(), and RotManip::VecRot().

377 {
378  if (ph) {
379  for (unsigned i = 0; i < ph->size(); i++) {
380  Joint::JointHint *pjh = dynamic_cast<Joint::JointHint *>((*ph)[i]);
381 
382  if (pjh == 0) {
383  continue;
384  }
385 
386  if (dynamic_cast<Joint::OffsetHint<1> *>(pjh)) {
387  const Mat3x3& R1(pNode1->GetRCurr());
388  Vec3 dTmp2(pNode2->GetRCurr()*d2);
389 
390  d1 = R1.MulTV(pNode2->GetXCurr() + dTmp2 - pNode1->GetXCurr());
391 
392  } else if (dynamic_cast<Joint::OffsetHint<2> *>(pjh)) {
393  const Mat3x3& R2(pNode2->GetRCurr());
394  Vec3 dTmp1(pNode1->GetRCurr()*d1);
395 
396  d2 = R2.MulTV(pNode1->GetXCurr() + dTmp1 - pNode2->GetXCurr());
397 
398  } else if (dynamic_cast<Joint::HingeHint<1> *>(pjh)) {
400 
401  } else if (dynamic_cast<Joint::HingeHint<2> *>(pjh)) {
403 
404  } else if (dynamic_cast<Joint::ReactionsHint *>(pjh)) {
405  /* TODO */
406  }
407  }
408  }
409 
410  if (calcInitdTheta) {
412 
413  dThetaWrapped = dTheta = v.dGet(3);
414  }
415 
416 #if 0
417  std::cerr << "F: " << F << std::endl;
418  std::cerr << "M: " << M << std::endl;
419 #endif
420 
421  integer iFirstReactionIndex = iGetFirstIndex();
422  X.Put(iFirstReactionIndex + 1, F);
423  X.PutCoef(iFirstReactionIndex + 4, M.dGet(1));
424  X.PutCoef(iFirstReactionIndex + 5, M.dGet(2));
425 
426  if (fc) {
427  fc->SetValue(pDM, X, XP, ph, iGetFirstIndex() + NumSelfDof);
428  }
429 }
Definition: matvec3.h:98
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
const StructNode * pNode2
Definition: planej.h:54
void SetValue(DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *ph=0)
Definition: friction.h:45
bool calcInitdTheta
Definition: planej.h:68
Vec3 VecRot(const Mat3x3 &Phi)
Definition: Rot.cc:136
const doublereal & dGet(unsigned short int iRow) const
Definition: matvec3.h:285
BasicFriction *const fc
Definition: planej.h:74
Mat3x3 MulTM(const Mat3x3 &m) const
Definition: matvec3.cc:500
virtual void PutCoef(integer iRow, const doublereal &dCoef)=0
virtual const Vec3 & GetXCurr(void) const
Definition: strnode.h:310
doublereal dThetaWrapped
Definition: planej.h:70
virtual void Put(integer iRow, const Vec3 &v)
Definition: vh.cc:93
Mat3x3 R2h
Definition: planej.h:58
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
Mat3x3 R1h
Definition: planej.h:56
long int integer
Definition: colamd.c:51
const StructNode * pNode1
Definition: planej.h:53
doublereal dTheta
Definition: planej.h:70
static const unsigned int NumSelfDof
Definition: planej.h:78

Here is the call graph for this function:

void PlaneHingeJoint::WorkSpaceDim ( integer piNumRows,
integer piNumCols 
) const
inlinevirtual

Implements Elem.

Definition at line 141 of file planej.h.

References fc, SimulationEntity::iGetNumDof(), and NumDof.

Referenced by AssJac(), and AssRes().

141  {
142  *piNumRows = NumDof;
143  *piNumCols = NumDof;
144  if (fc) {
145  *piNumRows += fc->iGetNumDof();
146  *piNumCols += fc->iGetNumDof();
147  }
148  };
static const unsigned int NumDof
Definition: planej.h:79
BasicFriction *const fc
Definition: planej.h:74
virtual unsigned int iGetNumDof(void) const =0

Here is the call graph for this function:

Member Data Documentation

bool PlaneHingeJoint::calcInitdTheta
private

Definition at line 68 of file planej.h.

Referenced by SetValue().

Vec3 PlaneHingeJoint::d1
private

Definition at line 55 of file planej.h.

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

Vec3 PlaneHingeJoint::d2
private

Definition at line 57 of file planej.h.

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

doublereal PlaneHingeJoint::dTheta
mutableprivate

Definition at line 70 of file planej.h.

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

doublereal PlaneHingeJoint::dThetaWrapped
mutableprivate

Definition at line 70 of file planej.h.

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

Vec3 PlaneHingeJoint::F
private
Vec3 PlaneHingeJoint::M
private
doublereal PlaneHingeJoint::M3
private

Definition at line 77 of file planej.h.

Referenced by AssRes(), and Output().

int PlaneHingeJoint::NTheta
mutableprivate

Definition at line 69 of file planej.h.

Referenced by AfterConvergence(), and dGetPrivData().

const unsigned int PlaneHingeJoint::NumDof
staticprivate

Definition at line 79 of file planej.h.

Referenced by WorkSpaceDim().

const unsigned int PlaneHingeJoint::NumSelfDof
staticprivate
OrientationDescription PlaneHingeJoint::od
protected

Definition at line 83 of file planej.h.

Referenced by Output(), and OutputPrepare().

const StructNode* PlaneHingeJoint::pNode1
private
const StructNode* PlaneHingeJoint::pNode2
private
const doublereal PlaneHingeJoint::preF
private

Definition at line 75 of file planej.h.

Referenced by AfterConvergence(), AssJac(), and AssRes().

const doublereal PlaneHingeJoint::r
private

Definition at line 76 of file planej.h.

Referenced by AfterConvergence(), AssJac(), and AssRes().

Mat3x3 PlaneHingeJoint::R1h
private
Mat3x3 PlaneHingeJoint::R2h
private
BasicShapeCoefficient* const PlaneHingeJoint::Sh_c
private

Definition at line 73 of file planej.h.

Referenced by AssJac(), AssRes(), and ~PlaneHingeJoint().


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