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

#include <drvdisp.h>

Inheritance diagram for DriveDisplacementPinJoint:
Collaboration diagram for DriveDisplacementPinJoint:

Public Member Functions

 DriveDisplacementPinJoint (unsigned int uL, const DofOwner *pDO, const TplDriveCaller< Vec3 > *pDC, const StructNode *pN, const Vec3 &f, const Vec3 &x, flag fOut)
 
virtual ~DriveDisplacementPinJoint (void)
 
virtual Joint::Type GetJointType (void) const
 
virtual std::ostream & Restart (std::ostream &out) const
 
virtual void Output (OutputHandler &OH) const
 
void SetValue (DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *ph=0)
 
virtual HintParseHint (DataManager *pDM, const char *s) 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
 
virtual void WorkSpaceDim (integer *piNumRows, integer *piNumCols) const
 
virtual VariableSubMatrixHandlerAssJac (VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual SubVectorHandlerAssRes (SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual void AfterPredict (VectorHandler &X, VectorHandler &XP)
 
virtual unsigned int iGetInitialNumDof (void) const
 
virtual void InitialWorkSpaceDim (integer *piNumRows, integer *piNumCols) const
 
virtual VariableSubMatrixHandlerInitialAssJac (VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
 
virtual SubVectorHandlerInitialAssRes (SubVectorHandler &WorkVec, const VectorHandler &XCurr)
 
virtual unsigned int iGetNumPrivData (void) const
 
unsigned int iGetPrivDataIdx (const char *s) const
 
virtual doublereal dGetPrivData (unsigned int i=0) const
 
virtual void GetConnectedNodes (std::vector< const Node * > &connectedNodes) const
 
- Public Member Functions inherited from Elem
 Elem (unsigned int uL, flag fOut)
 
virtual ~Elem (void)
 
virtual 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 DofOrder::Order GetEqType (unsigned int i) const
 
virtual void BeforePredict (VectorHandler &, VectorHandler &, VectorHandler &, VectorHandler &) const
 
virtual void Update (const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual void DerivativesUpdate (const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual void AfterConvergence (const VectorHandler &X, const VectorHandler &XP)
 
virtual void AfterConvergence (const VectorHandler &X, const VectorHandler &XP, const VectorHandler &XPP)
 
virtual std::ostream & OutputAppend (std::ostream &out) const
 
virtual void ReadInitialState (MBDynParser &HP)
 
- Public Member Functions inherited from ToBeOutput
 ToBeOutput (flag fOut=fDefaultOut)
 
virtual ~ToBeOutput (void)
 
virtual void OutputPrepare (OutputHandler &OH)
 
virtual void Output (OutputHandler &OH, const VectorHandler &X, const VectorHandler &XP) const
 
virtual flag fToBeOutput (void) const
 
virtual bool bToBeOutput (void) const
 
virtual void SetOutputFlag (flag f=flag(1))
 
- Public Member Functions inherited from Joint
 Joint (unsigned int uL, const DofOwner *pD, flag fOut)
 
virtual ~Joint (void)
 
virtual Elem::Type GetElemType (void) const
 
std::ostream & Output (std::ostream &out, const char *sJointName, unsigned int uLabel, const Vec3 &FLocal, const Vec3 &MLocal, const Vec3 &FGlobal, const Vec3 &MGlobal) const
 
virtual void SetInitialValue (VectorHandler &)
 
virtual void 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)
 
- Public Member Functions inherited from TplDriveOwner< Vec3 >
 TplDriveOwner (const TplDriveCaller< Vec3 > *pDC=0)
 
virtual ~TplDriveOwner (void)
 
void Set (const TplDriveCaller< Vec3 > *pDC)
 
TplDriveCaller< Vec3 > * pGetDriveCaller (void) const
 
Vec3 Get (const doublereal &dVar) const
 
Vec3 Get (void) const
 
virtual bool bIsDifferentiable (void) const
 
virtual Vec3 GetP (void) const
 

Protected Member Functions

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

Protected Attributes

const StructNodepNode
 
Vec3 f
 
Vec3 x
 
Vec3 fRef
 
Vec3 dRef
 
Vec3 F
 
- Protected Attributes inherited from WithLabel
unsigned int uLabel
 
std::string sName
 
- Protected Attributes inherited from ToBeOutput
flag fOutput
 
- Protected Attributes inherited from GravityOwner
GravitypGravity
 
- Protected Attributes inherited from TplDriveOwner< Vec3 >
TplDriveCaller< Vec3 > * pTplDriveCaller
 

Additional Inherited Members

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

Detailed Description

Definition at line 189 of file drvdisp.h.

Constructor & Destructor Documentation

DriveDisplacementPinJoint::DriveDisplacementPinJoint ( unsigned int  uL,
const DofOwner pDO,
const TplDriveCaller< Vec3 > *  pDC,
const StructNode pN,
const Vec3 f,
const Vec3 x,
flag  fOut 
)

Definition at line 674 of file drvdisp.cc.

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

681 : Elem(uL, fOut),
682 Joint(uL, pDO, fOut),
684 pNode(pN), f(f), x(x),
685 fRef(Zero3),
686 dRef(Zero3),
687 F(Zero3)
688 {
689  ASSERT(pNode != NULL);
691 }
const Vec3 Zero3(0., 0., 0.)
virtual Node::Type GetNodeType(void) const
Definition: strnode.cc:145
Joint(unsigned int uL, const DofOwner *pD, flag fOut)
Definition: joint.cc:83
const StructNode * pNode
Definition: drvdisp.h:194
#define ASSERT(expression)
Definition: colamd.c:977
Elem(unsigned int uL, flag fOut)
Definition: elem.cc:41

Here is the call graph for this function:

DriveDisplacementPinJoint::~DriveDisplacementPinJoint ( void  )
virtual

Definition at line 695 of file drvdisp.cc.

References NO_OP.

696 {
697  NO_OP;
698 }
#define NO_OP
Definition: myassert.h:74

Member Function Documentation

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

Reimplemented from SimulationEntity.

Definition at line 1006 of file drvdisp.cc.

References dRef, f, fRef, TplDriveOwner< Vec3 >::Get(), StructNode::GetRRef(), and pNode.

1008 {
1009  /* Recupera i dati */
1010  fRef = pNode->GetRRef()*f;
1011  dRef = Get();
1012 }
virtual const Mat3x3 & GetRRef(void) const
Definition: strnode.h:1006
const StructNode * pNode
Definition: drvdisp.h:194
Vec3 Get(void) const
Definition: tpldrive.h:113

Here is the call graph for this function:

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

Implements Elem.

Definition at line 969 of file drvdisp.cc.

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

973 {
974  DEBUGCOUT("Entering DriveDisplacementPinJoint::AssJac()" << std::endl);
975 
976  FullSubMatrixHandler& WM = WorkMat.SetFull();
977 
978  /* Dimensiona e resetta la matrice di lavoro */
979  integer iNumRows = 0;
980  integer iNumCols = 0;
981  WorkSpaceDim(&iNumRows, &iNumCols);
982  WM.ResizeReset(iNumRows, iNumCols);
983 
984  /* Recupera gli indici */
985  integer iNodeFirstPosIndex = pNode->iGetFirstPositionIndex();
986  integer iNodeFirstMomIndex = pNode->iGetFirstMomentumIndex();
987  integer iFirstReactionIndex = iGetFirstIndex();
988 
989  /* Setta gli indici della matrice */
990  for (int iCnt = 1; iCnt <= 6; iCnt++) {
991  WM.PutRowIndex(iCnt, iNodeFirstMomIndex + iCnt);
992  WM.PutColIndex(iCnt, iNodeFirstPosIndex + iCnt);
993  }
994  for (int iCnt = 1; iCnt <= 3; iCnt++) {
995  WM.PutRowIndex(6 + iCnt, iFirstReactionIndex + iCnt);
996  WM.PutColIndex(6 + iCnt, iFirstReactionIndex + iCnt);
997  }
998 
999  AssMat(WM, dCoef);
1000 
1001  return WorkMat;
1002 }
void PutColIndex(integer iSubCol, integer iCol)
Definition: submat.h:325
FullSubMatrixHandler & SetFull(void)
Definition: submat.h:1168
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: drvdisp.h:265
const StructNode * pNode
Definition: drvdisp.h:194
#define DEBUGCOUT(msg)
Definition: myassert.h:232
virtual integer iGetFirstMomentumIndex(void) const =0
virtual integer iGetFirstPositionIndex(void) const
Definition: strnode.h:452
virtual void ResizeReset(integer, integer)
Definition: submat.cc:182
void PutRowIndex(integer iSubRow, integer iRow)
Definition: submat.h:311
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
void AssMat(FullSubMatrixHandler &WM, doublereal dCoef)
Definition: drvdisp.cc:1016
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

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

Definition at line 1016 of file drvdisp.cc.

References FullSubMatrixHandler::Add(), F, fRef, FullSubMatrixHandler::IncCoef(), MatCross, MatCrossCross, and FullSubMatrixHandler::Sub().

Referenced by AssJac().

1017 {
1018  for (int iCnt = 1; iCnt <= 3; iCnt++) {
1019  /* node force */
1020  WM.IncCoef(iCnt, 6 + iCnt, 1.);
1021 
1022  /* node constraint */
1023  WM.IncCoef(6 + iCnt, iCnt, 1.);
1024  }
1025 
1026  Mat3x3 MTmp(MatCross, fRef);
1027 
1028  /* node moment */
1029  WM.Add(3 + 1, 6 + 1, MTmp);
1030 
1031  /* node constraint */
1032  WM.Sub(6 + 1, 3 + 1, MTmp);
1033 
1034  MTmp = Mat3x3(MatCrossCross, F, fRef*dCoef);
1035 
1036  /* node moment */
1037  WM.Add(3 + 1, 3 + 1, MTmp);
1038 }
const MatCross_Manip MatCross
Definition: matvec3.cc:639
void Add(integer iRow, integer iCol, const Vec3 &v)
Definition: submat.cc:209
void IncCoef(integer iRow, integer iCol, const doublereal &dCoef)
Definition: submat.h:683
const MatCrossCross_Manip MatCrossCross
Definition: matvec3.cc:640
void Sub(integer iRow, integer iCol, const Vec3 &v)
Definition: submat.cc:215

Here is the call graph for this function:

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

Implements Elem.

Definition at line 1043 of file drvdisp.cc.

References AssVec(), DEBUGCOUT, F, DofOwnerOwner::iGetFirstIndex(), StructDispNode::iGetFirstMomentumIndex(), pNode, SubVectorHandler::PutRowIndex(), VectorHandler::ResizeReset(), and WorkSpaceDim().

1047 {
1048  DEBUGCOUT("Entering DriveDisplacementPinJoint::AssRes()" << std::endl);
1049 
1050  /* Dimensiona e resetta la matrice di lavoro */
1051  integer iNumRows = 0;
1052  integer iNumCols = 0;
1053  WorkSpaceDim(&iNumRows, &iNumCols);
1054  WorkVec.ResizeReset(iNumRows);
1055 
1056  /* Recupera gli indici */
1057  integer iNodeFirstMomIndex = pNode->iGetFirstMomentumIndex();
1058  integer iFirstReactionIndex = iGetFirstIndex();
1059 
1060  /* Setta gli indici della matrice */
1061  for (int iCnt = 1; iCnt <= 6; iCnt++) {
1062  WorkVec.PutRowIndex(iCnt, iNodeFirstMomIndex + iCnt);
1063  }
1064 
1065  for (int iCnt = 1; iCnt <= 3; iCnt++) {
1066  WorkVec.PutRowIndex(6 + iCnt, iFirstReactionIndex + iCnt);
1067  }
1068 
1069  F = Vec3(XCurr, iFirstReactionIndex + 1);
1070 
1071  AssVec(WorkVec, dCoef);
1072 
1073  return WorkVec;
1074 }
void AssVec(SubVectorHandler &WorkVec, doublereal dCoef)
Definition: drvdisp.cc:1078
Definition: matvec3.h:98
virtual void ResizeReset(integer)
Definition: vh.cc:55
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: drvdisp.h:265
const StructNode * pNode
Definition: drvdisp.h:194
virtual void PutRowIndex(integer iSubRow, integer iRow)=0
#define DEBUGCOUT(msg)
Definition: myassert.h:232
virtual integer iGetFirstMomentumIndex(void) const =0
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 DriveDisplacementPinJoint::AssVec ( SubVectorHandler WorkVec,
doublereal  dCoef 
)
protected

Definition at line 1078 of file drvdisp.cc.

References ASSERT, Vec3::Cross(), f, F, TplDriveOwner< Vec3 >::Get(), StructNode::GetRCurr(), StructDispNode::GetXCurr(), pNode, VectorHandler::Sub(), and x.

Referenced by AssRes().

1079 {
1080  Vec3 fTmp = pNode->GetRCurr()*f;
1081  Vec3 d = Get();
1082 
1083  WorkVec.Sub(1, F);
1084  WorkVec.Sub(3 + 1, fTmp.Cross(F));
1085 
1086  ASSERT(dCoef != 0.);
1087  WorkVec.Sub(6 + 1, (pNode->GetXCurr() + fTmp - x - d)/dCoef);
1088 }
Vec3 Cross(const Vec3 &v) const
Definition: matvec3.h:218
Definition: matvec3.h:98
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
virtual void Sub(integer iRow, const Vec3 &v)
Definition: vh.cc:78
const StructNode * pNode
Definition: drvdisp.h:194
#define ASSERT(expression)
Definition: colamd.c:977
virtual const Vec3 & GetXCurr(void) const
Definition: strnode.h:310
Vec3 Get(void) const
Definition: tpldrive.h:113

Here is the call graph for this function:

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

Reimplemented from Elem.

Definition at line 797 of file drvdisp.cc.

References DofOwnerOwner::iGetFirstIndex().

799 {
800  integer iIndex = iGetFirstIndex();
801 
802  out
803  << prefix << iIndex + 1 << "->" << iIndex + 3 << ": "
804  "reaction forces [fx,fy,fz]" << std::endl;
805 
806  if (bInitial) {
807  iIndex += 3;
808  out
809  << prefix << iIndex + 1 << "->" << iIndex + 3 << ": "
810  "reaction force derivatives [fPx,fPy,fPz]" << std::endl;
811  }
812 
813  return out;
814 }
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 DriveDisplacementPinJoint::DescribeDof ( std::vector< std::string > &  desc,
bool  bInitial = false,
int  i = -1 
) const
virtual

Reimplemented from Elem.

Definition at line 817 of file drvdisp.cc.

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

819 {
820  int iend = 1;
821  if (i == -1) {
822  if (bInitial) {
823  iend = 6;
824 
825  } else {
826  iend = 3;
827  }
828  }
829  desc.resize(iend);
830 
831  std::ostringstream os;
832  os << "DriveDisplacementPinJoint(" << GetLabel() << ")";
833 
834  if (i == -1) {
835  std::string name = os.str();
836  for (i = 0; i < iend; i++) {
837  os.str(name);
838  os.seekp(0, std::ios_base::end);
839  os << ": " << dof[i/3] << xyz[i%3];
840 
841  desc[i] = os.str();
842  }
843 
844  } else {
845  os << ": " << dof[i/3] << xyz[i%3];
846  desc[0] = os.str();
847  }
848 }
static const char xyz[]
Definition: drvdisp.cc:194
static const char * dof[]
Definition: drvdisp.cc:195
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

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

Reimplemented from Elem.

Definition at line 851 of file drvdisp.cc.

References DofOwnerOwner::iGetFirstIndex().

853 {
854  integer iIndex = iGetFirstIndex();
855 
856  out
857  << prefix << iIndex + 1 << "->" << iIndex + 3 << ": "
858  "position constraints [px1=px2,py1=py2,pz1=pz2]" << std::endl;
859 
860  if (bInitial) {
861  iIndex += 3;
862  out
863  << prefix << iIndex + 1 << "->" << iIndex + 3 << ": "
864  "velocity constraints [vx1=vx2,vy1=vy2,vz1=vz2]" << std::endl;
865  }
866 
867  return out;
868 
869 }
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 DriveDisplacementPinJoint::DescribeEq ( std::vector< std::string > &  desc,
bool  bInitial = false,
int  i = -1 
) const
virtual

Reimplemented from Elem.

Definition at line 872 of file drvdisp.cc.

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

874 {
875  int iend = 1;
876  if (i == -1) {
877  if (bInitial) {
878  iend = 6;
879 
880  } else {
881  iend = 3;
882  }
883  }
884  desc.resize(iend);
885 
886  std::ostringstream os;
887  os << "DriveDisplacementPinJoint(" << GetLabel() << ")";
888 
889  if (i == -1) {
890  std::string name = os.str();
891  for (i = 0; i < iend; i++) {
892  os.str(name);
893  os.seekp(0, std::ios_base::end);
894  os << ": " << eq[i/3] << xyz[i%3];
895 
896  desc[i] = os.str();
897  }
898 
899  } else {
900  os << ": " << eq[i/3] << xyz[i%3];
901  desc[0] = os.str();
902  }
903 }
static const char xyz[]
Definition: drvdisp.cc:194
static const char * eq[]
Definition: drvdisp.cc:196
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

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

Reimplemented from SimulationEntity.

Definition at line 948 of file drvdisp.cc.

References ASSERT, Vec3::dGet(), F, TplDriveOwner< Vec3 >::Get(), and MBDYN_EXCEPT_ARGS.

949 {
950  ASSERT(i >= 1 && i <= 6);
951 
952  switch (i) {
953  case 1:
954  case 2:
955  case 3:
956  return Get().dGet(i);
957 
958  case 4:
959  case 5:
960  case 6:
961  return F(i - 3);
962  }
963 
965 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
const doublereal & dGet(unsigned short int iRow) const
Definition: matvec3.h:285
#define ASSERT(expression)
Definition: colamd.c:977
Vec3 Get(void) const
Definition: tpldrive.h:113

Here is the call graph for this function:

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

Reimplemented from Elem.

Definition at line 319 of file drvdisp.h.

References pNode.

319  {
320  connectedNodes.resize(1);
321  connectedNodes[0] = pNode;
322  };
const StructNode * pNode
Definition: drvdisp.h:194
virtual DofOrder::Order DriveDisplacementPinJoint::GetDofType ( unsigned int  i) const
inlinevirtual

Reimplemented from Elem.

Definition at line 260 of file drvdisp.h.

References DofOrder::ALGEBRAIC, and ASSERT.

260  {
261  ASSERT(i >= 0 && i <= 3);
262  return DofOrder::ALGEBRAIC;
263  };
#define ASSERT(expression)
Definition: colamd.c:977
virtual Joint::Type DriveDisplacementPinJoint::GetJointType ( void  ) const
inlinevirtual

Implements Joint.

Definition at line 220 of file drvdisp.h.

References Joint::DRIVEDISPPIN.

220  {
221  return DRIVEDISPPIN;
222  };
virtual unsigned int DriveDisplacementPinJoint::iGetInitialNumDof ( void  ) const
inlinevirtual

Implements SubjectToInitialAssembly.

Definition at line 288 of file drvdisp.h.

288  {
289  return 6;
290  };
virtual unsigned int DriveDisplacementPinJoint::iGetNumDof ( void  ) const
inlinevirtual

Reimplemented from Elem.

Definition at line 236 of file drvdisp.h.

236  {
237  return 3;
238  };
unsigned int DriveDisplacementPinJoint::iGetNumPrivData ( void  ) const
virtual

Reimplemented from SimulationEntity.

Definition at line 907 of file drvdisp.cc.

908 {
909  return 6;
910 };
unsigned int DriveDisplacementPinJoint::iGetPrivDataIdx ( const char *  s) const
virtual

Reimplemented from SimulationEntity.

Definition at line 913 of file drvdisp.cc.

References ASSERT.

914 {
915  ASSERT(s != NULL);
916  ASSERT(s[0] != '\0');
917 
918  if (s[2] != '\0') {
919  return 0;
920  }
921 
922  unsigned int idx = 0;
923 
924  switch (s[0]) {
925  case 'f':
926  idx += 3;
927  /* fallthru */
928  case 'd':
929  break;
930 
931  default:
932  return 0;
933  }
934 
935  switch (s[1]) {
936  case 'x':
937  return idx + 1;
938  case 'y':
939  return idx + 2;
940  case 'z':
941  return idx + 3;
942  }
943 
944  return 0;
945 }
#define ASSERT(expression)
Definition: colamd.c:977
VariableSubMatrixHandler & DriveDisplacementPinJoint::InitialAssJac ( VariableSubMatrixHandler WorkMat,
const VectorHandler XCurr 
)
virtual

Implements SubjectToInitialAssembly.

Definition at line 1093 of file drvdisp.cc.

References FullSubMatrixHandler::Add(), DEBUGCOUT, F, fRef, StructNode::GetWRef(), DofOwnerOwner::iGetFirstIndex(), StructDispNode::iGetFirstPositionIndex(), FullSubMatrixHandler::IncCoef(), InitialWorkSpaceDim(), MatCross, MatCrossCross, pNode, FullSubMatrixHandler::PutColIndex(), FullSubMatrixHandler::PutRowIndex(), FullSubMatrixHandler::ResizeReset(), VariableSubMatrixHandler::SetFull(), and FullSubMatrixHandler::Sub().

1095 {
1096  DEBUGCOUT("Entering DriveDisplacementPinJoint::InitialAssJac()" << std::endl);
1097 
1098  FullSubMatrixHandler& WM = WorkMat.SetFull();
1099 
1100  /* Dimensiona e resetta la matrice di lavoro */
1101  integer iNumRows = 0;
1102  integer iNumCols = 0;
1103  InitialWorkSpaceDim(&iNumRows, &iNumCols);
1104  WM.ResizeReset(iNumRows, iNumCols);
1105 
1106  /* Recupera gli indici */
1107  integer iNodeFirstPosIndex = pNode->iGetFirstPositionIndex();
1108  integer iFirstReactionIndex = iGetFirstIndex();
1109  integer iNodeFirstVelIndex = iNodeFirstPosIndex + 6;
1110  integer iReactionPrimeIndex = iFirstReactionIndex + 3;
1111 
1112  /* Setta gli indici della matrice */
1113  for (int iCnt = 1; iCnt <= 6; iCnt++) {
1114  WM.PutRowIndex(iCnt, iNodeFirstPosIndex + iCnt);
1115  WM.PutColIndex(iCnt, iNodeFirstPosIndex + iCnt);
1116  WM.PutRowIndex(6 + iCnt, iNodeFirstVelIndex + iCnt);
1117  WM.PutColIndex(6 + iCnt, iNodeFirstVelIndex + iCnt);
1118  WM.PutRowIndex(12 + iCnt, iFirstReactionIndex + iCnt);
1119  WM.PutColIndex(12 + iCnt, iFirstReactionIndex + iCnt);
1120  }
1121 
1122  Vec3 FPrime = Vec3(XCurr, iReactionPrimeIndex + 1);
1123 
1124  for (int iCnt = 1; iCnt <= 3; iCnt++) {
1125  /* node 2 force */
1126  WM.IncCoef(iCnt, 12 + iCnt, 1.);
1127 
1128  /* node 2 force derivative */
1129  WM.IncCoef(6 + iCnt, 15 + iCnt, 1.);
1130 
1131  /* node 2 constraint */
1132  WM.IncCoef(12 + iCnt, iCnt, 1.);
1133 
1134  /* node 2 constraint derivative */
1135  WM.IncCoef(15 + iCnt, 6 + iCnt, 1.);
1136  }
1137 
1138  Mat3x3 MTmp(MatCross, fRef);
1139  /* node 2 moment */
1140  WM.Add(3 + 1, 12 + 1, MTmp);
1141  /* node 2 moment derivatives */
1142  WM.Add(9 + 1, 15 + 1, MTmp);
1143  /* node 2 constraint */
1144  WM.Sub(12 + 1, 3 + 1, MTmp);
1145  /* node 2 constraint derivative */
1146  WM.Sub(15 + 1, 9 + 1, MTmp);
1147 
1148  MTmp = Mat3x3(MatCrossCross, F, fRef);
1149  /* node 2 moment */
1150  WM.Add(3 + 1, 3 + 1, MTmp);
1151 
1152  MTmp = Mat3x3(MatCrossCross, FPrime, fRef);
1153  /* node 2 moment derivative */
1154  WM.Add(9 + 1, 9 + 1, MTmp);
1155 
1156  MTmp = Mat3x3(MatCrossCross, pNode->GetWRef(), fRef);
1157  /* node 2 constraint derivative */
1158  WM.Add(15 + 1, 3 + 1, MTmp);
1159 
1160  return WorkMat;
1161 }
void PutColIndex(integer iSubCol, integer iCol)
Definition: submat.h:325
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
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: drvdisp.h:292
virtual const Vec3 & GetWRef(void) const
Definition: strnode.h:1024
const StructNode * pNode
Definition: drvdisp.h:194
void IncCoef(integer iRow, integer iCol, const doublereal &dCoef)
Definition: submat.h:683
#define DEBUGCOUT(msg)
Definition: myassert.h:232
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
void Sub(integer iRow, integer iCol, const Vec3 &v)
Definition: submat.cc:215
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

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

Implements SubjectToInitialAssembly.

Definition at line 1166 of file drvdisp.cc.

References VectorHandler::Add(), TplDriveOwner< Vec3 >::bIsDifferentiable(), Vec3::Cross(), DEBUGCOUT, dRef, f, F, fRef, TplDriveOwner< Vec3 >::Get(), TplDriveOwner< Vec3 >::GetP(), StructNode::GetRCurr(), StructDispNode::GetVCurr(), StructNode::GetWCurr(), StructDispNode::GetXCurr(), DofOwnerOwner::iGetFirstIndex(), StructDispNode::iGetFirstPositionIndex(), InitialWorkSpaceDim(), pNode, SubVectorHandler::PutRowIndex(), VectorHandler::ResizeReset(), and VectorHandler::Sub().

1168 {
1169  DEBUGCOUT("Entering DriveDisplacementPinJoint::InitialAssRes()" << std::endl);
1170 
1171  /* Dimensiona e resetta la matrice di lavoro */
1172  integer iNumRows = 0;
1173  integer iNumCols = 0;
1174  InitialWorkSpaceDim(&iNumRows, &iNumCols);
1175  WorkVec.ResizeReset(iNumRows);
1176 
1177  /* Recupera gli indici */
1178  integer iNodeFirstPosIndex = pNode->iGetFirstPositionIndex();
1179  integer iFirstReactionIndex = iGetFirstIndex();
1180  integer iNodeFirstVelIndex = iNodeFirstPosIndex + 6;
1181  integer iFirstReactionPrimeIndex = iFirstReactionIndex + 3;
1182 
1183  /* Setta gli indici del vettore */
1184  for (int iCnt = 1; iCnt <= 6; iCnt++) {
1185  WorkVec.PutRowIndex(iCnt, iNodeFirstPosIndex + iCnt);
1186  WorkVec.PutRowIndex(6 + iCnt, iNodeFirstVelIndex + iCnt);
1187  WorkVec.PutRowIndex(12 + iCnt, iFirstReactionIndex + iCnt);
1188  }
1189 
1190  F = Vec3(XCurr, iFirstReactionIndex + 1);
1191  Vec3 FPrime = Vec3(XCurr, iFirstReactionPrimeIndex + 1);
1192 
1193  dRef = Get();
1194  fRef = pNode->GetRCurr()*f;
1195 
1196  WorkVec.Sub(1, F);
1197  WorkVec.Sub(3 + 1, fRef.Cross(F));
1198  WorkVec.Sub(6 + 1, FPrime);
1199  WorkVec.Sub(9 + 1, fRef.Cross(FPrime));
1200 
1201  WorkVec.Add(12 + 1, dRef - pNode->GetXCurr() - fRef);
1202 
1203  /* in case the drive is differentiable... */
1204  Vec3 PhiPrime = pNode->GetVCurr() + pNode->GetWCurr().Cross(fRef);
1205  if (bIsDifferentiable()) {
1206  PhiPrime -= GetP();
1207  }
1208  WorkVec.Sub(15 + 1, PhiPrime);
1209 
1210  return WorkVec;
1211 }
Vec3 Cross(const Vec3 &v) const
Definition: matvec3.h:218
virtual bool bIsDifferentiable(void) const
Definition: tpldrive.h:118
Definition: matvec3.h:98
virtual void ResizeReset(integer)
Definition: vh.cc:55
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: drvdisp.h:292
virtual void Sub(integer iRow, const Vec3 &v)
Definition: vh.cc:78
const StructNode * pNode
Definition: drvdisp.h:194
virtual Vec3 GetP(void) const
Definition: tpldrive.h:121
virtual void PutRowIndex(integer iSubRow, integer iRow)=0
#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 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
Vec3 Get(void) const
Definition: tpldrive.h:113

Here is the call graph for this function:

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

Implements SubjectToInitialAssembly.

Definition at line 292 of file drvdisp.h.

Referenced by InitialAssJac(), and InitialAssRes().

294  {
295  *piNumRows = 18;
296  *piNumCols = 18;
297  };
void DriveDisplacementPinJoint::Output ( OutputHandler OH) const
virtual

Reimplemented from ToBeOutput.

Definition at line 715 of file drvdisp.cc.

References ToBeOutput::bToBeOutput(), f, F, WithLabel::GetLabel(), StructNode::GetRCurr(), StructDispNode::GetXCurr(), OutputHandler::Joints(), Joint::Output(), pNode, x, and Zero3.

716 {
717  if (bToBeOutput()) {
718  Vec3 d(pNode->GetXCurr() + pNode->GetRCurr()*f - x);
719  Joint::Output(OH.Joints(), "DriveDisplacementPinJoint", GetLabel(),
720  F, Zero3, F, Zero3)
721  << " " << d << std::endl;
722  }
723 }
const Vec3 Zero3(0., 0., 0.)
virtual bool bToBeOutput(void) const
Definition: output.cc:890
Definition: matvec3.h:98
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
const StructNode * pNode
Definition: drvdisp.h:194
std::ostream & Joints(void) const
Definition: output.h:443
virtual const Vec3 & GetXCurr(void) const
Definition: strnode.h:310
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 * DriveDisplacementPinJoint::ParseHint ( DataManager pDM,
const char *  s 
) const
virtual

Reimplemented from SimulationEntity.

Definition at line 773 of file drvdisp.cc.

References SimulationEntity::ParseHint(), and STRLENOF.

774 {
775  if (strncasecmp(s, "offset{" /*}*/ , STRLENOF("offset{" /*}*/ )) == 0)
776  {
777  s += STRLENOF("offset{" /*}*/ );
778 
779  if (strcmp(&s[1], /*{*/ "}") != 0) {
780  return 0;
781  }
782 
783  switch (s[0]) {
784  case '1':
785  return new Joint::OffsetHint<1>;
786 
787  case '0':
788  return new Joint::OffsetHint<0>;
789  }
790  }
791 
792  /* take care of "drive" hint... */
793  return SimulationEntity::ParseHint(pDM, s);
794 }
virtual Hint * ParseHint(DataManager *pDM, const char *s) const
Definition: simentity.cc:76
#define STRLENOF(s)
Definition: mbdyn.h:166

Here is the call graph for this function:

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

Implements Elem.

Definition at line 703 of file drvdisp.cc.

References f, WithLabel::GetLabel(), TplDriveOwner< Vec3 >::pGetDriveCaller(), pNode, TplDriveCaller< T >::Restart(), Joint::Restart(), Vec3::Write(), and x.

704 {
705  Joint::Restart(out) << ", drive displacement pin, "
706  << pNode->GetLabel() << ", reference, node, ",
707  f.Write(out, ", ") << ", ",
708  x.Write(out, ", ") << ", ",
709  pGetDriveCaller()->Restart(out) << ';' << std::endl;
710  return out;
711 }
std::ostream & Write(std::ostream &out, const char *sFill=" ") const
Definition: matvec3.cc:738
const StructNode * pNode
Definition: drvdisp.h:194
TplDriveCaller< Vec3 > * pGetDriveCaller(void) const
Definition: tpldrive.h:105
virtual std::ostream & Restart(std::ostream &out) const
Definition: joint.h:195
virtual std::ostream & Restart(std::ostream &out) const =0
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

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

Reimplemented from Joint.

Definition at line 726 of file drvdisp.cc.

References f, TplDriveOwner< Vec3 >::Get(), StructNode::GetRCurr(), StructDispNode::GetXCurr(), MBDYN_EXCEPT_ARGS, TplDriveHint< T >::pCreateDrive(), pNode, TplDriveOwner< T >::Set(), Mat3x3::Transpose(), WithLabel::uLabel, and x.

729 {
730  if (ph) {
731  for (unsigned i = 0; i < ph->size(); i++) {
732  Joint::JointHint *pjh = dynamic_cast<Joint::JointHint *>((*ph)[i]);
733 
734  if (pjh) {
735  if (dynamic_cast<Joint::OffsetHint<1> *>(pjh)) {
736  Mat3x3 Rt(pNode->GetRCurr().Transpose());
737 
738  f = Rt*(x + Get() - pNode->GetXCurr());
739 
740  } else if (dynamic_cast<Joint::OffsetHint<0> *>(pjh)) {
741  Vec3 fTmp(pNode->GetRCurr()*f);
742 
743  x = pNode->GetXCurr() + fTmp - Get();
744 
745  } else if (dynamic_cast<Joint::ReactionsHint *>(pjh)) {
746  /* TODO */
747  }
748  continue;
749  }
750 
751  TplDriveHint<Vec3> *pdh = dynamic_cast<TplDriveHint<Vec3> *>((*ph)[i]);
752 
753  if (pdh) {
754  pedantic_cout("DriveDisplacementPinJoint(" << uLabel << "): "
755  "creating drive from hint[" << i << "]..." << std::endl);
756 
757  TplDriveCaller<Vec3> *pDC = pdh->pCreateDrive(pDM);
758  if (pDC == 0) {
759  silent_cerr("DriveDisplacementPinJoint(" << uLabel << "): "
760  "unable to create drive "
761  "after hint #" << i << std::endl);
763  }
764 
766  continue;
767  }
768  }
769  }
770 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Definition: matvec3.h:98
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
const StructNode * pNode
Definition: drvdisp.h:194
void Set(const TplDriveCaller< T > *pDC)
Definition: tpldrive.h:97
unsigned int uLabel
Definition: withlab.h:44
TplDriveCaller< T > * pCreateDrive(DataManager *pDM) const
Definition: hint_impl.h:124
virtual const Vec3 & GetXCurr(void) const
Definition: strnode.h:310
Mat3x3 Transpose(void) const
Definition: matvec3.h:816
Vec3 Get(void) const
Definition: tpldrive.h:113

Here is the call graph for this function:

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

Implements Elem.

Definition at line 265 of file drvdisp.h.

Referenced by AssJac(), and AssRes().

266  {
267  *piNumRows = 9;
268  *piNumCols = 9;
269  };

Member Data Documentation

Vec3 DriveDisplacementPinJoint::dRef
protected

Definition at line 199 of file drvdisp.h.

Referenced by AfterPredict(), and InitialAssRes().

Vec3 DriveDisplacementPinJoint::f
mutableprotected

Definition at line 195 of file drvdisp.h.

Referenced by AfterPredict(), AssVec(), InitialAssRes(), Output(), Restart(), and SetValue().

Vec3 DriveDisplacementPinJoint::F
protected

Definition at line 201 of file drvdisp.h.

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

Vec3 DriveDisplacementPinJoint::fRef
protected

Definition at line 198 of file drvdisp.h.

Referenced by AfterPredict(), AssMat(), InitialAssJac(), and InitialAssRes().

const StructNode* DriveDisplacementPinJoint::pNode
protected
Vec3 DriveDisplacementPinJoint::x
mutableprotected

Definition at line 196 of file drvdisp.h.

Referenced by AssVec(), Output(), Restart(), and SetValue().


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