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

#include <genj.h>

Inheritance diagram for DistanceJointWithOffset:
Collaboration diagram for DistanceJointWithOffset:

Public Member Functions

 DistanceJointWithOffset (unsigned int uL, const DofOwner *pDO, const StructNode *pN1, const StructNode *pN2, const Vec3 &f1Tmp, const Vec3 &f2Tmp, const DriveCaller *pDC, flag fOut)
 
 ~DistanceJointWithOffset (void)
 
virtual Joint::Type GetJointType (void) const
 
virtual std::ostream & Restart (std::ostream &out) const
 
virtual unsigned int iGetNumDof (void) const
 
virtual DofOrder::Order GetDofType (unsigned int i) const
 
virtual DofOrder::Order GetEqType (unsigned int i) const
 
virtual void WorkSpaceDim (integer *piNumRows, integer *piNumCols) const
 
VariableSubMatrixHandlerAssJac (VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
SubVectorHandlerAssRes (SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual void Output (OutputHandler &OH) const
 
virtual unsigned int iGetInitialNumDof (void) const
 
virtual void InitialWorkSpaceDim (integer *piNumRows, integer *piNumCols) const
 
VariableSubMatrixHandlerInitialAssJac (VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
 
SubVectorHandlerInitialAssRes (SubVectorHandler &WorkVec, const VectorHandler &XCurr)
 
virtual void SetInitialValue (VectorHandler &X)
 
virtual void SetValue (DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *ph=0)
 
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 std::ostream & DescribeDof (std::ostream &out, const char *prefix="", bool bInitial=false) const
 
virtual void DescribeDof (std::vector< std::string > &desc, bool bInitial=false, int i=-1) const
 
virtual std::ostream & DescribeEq (std::ostream &out, const char *prefix="", bool bInitial=false) const
 
virtual void DescribeEq (std::vector< std::string > &desc, bool bInitial=false, int i=-1) const
 
virtual void AssMats (VariableSubMatrixHandler &WorkMatA, VariableSubMatrixHandler &WorkMatB, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual bool bInverseDynamics (void) const
 
void SetInverseDynamicsFlags (unsigned uIDF)
 
unsigned GetInverseDynamicsFlags (void) const
 
bool bIsErgonomy (void) const
 
bool bIsRightHandSide (void) const
 
virtual VariableSubMatrixHandlerAssJac (VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
 
virtual SubVectorHandlerAssRes (SubVectorHandler &WorkVec, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr, const VectorHandler &XPrimePrimeCurr, InverseDynamics::Order iOrder=InverseDynamics::INVERSE_DYNAMICS)
 
virtual int GetNumConnectedNodes (void) const
 
- Public Member Functions inherited from WithLabel
 WithLabel (unsigned int uL=0, const std::string &sN="")
 
virtual ~WithLabel (void)
 
void PutLabel (unsigned int uL)
 
void PutName (const std::string &sN)
 
unsigned int GetLabel (void) const
 
const std::string & GetName (void) const
 
- Public Member Functions inherited from SimulationEntity
 SimulationEntity (void)
 
virtual ~SimulationEntity (void)
 
virtual bool bIsValidIndex (unsigned int i) const
 
virtual HintParseHint (DataManager *pDM, const char *s) const
 
virtual void BeforePredict (VectorHandler &, VectorHandler &, VectorHandler &, VectorHandler &) const
 
virtual void 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)
 
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 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 DriveOwner
 DriveOwner (const DriveCaller *pDC=0)
 
 DriveOwner (const DriveOwner &drive)
 
virtual ~DriveOwner (void)
 
void Set (const DriveCaller *pDC)
 
DriveCallerpGetDriveCaller (void) const
 
doublereal dGet (const doublereal &dVar) const
 
doublereal dGet (void) const
 
bool bIsDifferentiable (void) const
 
doublereal dGetP (const doublereal &dVar) const
 
doublereal dGetP (void) const
 

Private Attributes

const StructNodepNode1
 
const StructNodepNode2
 
Vec3 f1
 
Vec3 f2
 
Vec3 v
 
doublereal dAlpha
 

Additional Inherited Members

- Public Types inherited from Elem
enum  Type {
  UNKNOWN = -1, AIRPROPERTIES = 0, INDUCEDVELOCITY, AUTOMATICSTRUCTURAL,
  GRAVITY, BODY, JOINT, JOINT_REGULARIZATION,
  BEAM, PLATE, FORCE, INERTIA,
  ELECTRICBULK, ELECTRIC, THERMAL, HYDRAULIC,
  BULK, LOADABLE, DRIVEN, EXTERNAL,
  AEROMODAL, AERODYNAMIC, GENEL, SOCKETSTREAM_OUTPUT,
  RTAI_OUTPUT = SOCKETSTREAM_OUTPUT, LASTELEMTYPE
}
 
- Public Types inherited from SimulationEntity
typedef std::vector< Hint * > Hints
 
- Public Types inherited from ToBeOutput
enum  { OUTPUT = 0x1U, OUTPUT_MASK = 0xFU, OUTPUT_PRIVATE = 0x10U, OUTPUT_PRIVATE_MASK = ~OUTPUT_MASK }
 
- Public Types inherited from Joint
enum  Type {
  UNKNOWN = -1, DISTANCE = 0, DISTANCEWITHOFFSET, CLAMP,
  SPHERICALHINGE, PIN, UNIVERSALHINGE, UNIVERSALROTATION,
  UNIVERSALPIN, PLANEHINGE, PLANEROTATION, PLANEPIN,
  AXIALROTATION, PLANEDISP, PLANEDISPPIN, INPLANE,
  INPLANECONTACT, J_INLINE, ROD, RODBEZIER,
  DEFORMABLEHINGE, DEFORMABLEDISPJOINT, DEFORMABLEJOINT, DEFORMABLEAXIALJOINT,
  VISCOUSBODY, LINEARVELOCITY, ANGULARVELOCITY, LINEARACCELERATION,
  ANGULARACCELERATION, PRISMATIC, DRIVEHINGE, DRIVEDISP,
  DRIVEDISPPIN, IMPOSEDORIENTATION, IMPOSEDDISP, IMPOSEDDISPPIN,
  IMPOSEDKINEMATICS, BEAMSLIDER, BRAKE, GIMBAL,
  POINT_SURFACE_CONTACT, TOTALJOINT, TOTALPINJOINT, TOTALEQUATION,
  TOTALREACTION, MODAL, SCREWJOINT, LASTJOINTTYPE
}
 
- Protected Member Functions inherited from Joint
virtual void OutputPrepare_int (const std::string &type, OutputHandler &OH, std::string &name)
 
- Protected Member Functions inherited from ElemGravityOwner
virtual Vec3 GetS_int (void) const
 
virtual Mat3x3 GetJ_int (void) const
 
virtual Vec3 GetB_int (void) const
 
virtual Vec3 GetG_int (void) const
 
- Protected Attributes inherited from WithLabel
unsigned int uLabel
 
std::string sName
 
- Protected Attributes inherited from ToBeOutput
flag fOutput
 
- Protected Attributes inherited from GravityOwner
GravitypGravity
 
- Protected Attributes inherited from DriveOwner
DriveCallerpDriveCaller
 

Detailed Description

Definition at line 139 of file genj.h.

Constructor & Destructor Documentation

DistanceJointWithOffset::DistanceJointWithOffset ( unsigned int  uL,
const DofOwner pDO,
const StructNode pN1,
const StructNode pN2,
const Vec3 f1Tmp,
const Vec3 f2Tmp,
const DriveCaller pDC,
flag  fOut 
)

Definition at line 608 of file genj.cc.

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

616 : Elem(uL, fOut),
617 Joint(uL, pDO, fOut),
618 DriveOwner(pDC),
619 pNode1(pN1), pNode2(pN2), f1(f1Tmp), f2(f2Tmp), v(Zero3), dAlpha(0.)
620 {
621  ASSERT(pDO != NULL);
622  ASSERT(pDC != NULL);
623  ASSERT(pNode1 != NULL);
625  ASSERT(pNode2 != NULL);
627 }
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 * pNode1
Definition: genj.h:142
const StructNode * pNode2
Definition: genj.h:143
#define ASSERT(expression)
Definition: colamd.c:977
doublereal dAlpha
Definition: genj.h:147
Elem(unsigned int uL, flag fOut)
Definition: elem.cc:41
DriveOwner(const DriveCaller *pDC=0)
Definition: drive.cc:627

Here is the call graph for this function:

DistanceJointWithOffset::~DistanceJointWithOffset ( void  )

Definition at line 631 of file genj.cc.

References NO_OP.

632 {
633  NO_OP;
634 }
#define NO_OP
Definition: myassert.h:74

Member Function Documentation

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

Implements Elem.

Definition at line 684 of file genj.cc.

References ASSERT, Vec3::Cross(), dAlpha, DEBUGCOUT, Vec3::dGet(), DriveCaller::dGet(), Vec3::Dot(), f1, f2, StructNode::GetRRef(), DofOwnerOwner::iGetFirstIndex(), StructDispNode::iGetFirstMomentumIndex(), StructDispNode::iGetFirstPositionIndex(), MatCrossCross, DriveOwner::pGetDriveCaller(), pNode1, pNode2, SparseSubMatrixHandler::PutCross(), SparseSubMatrixHandler::PutItem(), SparseSubMatrixHandler::PutMat3x3(), SparseSubMatrixHandler::ResizeReset(), VariableSubMatrixHandler::SetSparse(), grad::sqrt(), and v.

688 {
689  DEBUGCOUT("Entering DistanceJointWithOffset::AssJac()" << std::endl);
690 
691  SparseSubMatrixHandler& WM = WorkMat.SetSparse();
692 
693  /* Dimensiona e resetta la matrice di lavoro */
694  doublereal dDistance = pGetDriveCaller()->dGet();
695 
696  integer iNode1FirstPosIndex = pNode1->iGetFirstPositionIndex();
697  integer iNode1FirstMomIndex = pNode1->iGetFirstMomentumIndex();
698  integer iNode2FirstPosIndex = pNode2->iGetFirstPositionIndex();
699  integer iNode2FirstMomIndex = pNode2->iGetFirstMomentumIndex();
700  integer iFirstReactionIndex = iGetFirstIndex();
701 
702  Vec3 f1Tmp(pNode1->GetRRef()*f1);
703  Vec3 f2Tmp(pNode2->GetRRef()*f2);
704 
705  /* Distanza nulla */
706  WM.ResizeReset(72, 0);
707 
708  for (int iCnt = 1; iCnt <= 3; iCnt++) {
709 
710  /* termini di Delta_x1 */
711  WM.PutItem(iCnt, iFirstReactionIndex+iCnt,
712  iNode1FirstPosIndex+iCnt, -dCoef);
713 
714  /* termini di Delta_x2 */
715  WM.PutItem(3+iCnt, iFirstReactionIndex+iCnt,
716  iNode2FirstPosIndex+iCnt, dCoef);
717 
718  /* termini di Delta_F sul nodo 1 */
719  WM.PutItem(6+iCnt, iNode1FirstMomIndex+iCnt,
720  iFirstReactionIndex+iCnt, -dAlpha);
721 
722  /* termini di Delta_F sul nodo 2 */
723  WM.PutItem(9+iCnt, iNode2FirstMomIndex+iCnt,
724  iFirstReactionIndex+iCnt, dAlpha);
725 
726  /* termini diagonali di Delta_v */
727  WM.PutItem(12+iCnt, iFirstReactionIndex+iCnt,
728  iFirstReactionIndex+iCnt, -dDistance);
729 
730  doublereal d = v.dGet(iCnt);
731 
732  /* termini di Delta_alpha sul nodo 1 */
733  WM.PutItem(15+iCnt, iNode1FirstMomIndex+iCnt,
734  iFirstReactionIndex+4, -d);
735 
736  /* termini di Delta_alpha sul nodo 2 */
737  WM.PutItem(18+iCnt, iNode2FirstMomIndex+iCnt,
738  iFirstReactionIndex+4, d);
739  }
740 
741 
742  /* Termini di offset nell'equazione di vincolo */
743  WM.PutCross(22, iFirstReactionIndex,
744  iNode1FirstPosIndex+3, f1Tmp*dCoef);
745 
746  WM.PutCross(28, iFirstReactionIndex,
747  iNode2FirstPosIndex+3, f2Tmp*(-dCoef));
748 
749 
750  Vec3 Tmp(v*(dAlpha*dCoef));
751 
752  WM.PutMat3x3(34, iNode1FirstMomIndex+3,
753  iNode1FirstPosIndex+3, Mat3x3(MatCrossCross, Tmp, -f1Tmp));
754  WM.PutMat3x3(43, iNode2FirstMomIndex+3,
755  iNode2FirstPosIndex+3, Mat3x3(MatCrossCross, Tmp, f2Tmp));
756 
757 
758  WM.PutCross(52, iNode1FirstMomIndex+3,
759  iFirstReactionIndex, f1Tmp*(-dAlpha));
760  WM.PutCross(58, iNode2FirstMomIndex+3,
761  iFirstReactionIndex, f2Tmp*dAlpha);
762 
763  Tmp = v.Cross(f1Tmp);
764  for (int iCnt = 1; iCnt <= 3; iCnt++) {
765  WM.PutItem(63+iCnt, iNode1FirstMomIndex+3+iCnt,
766  iFirstReactionIndex+4, Tmp.dGet(iCnt));
767  }
768 
769  Tmp = f2Tmp.Cross(v);
770  for (int iCnt = 1; iCnt <= 3; iCnt++) {
771  WM.PutItem(66+iCnt, iNode2FirstMomIndex+3+iCnt,
772  iFirstReactionIndex+4, Tmp.dGet(iCnt));
773  }
774 
775 
776  doublereal d = v.Dot();
777  ASSERT(d > std::numeric_limits<doublereal>::epsilon());
778  if (d > std::numeric_limits<doublereal>::epsilon()) {
779  d = std::sqrt(d);
780  } else {
781  d = 1.;
782  }
783 
784  /* termini di Delta_v su alpha */
785  for (int iCnt = 1; iCnt <= 3; iCnt++) {
786  WM.PutItem(69+iCnt, iFirstReactionIndex+4,
787  iFirstReactionIndex+iCnt, v.dGet(iCnt)/d);
788  }
789 
790  return WorkMat;
791 }
void PutMat3x3(integer iSubIt, integer iFirstRow, integer iFirstCol, const Mat3x3 &m)
Definition: submat.cc:1331
Vec3 Cross(const Vec3 &v) const
Definition: matvec3.h:218
virtual const Mat3x3 & GetRRef(void) const
Definition: strnode.h:1006
Definition: matvec3.h:98
doublereal Dot(const Vec3 &v) const
Definition: matvec3.h:243
void ResizeReset(integer iNewRow, integer iNewCol)
Definition: submat.cc:1084
void PutCross(integer iSubIt, integer iFirstRow, integer iFirstCol, const Vec3 &v)
Definition: submat.cc:1236
const StructNode * pNode1
Definition: genj.h:142
void PutItem(integer iSubIt, integer iRow, integer iCol, const doublereal &dCoef)
Definition: submat.h:997
const StructNode * pNode2
Definition: genj.h:143
const doublereal & dGet(unsigned short int iRow) const
Definition: matvec3.h:285
#define DEBUGCOUT(msg)
Definition: myassert.h:232
virtual integer iGetFirstMomentumIndex(void) const =0
virtual integer iGetFirstPositionIndex(void) const
Definition: strnode.h:452
#define ASSERT(expression)
Definition: colamd.c:977
GradientExpression< UnaryExpr< FuncSqrt, Expr > > sqrt(const GradientExpression< Expr > &u)
Definition: gradient.h:2974
DriveCaller * pGetDriveCaller(void) const
Definition: drive.cc:658
virtual doublereal dGet(const doublereal &dVar) const =0
const MatCrossCross_Manip MatCrossCross
Definition: matvec3.cc:640
doublereal dAlpha
Definition: genj.h:147
SparseSubMatrixHandler & SetSparse(void)
Definition: submat.h:1178
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

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

Implements Elem.

Definition at line 796 of file genj.cc.

References VectorHandler::Add(), ASSERT, dAlpha, DEBUGCOUT, DriveCaller::dGet(), f1, f2, grad::fabs(), WithLabel::GetLabel(), StructNode::GetRCurr(), StructDispNode::GetXCurr(), DofOwnerOwner::iGetFirstIndex(), StructDispNode::iGetFirstMomentumIndex(), MBDYN_EXCEPT_ARGS, DriveOwner::pGetDriveCaller(), pNode1, pNode2, VectorHandler::PutCoef(), SubVectorHandler::PutRowIndex(), VectorHandler::ResizeReset(), grad::sqrt(), VectorHandler::Sub(), v, and WorkSpaceDim().

800 {
801  DEBUGCOUT("Entering DistanceJointWithOffset::AssRes()" << std::endl);
802 
803  /* Dimensiona e resetta la matrice di lavoro */
804  integer iNumRows = 0;
805  integer iNumCols = 0;
806  WorkSpaceDim(&iNumRows, &iNumCols);
807  WorkVec.ResizeReset(iNumRows);
808 
809  integer iNode1FirstMomIndex = pNode1->iGetFirstMomentumIndex();
810  integer iNode2FirstMomIndex = pNode2->iGetFirstMomentumIndex();
811  integer iFirstReactionIndex = iGetFirstIndex();
812 
813  for (int iCnt = 1; iCnt <= 6; iCnt++) {
814  /* Indici del nodo 1 */
815  WorkVec.PutRowIndex(iCnt, iNode1FirstMomIndex+iCnt);
816  WorkVec.PutRowIndex(6+iCnt, iNode2FirstMomIndex+iCnt);
817  }
818 
819  /* Indici del vincolo */
820  for(int iCnt = 1; iCnt <= 4; iCnt++) {
821  WorkVec.PutRowIndex(12+iCnt, iFirstReactionIndex+iCnt);
822  }
823 
824  Vec3 x1(pNode1->GetXCurr());
825  Vec3 x2(pNode2->GetXCurr());
826  Vec3 f1Tmp(pNode1->GetRCurr()*f1);
827  Vec3 f2Tmp(pNode2->GetRCurr()*f2);
828 
829  /* Aggiorna i dati propri */
830  v = Vec3(XCurr, iFirstReactionIndex+1);
831  dAlpha = XCurr(iFirstReactionIndex+4);
832 
833  doublereal dDistance = pGetDriveCaller()->dGet();
834 
835  /* Distanza nulla */
836  if (fabs(dDistance) <= std::numeric_limits<doublereal>::epsilon()) {
837  silent_cerr("DistanceJoint(" << GetLabel() << "): "
838  "near-zero distance" << std::endl);
840  }
841  Vec3 TmpVec(v*dAlpha);
842  WorkVec.Add(1, TmpVec);
843  WorkVec.Add(4, f1Tmp.Cross(TmpVec));
844  WorkVec.Sub(7, TmpVec);
845  WorkVec.Sub(10, f2Tmp.Cross(TmpVec));
846 
847  WorkVec.Add(13, x1+f1Tmp-x2-f2Tmp+v*dDistance);
848 
849  doublereal dTmp = v.Dot();
850  ASSERT(dTmp >= 0.0);
851  dTmp = std::sqrt(dTmp);
852 
853  WorkVec.PutCoef(16, 1.-dTmp);
854 
855  return WorkVec;
856 }
#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
virtual void Sub(integer iRow, const Vec3 &v)
Definition: vh.cc:78
GradientExpression< UnaryExpr< FuncFabs, Expr > > fabs(const GradientExpression< Expr > &u)
Definition: gradient.h:2973
const StructNode * pNode1
Definition: genj.h:142
virtual void PutRowIndex(integer iSubRow, integer iRow)=0
const StructNode * pNode2
Definition: genj.h:143
#define DEBUGCOUT(msg)
Definition: myassert.h:232
virtual integer iGetFirstMomentumIndex(void) const =0
#define ASSERT(expression)
Definition: colamd.c:977
GradientExpression< UnaryExpr< FuncSqrt, Expr > > sqrt(const GradientExpression< Expr > &u)
Definition: gradient.h:2974
virtual void PutCoef(integer iRow, const doublereal &dCoef)=0
DriveCaller * pGetDriveCaller(void) const
Definition: drive.cc:658
virtual const Vec3 & GetXCurr(void) const
Definition: strnode.h:310
virtual void Add(integer iRow, const Vec3 &v)
Definition: vh.cc:63
virtual doublereal dGet(const doublereal &dVar) const =0
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: genj.h:181
doublereal dAlpha
Definition: genj.h:147
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

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

Reimplemented from SimulationEntity.

Definition at line 656 of file genj.cc.

References ASSERT, DriveOwner::dGet(), and MBDYN_EXCEPT_ARGS.

657 {
658  ASSERT(i == 1);
659 
660  if (i == 1) {
661  return dGet();
662  }
663 
665 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
doublereal dGet(void) const
Definition: drive.cc:671
#define ASSERT(expression)
Definition: colamd.c:977

Here is the call graph for this function:

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

Reimplemented from Elem.

Definition at line 227 of file genj.h.

References pNode1, and pNode2.

227  {
228  connectedNodes.resize(2);
229  connectedNodes[0] = pNode1;
230  connectedNodes[1] = pNode2;
231  };
const StructNode * pNode1
Definition: genj.h:142
const StructNode * pNode2
Definition: genj.h:143
virtual DofOrder::Order DistanceJointWithOffset::GetDofType ( unsigned int  i) const
inlinevirtual

Reimplemented from Elem.

Definition at line 170 of file genj.h.

References DofOrder::ALGEBRAIC, and ASSERT.

171  {
172  ASSERT(i >= 0 && i < 4);
173  return DofOrder::ALGEBRAIC;
174  };
#define ASSERT(expression)
Definition: colamd.c:977
virtual DofOrder::Order DistanceJointWithOffset::GetEqType ( unsigned int  i) const
inlinevirtual

Reimplemented from SimulationEntity.

Definition at line 176 of file genj.h.

References DofOrder::DIFFERENTIAL.

177  {
178  return DofOrder::DIFFERENTIAL;
179  };
virtual Joint::Type DistanceJointWithOffset::GetJointType ( void  ) const
inlinevirtual

Implements Joint.

Definition at line 159 of file genj.h.

References Joint::DISTANCEWITHOFFSET.

159  {
161  };
virtual unsigned int DistanceJointWithOffset::iGetInitialNumDof ( void  ) const
inlinevirtual

Implements SubjectToInitialAssembly.

Definition at line 200 of file genj.h.

200 { return 8; };
virtual unsigned int DistanceJointWithOffset::iGetNumDof ( void  ) const
inlinevirtual

Reimplemented from Elem.

Definition at line 166 of file genj.h.

166  {
167  return 4;
168  };
unsigned int DistanceJointWithOffset::iGetNumPrivData ( void  ) const
virtual

Reimplemented from SimulationEntity.

Definition at line 638 of file genj.cc.

639 {
640  return 1;
641 }
unsigned int DistanceJointWithOffset::iGetPrivDataIdx ( const char *  s) const
virtual

Reimplemented from SimulationEntity.

Definition at line 644 of file genj.cc.

References ASSERT.

645 {
646  ASSERT(s != NULL);
647 
648  if (strcmp(s, "d") == 0) {
649  return 1;
650  }
651 
652  return 0;
653 }
#define ASSERT(expression)
Definition: colamd.c:977
VariableSubMatrixHandler & DistanceJointWithOffset::InitialAssJac ( VariableSubMatrixHandler WorkMat,
const VectorHandler XCurr 
)
virtual

Implements SubjectToInitialAssembly.

Definition at line 878 of file genj.cc.

References FullSubMatrixHandler::Add(), ASSERT, Vec3::Cross(), dAlpha, DEBUGCOUT, Vec3::dGet(), DriveCaller::dGet(), Vec3::Dot(), f1, f2, StructNode::GetRRef(), StructNode::GetWRef(), DofOwnerOwner::iGetFirstIndex(), StructDispNode::iGetFirstPositionIndex(), MatCross, MatCrossCross, DriveOwner::pGetDriveCaller(), pNode1, pNode2, grad::pow(), FullSubMatrixHandler::PutCoef(), FullSubMatrixHandler::PutColIndex(), FullSubMatrixHandler::PutRowIndex(), FullSubMatrixHandler::ResizeReset(), VariableSubMatrixHandler::SetFull(), grad::sqrt(), FullSubMatrixHandler::Sub(), and v.

880 {
881  DEBUGCOUT("Entering DistanceJointWithOffset::InitialAssJac()" << std::endl);
882 
883 
884  FullSubMatrixHandler& WM = WorkMat.SetFull();
885  WM.ResizeReset(32, 32);
886 
887  integer iNode1FirstPosIndex = pNode1->iGetFirstPositionIndex();
888  integer iNode2FirstPosIndex = pNode2->iGetFirstPositionIndex();
889  integer iFirstReactionIndex = iGetFirstIndex();
890  integer iReactionPrimeIndex = iFirstReactionIndex+4;
891 
892  for (int iCnt = 1; iCnt <= 12; iCnt++) {
893  WM.PutRowIndex(iCnt, iNode1FirstPosIndex+iCnt);
894  WM.PutColIndex(iCnt, iNode1FirstPosIndex+iCnt);
895  WM.PutRowIndex(12+iCnt, iNode2FirstPosIndex+iCnt);
896  WM.PutColIndex(12+iCnt, iNode2FirstPosIndex+iCnt);
897  }
898 
899  for (int iCnt = 1; iCnt <= 8; iCnt++) {
900  WM.PutRowIndex(24+iCnt, iFirstReactionIndex+iCnt);
901  WM.PutColIndex(24+iCnt, iFirstReactionIndex+iCnt);
902  }
903 
904  doublereal dAlphaP = XCurr(iReactionPrimeIndex+4);
905  Vec3 vP(XCurr, iReactionPrimeIndex+1);
906 
907  Vec3 f1Tmp(pNode1->GetRRef()*f1);
908  Vec3 f2Tmp(pNode2->GetRRef()*f2);
909  Vec3 Omega1(pNode1->GetWRef());
910  Vec3 Omega2(pNode2->GetWRef());
911 
912  doublereal dDistance = pGetDriveCaller()->dGet();
913 
914  /* Equazioni di equilibrio */
915  for (int iCnt = 1; iCnt <= 3; iCnt++) {
916  WM.PutCoef(iCnt, 24+iCnt, -dAlpha);
917  WM.PutCoef(12+iCnt, 24+iCnt, dAlpha);
918 
919  WM.PutCoef(6+iCnt, 28+iCnt, -dAlpha);
920  WM.PutCoef(18+iCnt, 28+iCnt, dAlpha);
921 
922  WM.PutCoef(6+iCnt, 24+iCnt, -dAlphaP);
923  WM.PutCoef(18+iCnt, 24+iCnt, dAlphaP);
924 
925  doublereal d = v.dGet(iCnt);
926  WM.PutCoef(iCnt, 28, -d);
927  WM.PutCoef(12+iCnt, 28, d);
928 
929  WM.PutCoef(6+iCnt, 32, -d);
930  WM.PutCoef(18+iCnt, 32, d);
931 
932  d = vP.dGet(iCnt);
933  WM.PutCoef(6+iCnt, 28, -d);
934  WM.PutCoef(18+iCnt, 28, d);
935 
936  }
937 
938  Vec3 Tmp(v.Cross(f1Tmp));
939  for (int iCnt = 1; iCnt <= 3; iCnt++) {
940  doublereal d = Tmp.dGet(iCnt);
941  WM.PutCoef(3+iCnt, 28, d);
942  WM.PutCoef(9+iCnt, 32, d);
943  }
944 
945  Tmp = f2Tmp.Cross(v);
946  for (int iCnt = 1; iCnt <= 3; iCnt++) {
947  doublereal d = Tmp.dGet(iCnt);
948  WM.PutCoef(15+iCnt, 28, d);
949  WM.PutCoef(21+iCnt, 32, d);
950  }
951 
952  Tmp = v.Cross(Omega1.Cross(f1Tmp))+vP.Cross(f1Tmp);
953  for (int iCnt = 1; iCnt <= 3; iCnt++) {
954  doublereal d = Tmp.dGet(iCnt);
955  WM.PutCoef(9+iCnt, 28, d);
956  }
957 
958  Tmp = v.Cross(f2Tmp.Cross(Omega2))-vP.Cross(f2Tmp);
959  for (int iCnt = 1; iCnt <= 3; iCnt++) {
960  doublereal d = Tmp.dGet(iCnt);
961  WM.PutCoef(21+iCnt, 28, d);
962  }
963 
964 
965  Tmp = f1Tmp*(-dAlpha);
966 
967  Mat3x3 MTmp(MatCrossCross, v, Tmp);
968  WM.Add(4, 4, MTmp);
969  WM.Add(10, 10, MTmp);
970 
971  MTmp = Mat3x3(MatCross, Tmp);
972  WM.Add(4, 25, MTmp);
973  WM.Add(10, 29, MTmp);
974 
975  Tmp = f2Tmp*dAlpha;
976  MTmp = Mat3x3(MatCrossCross, v, Tmp);
977  WM.Add(16, 16, MTmp);
978  WM.Add(22, 22, MTmp);
979 
980  MTmp = Mat3x3(MatCross, Tmp);
981  WM.Add(16, 25, MTmp);
982  WM.Add(22, 29, MTmp);
983 
984  MTmp = (Mat3x3(MatCrossCross, v*dAlpha, Omega1) + Mat3x3(MatCross, vP*dAlpha + v*dAlphaP))*Mat3x3(MatCross, f1Tmp);
985  WM.Sub(10, 4, MTmp);
986  MTmp = Mat3x3(MatCross, f1Tmp.Cross(Omega1*dAlpha) - f1Tmp*dAlphaP);
987  WM.Add(10, 25, MTmp);
988 
989  MTmp = (Mat3x3(MatCrossCross, v*dAlpha, Omega2) + Mat3x3(MatCross, vP*dAlpha + v*dAlphaP))*Mat3x3(MatCross, f2Tmp);
990  WM.Add(22, 16, MTmp);
991  MTmp = Mat3x3(MatCross, f2Tmp.Cross(Omega2*(-dAlpha)) + f2Tmp*dAlphaP);
992  WM.Add(22, 25, MTmp);
993 
994  /* Equazioni di vincolo */
995  for (int iCnt = 1; iCnt <= 3; iCnt++) {
996  WM.PutCoef(24+iCnt, iCnt, -1.);
997  WM.PutCoef(24+iCnt, 12+iCnt, 1.);
998 
999  WM.PutCoef(24+iCnt, 24+iCnt, -dDistance);
1000 
1001  WM.PutCoef(28+iCnt, 6+iCnt, -1.);
1002  WM.PutCoef(28+iCnt, 18+iCnt, 1.);
1003 
1004  WM.PutCoef(28+iCnt, 28+iCnt, -dDistance);
1005  }
1006 
1007  MTmp = Mat3x3(MatCross, f1Tmp);
1008  WM.Add(25, 4, MTmp);
1009  WM.Add(29, 10, MTmp);
1010 
1011  MTmp = Mat3x3(MatCross, f2Tmp);
1012  WM.Sub(25, 16, MTmp);
1013  WM.Sub(29, 22, MTmp);
1014 
1015  MTmp = Mat3x3(MatCrossCross, Omega1, f1Tmp);
1016  WM.Add(29, 4, MTmp);
1017 
1018  MTmp = Mat3x3(MatCrossCross, Omega2, f2Tmp);
1019  WM.Sub(29, 16, MTmp);
1020 
1021  doublereal d = v.Dot();
1022  ASSERT(d > std::numeric_limits<doublereal>::epsilon());
1023  if (d > std::numeric_limits<doublereal>::epsilon()) {
1024  d = std::sqrt(d);
1025 
1026  Tmp = v/d;
1027  for (int iCnt = 1; iCnt <= 3; iCnt++) {
1028  doublereal d = Tmp.dGet(iCnt);
1029  WM.PutCoef(28, 24+iCnt, d);
1030  WM.PutCoef(32, 28+iCnt, d);
1031  }
1032 
1033  Tmp = vP/d-v*((vP.Dot(v))/pow(d, 3));
1034  for (int iCnt = 1; iCnt <= 3; iCnt++) {
1035  doublereal d = Tmp.dGet(iCnt);
1036  WM.PutCoef(32, 24+iCnt, d);
1037  }
1038  }
1039 
1040  return WorkMat;
1041 }
void PutColIndex(integer iSubCol, integer iCol)
Definition: submat.h:325
Vec3 Cross(const Vec3 &v) const
Definition: matvec3.h:218
virtual const Mat3x3 & GetRRef(void) const
Definition: strnode.h:1006
GradientExpression< BinaryExpr< FuncPow, LhsExpr, RhsExpr > > pow(const GradientExpression< LhsExpr > &u, const GradientExpression< RhsExpr > &v)
Definition: gradient.h:2961
Definition: matvec3.h:98
const MatCross_Manip MatCross
Definition: matvec3.cc:639
FullSubMatrixHandler & SetFull(void)
Definition: submat.h:1168
doublereal Dot(const Vec3 &v) const
Definition: matvec3.h:243
void Add(integer iRow, integer iCol, const Vec3 &v)
Definition: submat.cc:209
void PutCoef(integer iRow, integer iCol, const doublereal &dCoef)
Definition: submat.h:672
virtual const Vec3 & GetWRef(void) const
Definition: strnode.h:1024
const StructNode * pNode1
Definition: genj.h:142
const StructNode * pNode2
Definition: genj.h:143
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
#define ASSERT(expression)
Definition: colamd.c:977
GradientExpression< UnaryExpr< FuncSqrt, Expr > > sqrt(const GradientExpression< Expr > &u)
Definition: gradient.h:2974
DriveCaller * pGetDriveCaller(void) const
Definition: drive.cc:658
virtual void ResizeReset(integer, integer)
Definition: submat.cc:182
virtual doublereal dGet(const doublereal &dVar) const =0
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
doublereal dAlpha
Definition: genj.h:147
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

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

Implements SubjectToInitialAssembly.

Definition at line 1046 of file genj.cc.

References ASSERT, Vec3::Cross(), grad::Cross(), dAlpha, DEBUGCOUT, DriveCaller::dGet(), Vec3::Dot(), f1, f2, grad::fabs(), WithLabel::GetLabel(), StructNode::GetRCurr(), StructDispNode::GetVCurr(), StructNode::GetWCurr(), StructDispNode::GetXCurr(), DofOwnerOwner::iGetFirstIndex(), StructDispNode::iGetFirstPositionIndex(), MBDYN_EXCEPT_ARGS, DriveOwner::pGetDriveCaller(), pNode1, pNode2, VectorHandler::Put(), VectorHandler::PutCoef(), SubVectorHandler::PutRowIndex(), VectorHandler::ResizeReset(), grad::sqrt(), and v.

1048 {
1049  DEBUGCOUT("Entering DistanceJointWithOffset::InitialAssRes()" << std::endl);
1050 
1051  /* Dimensiona e resetta la matrice di lavoro */
1052  WorkVec.ResizeReset(32);
1053 
1054  integer iNode1FirstPosIndex = pNode1->iGetFirstPositionIndex();
1055  integer iNode2FirstPosIndex = pNode2->iGetFirstPositionIndex();
1056  integer iFirstReactionIndex = iGetFirstIndex();
1057  integer iReactionPrimeIndex = iFirstReactionIndex+4;
1058 
1059  for (int iCnt = 1; iCnt <= 12; iCnt++) {
1060  WorkVec.PutRowIndex(iCnt, iNode1FirstPosIndex+iCnt);
1061  WorkVec.PutRowIndex(12+iCnt, iNode2FirstPosIndex+iCnt);
1062  }
1063 
1064  for (int iCnt = 1; iCnt <= 8; iCnt++) {
1065  WorkVec.PutRowIndex(24+iCnt, iFirstReactionIndex+iCnt);
1066  }
1067 
1068  v = Vec3(XCurr, iFirstReactionIndex+1);
1069  Vec3 vP(XCurr, iReactionPrimeIndex+1);
1070  dAlpha = XCurr(iFirstReactionIndex+4);
1071  doublereal dAlphaP = XCurr(iReactionPrimeIndex+4);
1072 
1073  Vec3 x1(pNode1->GetXCurr());
1074  Vec3 x2(pNode2->GetXCurr());
1075  Vec3 v1(pNode1->GetVCurr());
1076  Vec3 v2(pNode2->GetVCurr());
1077  Vec3 f1Tmp(pNode1->GetRCurr()*f1);
1078  Vec3 f2Tmp(pNode2->GetRCurr()*f2);
1079  Vec3 Omega1(pNode1->GetWCurr());
1080  Vec3 Omega2(pNode2->GetWCurr());
1081 
1082  doublereal dDistance = pGetDriveCaller()->dGet();
1083 
1084  if (fabs(dDistance) <= std::numeric_limits<doublereal>::epsilon()) {
1085  silent_cerr("DistanceJoint(" << GetLabel() << "): "
1086  "near-zero distance" << std::endl);
1088  }
1089  Vec3 Tmp(v*dAlpha);
1090  WorkVec.Put(1, Tmp);
1091  WorkVec.Put(4, f1Tmp.Cross(Tmp));
1092  WorkVec.Put(13, -Tmp);
1093  WorkVec.Put(16, Tmp.Cross(f2Tmp));
1094 
1095  Tmp = vP*dAlpha+v*dAlphaP;
1096  WorkVec.Put(7, Tmp);
1097  WorkVec.Put(10, (Omega1.Cross(f1Tmp)).Cross(v*dAlpha)+f1Tmp.Cross(Tmp));
1098  WorkVec.Put(19, -Tmp);
1099  WorkVec.Put(22, (f2Tmp.Cross(Omega2)).Cross(v*dAlpha)+Tmp.Cross(f2Tmp));
1100 
1101  WorkVec.Put(25, v*dDistance-x2-f2Tmp+x1+f1Tmp);
1102  WorkVec.Put(29, vP*dDistance
1103  -v2-Omega2.Cross(f2Tmp)+v1+Omega1.Cross(f1Tmp));
1104 
1105  doublereal d = v.Dot();
1106 
1107  ASSERT(d > std::numeric_limits<doublereal>::epsilon());
1108  d = std::sqrt(d);
1109  WorkVec.PutCoef(28, 1.-d);
1110  WorkVec.PutCoef(32, -v.Dot(vP)/d);
1111 
1112  return WorkVec;
1113 }
#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 Dot(const Vec3 &v) const
Definition: matvec3.h:243
GradientExpression< UnaryExpr< FuncFabs, Expr > > fabs(const GradientExpression< Expr > &u)
Definition: gradient.h:2973
const StructNode * pNode1
Definition: genj.h:142
virtual void PutRowIndex(integer iSubRow, integer iRow)=0
const StructNode * pNode2
Definition: genj.h:143
#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
#define ASSERT(expression)
Definition: colamd.c:977
GradientExpression< UnaryExpr< FuncSqrt, Expr > > sqrt(const GradientExpression< Expr > &u)
Definition: gradient.h:2974
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
DriveCaller * pGetDriveCaller(void) const
Definition: drive.cc:658
virtual const Vec3 & GetXCurr(void) const
Definition: strnode.h:310
virtual doublereal dGet(const doublereal &dVar) const =0
virtual void Put(integer iRow, const Vec3 &v)
Definition: vh.cc:93
virtual const Vec3 & GetVCurr(void) const
Definition: strnode.h:322
doublereal dAlpha
Definition: genj.h:147
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

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

Implements SubjectToInitialAssembly.

Definition at line 201 of file genj.h.

203  { *piNumRows = 32; *piNumCols = 32; };
void DistanceJointWithOffset::Output ( OutputHandler OH) const
virtual

Reimplemented from ToBeOutput.

Definition at line 859 of file genj.cc.

References ToBeOutput::bToBeOutput(), dAlpha, DriveOwner::dGet(), grad::fabs(), WithLabel::GetLabel(), OutputHandler::Joints(), Joint::Output(), v, and Zero3.

860 {
861  if (bToBeOutput()) {
862  doublereal d = dGet();
863  Vec3 vTmp;
864  if (fabs(d) > std::numeric_limits<doublereal>::epsilon()) {
865  vTmp = Vec3(dAlpha, 0., 0.);
866  } else {
867  vTmp = v;
868  }
869  Joint::Output(OH.Joints(), "DistanceWithOffs", GetLabel(),
870  vTmp, Zero3, v*dAlpha, Zero3)
871  << " " << v << " " << d << std::endl;
872  }
873 }
const Vec3 Zero3(0., 0., 0.)
virtual bool bToBeOutput(void) const
Definition: output.cc:890
Definition: matvec3.h:98
doublereal dGet(void) const
Definition: drive.cc:671
GradientExpression< UnaryExpr< FuncFabs, Expr > > fabs(const GradientExpression< Expr > &u)
Definition: gradient.h:2973
std::ostream & Joints(void) const
Definition: output.h:443
doublereal dAlpha
Definition: genj.h:147
double doublereal
Definition: colamd.c:52
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:

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

Implements Elem.

Definition at line 669 of file genj.cc.

References f1, f2, WithLabel::GetLabel(), DriveOwner::pGetDriveCaller(), pNode1, pNode2, Joint::Restart(), DriveCaller::Restart(), and Vec3::Write().

670 {
671  Joint::Restart(out) << ", distance with offset, "
672  << pNode1->GetLabel()
673  << ", reference, node, ",
674  f1.Write(out, ", ") << ", "
675  << pNode2->GetLabel()
676  << ", reference, node, ",
677  f2.Write(out, ", ") << ", ";
678  return pGetDriveCaller()->Restart(out) << ';' << std::endl;
679 }
std::ostream & Write(std::ostream &out, const char *sFill=" ") const
Definition: matvec3.cc:738
virtual std::ostream & Restart(std::ostream &out) const =0
const StructNode * pNode1
Definition: genj.h:142
const StructNode * pNode2
Definition: genj.h:143
virtual std::ostream & Restart(std::ostream &out) const
Definition: joint.h:195
DriveCaller * pGetDriveCaller(void) const
Definition: drive.cc:658
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

void DistanceJointWithOffset::SetInitialValue ( VectorHandler X)
virtual

Initialize state vector used in initial assembly. May set internal states of the element. Do not rely on being always called, because initial assembly could be implicitly or explicitly skipped

Reimplemented from Joint.

Definition at line 1116 of file genj.cc.

References DriveCaller::dGet(), Vec3::Dot(), f1, f2, grad::fabs(), WithLabel::GetLabel(), StructNode::GetRCurr(), StructDispNode::GetVCurr(), StructNode::GetWCurr(), StructDispNode::GetXCurr(), DofOwnerOwner::iGetFirstIndex(), MBDYN_EXCEPT_ARGS, DriveOwner::pGetDriveCaller(), pNode1, pNode2, VectorHandler::Put(), grad::sqrt(), and v.

1117 {
1118  integer iFirstIndex = iGetFirstIndex();
1119 
1120  doublereal dDistance = pGetDriveCaller()->dGet();
1121  if (fabs(dDistance) <= std::numeric_limits<doublereal>::epsilon()) {
1122  silent_cerr("DistanceJoint(" << GetLabel() << "): "
1123  "near-zero distance" << std::endl);
1125  }
1126 
1127  Vec3 x1(pNode1->GetXCurr());
1128  Vec3 x2(pNode2->GetXCurr());
1129  Vec3 v1(pNode1->GetVCurr());
1130  Vec3 v2(pNode2->GetVCurr());
1131  Vec3 f1Tmp((pNode1->GetRCurr())*f1);
1132  Vec3 f2Tmp((pNode2->GetRCurr())*f2);
1133  Vec3 Omega1(pNode1->GetWCurr());
1134  Vec3 Omega2(pNode2->GetWCurr());
1135 
1136  v = x2+f2Tmp-x1-f1Tmp;
1137  doublereal d = v.Dot();
1138  if (d < std::numeric_limits<doublereal>::epsilon()) {
1139  silent_cerr("DistanceJoint(" << GetLabel() << "): "
1140  "initial length is null" << std::endl);
1142  }
1143  v /= std::sqrt(d);
1144 
1145  X.Put(iFirstIndex+1, v);
1146  X.Put(iFirstIndex+5, (v2+Omega2.Cross(f2Tmp)-v1-Omega1.Cross(f1Tmp))/d);
1147 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Definition: matvec3.h:98
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
doublereal Dot(const Vec3 &v) const
Definition: matvec3.h:243
GradientExpression< UnaryExpr< FuncFabs, Expr > > fabs(const GradientExpression< Expr > &u)
Definition: gradient.h:2973
const StructNode * pNode1
Definition: genj.h:142
const StructNode * pNode2
Definition: genj.h:143
virtual const Vec3 & GetWCurr(void) const
Definition: strnode.h:1030
GradientExpression< UnaryExpr< FuncSqrt, Expr > > sqrt(const GradientExpression< Expr > &u)
Definition: gradient.h:2974
DriveCaller * pGetDriveCaller(void) const
Definition: drive.cc:658
virtual const Vec3 & GetXCurr(void) const
Definition: strnode.h:310
virtual doublereal dGet(const doublereal &dVar) const =0
virtual void Put(integer iRow, const Vec3 &v)
Definition: vh.cc:93
virtual const Vec3 & GetVCurr(void) const
Definition: strnode.h:322
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

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

Reimplemented from Joint.

Definition at line 1151 of file genj.cc.

References DriveCaller::dGet(), Vec3::Dot(), f1, f2, grad::fabs(), WithLabel::GetLabel(), StructNode::GetRCurr(), StructDispNode::GetXCurr(), DofOwnerOwner::iGetFirstIndex(), MBDYN_EXCEPT_ARGS, DriveHint::pCreateDrive(), DriveOwner::pGetDriveCaller(), pNode1, pNode2, VectorHandler::Put(), DriveOwner::Set(), grad::sqrt(), WithLabel::uLabel, and v.

1154 {
1155  if (ph) {
1156  for (unsigned i = 0; i < ph->size(); i++) {
1157  pedantic_cout("DistanceJointWithOffset(" << uLabel << "): "
1158  "creating drive from hint..." << std::endl);
1159 
1160  DriveHint *pdh = dynamic_cast<DriveHint *>((*ph)[i]);
1161 
1162  if (pdh) {
1163  DriveCaller *pDC = pdh->pCreateDrive(pDM);
1164  if (pDC == 0) {
1165  silent_cerr("DistanceJointWithOffset(" << uLabel << "): "
1166  "unable to create drive after hint "
1167  "#" << i << std::endl);
1169  }
1170 
1171  DriveOwner::Set(pDC);
1172  continue;
1173  }
1174  }
1175  }
1176 
1177  doublereal dDistance = pGetDriveCaller()->dGet();
1178 
1179  /* Setta a 1 dAlpha, che e' indipendente dalle altre variabili
1180  * in caso di distanza nulla */
1181  if (fabs(dDistance) <= std::numeric_limits<doublereal>::epsilon()) {
1182  silent_cerr("DistanceJoint(" << GetLabel() << "):"
1183  "near-zero distance" << std::endl);
1185  }
1186 
1188  doublereal d = v.Dot();
1189  if (d <= std::numeric_limits<doublereal>::epsilon()) {
1190  silent_cerr("DistanceJoint(" << GetLabel() << ") "
1191  "linked to nodes " << pNode1->GetLabel()
1192  << " and " << pNode2->GetLabel() << ": "
1193  "nodes are coincident;" << std::endl
1194  << "this is no longer supported" << std::endl);
1196  }
1197  v /= std::sqrt(d);
1198 
1199  /* Scrittura sul vettore soluzione */
1200  X.Put(iGetFirstIndex() + 1, v);
1201 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
doublereal Dot(const Vec3 &v) const
Definition: matvec3.h:243
GradientExpression< UnaryExpr< FuncFabs, Expr > > fabs(const GradientExpression< Expr > &u)
Definition: gradient.h:2973
const StructNode * pNode1
Definition: genj.h:142
const StructNode * pNode2
Definition: genj.h:143
unsigned int uLabel
Definition: withlab.h:44
DriveCaller * pCreateDrive(DataManager *pDM) const
Definition: hint_impl.cc:117
GradientExpression< UnaryExpr< FuncSqrt, Expr > > sqrt(const GradientExpression< Expr > &u)
Definition: gradient.h:2974
DriveCaller * pGetDriveCaller(void) const
Definition: drive.cc:658
virtual const Vec3 & GetXCurr(void) const
Definition: strnode.h:310
virtual doublereal dGet(const doublereal &dVar) const =0
virtual void Put(integer iRow, const Vec3 &v)
Definition: vh.cc:93
void Set(const DriveCaller *pDC)
Definition: drive.cc:647
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
double doublereal
Definition: colamd.c:52
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

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

Implements Elem.

Definition at line 181 of file genj.h.

Referenced by AssRes().

181  {
182  *piNumRows = 16;
183  *piNumCols = 16;
184  };

Member Data Documentation

doublereal DistanceJointWithOffset::dAlpha
private

Definition at line 147 of file genj.h.

Referenced by AssJac(), AssRes(), InitialAssJac(), InitialAssRes(), and Output().

Vec3 DistanceJointWithOffset::f1
private

Definition at line 144 of file genj.h.

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

Vec3 DistanceJointWithOffset::f2
private

Definition at line 145 of file genj.h.

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

const StructNode* DistanceJointWithOffset::pNode1
private
const StructNode* DistanceJointWithOffset::pNode2
private
Vec3 DistanceJointWithOffset::v
mutableprivate

Definition at line 146 of file genj.h.

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


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