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

#include <totalequation.h>

Inheritance diagram for TotalEquation:
Collaboration diagram for TotalEquation:

Public Member Functions

 TotalEquation (unsigned int uL, const DofOwner *pDO, bool bPos[3], bool bVel[3], TplDriveCaller< Vec3 > *const pDCPos[3], bool bRot[3], bool bAgv[3], TplDriveCaller< Vec3 > *const pDCRot[3], const StructNode *pN1, const Vec3 &f1Tmp, const Mat3x3 &R1hTmp, const Mat3x3 &R1hrTmp, const StructNode *pN2, const Vec3 &f2Tmp, const Mat3x3 &R2hTmp, const Mat3x3 &R2hrTmp, flag fOut)
 
 ~TotalEquation (void)
 
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)
 
virtual void AfterConvergence (const VectorHandler &X, const VectorHandler &XP, const VectorHandler &XPP)
 
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)
 
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 DofOrder::Order GetEqType (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 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)
 

Private Attributes

const StructNodepNode1
 
const StructNodepNode2
 
Vec3 f1
 
Mat3x3 R1h
 
Mat3x3 R1hr
 
Vec3 f2
 
Mat3x3 R2h
 
Mat3x3 R2hr
 
bool bPosActive [3]
 
bool bRotActive [3]
 
bool bVelActive [3]
 
bool bAgvActive [3]
 
TplDriveOwner< Vec3XDrv
 
TplDriveOwner< Vec3XPDrv
 
TplDriveOwner< Vec3XPPDrv
 
TplDriveOwner< Vec3ThetaDrv
 
TplDriveOwner< Vec3OmegaDrv
 
TplDriveOwner< Vec3OmegaPDrv
 
unsigned int nConstraints
 
unsigned int nPosConstraints
 
unsigned int nRotConstraints
 
unsigned int nVelConstraints
 
unsigned int nAgvConstraints
 
unsigned int iPosIncid [3]
 
unsigned int iRotIncid [3]
 
unsigned int iVelIncid [3]
 
unsigned int iAgvIncid [3]
 
unsigned int iPosEqIndex [3]
 
unsigned int iRotEqIndex [3]
 
unsigned int iVelEqIndex [3]
 
unsigned int iAgvEqIndex [3]
 
Vec3 tilde_f1
 
Vec3 M
 
Vec3 F
 
Vec3 ThetaDelta
 
Vec3 ThetaDeltaPrev
 

Friends

class TotalReaction
 

Additional Inherited Members

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

Detailed Description

Definition at line 46 of file totalequation.h.

Constructor & Destructor Documentation

TotalEquation::TotalEquation ( unsigned int  uL,
const DofOwner pDO,
bool  bPos[3],
bool  bVel[3],
TplDriveCaller< Vec3 > *const  pDCPos[3],
bool  bRot[3],
bool  bAgv[3],
TplDriveCaller< Vec3 > *const  pDCRot[3],
const StructNode pN1,
const Vec3 f1Tmp,
const Mat3x3 R1hTmp,
const Mat3x3 R1hrTmp,
const StructNode pN2,
const Vec3 f2Tmp,
const Mat3x3 R2hTmp,
const Mat3x3 R2hrTmp,
flag  fOut 
)

Definition at line 44 of file totalequation.cc.

References ASSERT, bAgvActive, bPosActive, bRotActive, bVelActive, iAgvEqIndex, iAgvIncid, iPosEqIndex, iPosIncid, iRotEqIndex, iRotIncid, iVelEqIndex, iVelIncid, nAgvConstraints, nConstraints, nPosConstraints, nRotConstraints, and nVelConstraints.

54 : Elem(uL, fOut),
55 Joint(uL, pDO, fOut),
56 pNode1(pN1), pNode2(pN2),
57 f1(f1Tmp), R1h(R1hTmp), R1hr(R1hrTmp),
58 f2(f2Tmp), R2h(R2hTmp), R2hr(R2hrTmp),
59 XDrv(pDCPos[0]), XPDrv(pDCPos[1]), XPPDrv(pDCPos[2]),
60 ThetaDrv(pDCRot[0]), OmegaDrv(pDCRot[1]), OmegaPDrv(pDCRot[2]),
65 {
66  /* Equations 1->3: Positions
67  * Equations 4->6: Rotations */
68 
69  unsigned int index = 0;
70 
71  for (unsigned int i = 0; i < 3; i++) {
72  ASSERT(bPos[i] == false || bVel[i] == false);
73 
74  bPosActive[i] = bPos[i];
75  bVelActive[i] = bVel[i];
76 
77  if (bPosActive[i]) {
78  iPosIncid[nPosConstraints] = i + 1;
81  index++;
82  }
83 
84  if (bVelActive[i]) {
85  iVelIncid[nVelConstraints] = i + 1;
88  index++;
89  }
90  }
91 
92  index = 0;
93  for (unsigned int i = 0; i < 3; i++) {
94  ASSERT(bRot[i] == false || bAgv[i] == false);
95 
96  bRotActive[i] = bRot[i];
97  bAgvActive[i] = bAgv[i];
98 
99  if (bRotActive[i]) {
100  iRotIncid[nRotConstraints] = i + 1;
102  nRotConstraints++;
103  index++;
104  }
105 
106  if (bAgvActive[i]) {
107  iAgvIncid[nAgvConstraints] = i + 1;
109  nAgvConstraints++;
110  index++;
111  }
112  }
114 
115 }
unsigned int nRotConstraints
Definition: totalequation.h:73
bool bAgvActive[3]
Definition: totalequation.h:61
const Vec3 Zero3(0., 0., 0.)
bool bRotActive[3]
Definition: totalequation.h:58
TplDriveOwner< Vec3 > XDrv
Definition: totalequation.h:63
unsigned int nConstraints
Definition: totalequation.h:71
bool bVelActive[3]
Definition: totalequation.h:60
const StructNode * pNode1
Definition: totalequation.h:49
Joint(unsigned int uL, const DofOwner *pD, flag fOut)
Definition: joint.cc:83
unsigned int iRotEqIndex[3]
Definition: totalequation.h:83
bool bPosActive[3]
Definition: totalequation.h:57
unsigned int iAgvIncid[3]
Definition: totalequation.h:80
unsigned int iAgvEqIndex[3]
Definition: totalequation.h:85
unsigned int nVelConstraints
Definition: totalequation.h:74
TplDriveOwner< Vec3 > OmegaDrv
Definition: totalequation.h:68
TplDriveOwner< Vec3 > OmegaPDrv
Definition: totalequation.h:69
Vec3 MulTV(const Vec3 &v) const
Definition: matvec3.cc:482
TplDriveOwner< Vec3 > XPDrv
Definition: totalequation.h:64
TplDriveOwner< Vec3 > ThetaDrv
Definition: totalequation.h:67
unsigned int iVelIncid[3]
Definition: totalequation.h:79
#define ASSERT(expression)
Definition: colamd.c:977
unsigned int nAgvConstraints
Definition: totalequation.h:75
TplDriveOwner< Vec3 > XPPDrv
Definition: totalequation.h:65
const StructNode * pNode2
Definition: totalequation.h:50
unsigned int iVelEqIndex[3]
Definition: totalequation.h:84
unsigned int iPosEqIndex[3]
Definition: totalequation.h:82
unsigned int iPosIncid[3]
Definition: totalequation.h:77
unsigned int nPosConstraints
Definition: totalequation.h:72
unsigned int iRotIncid[3]
Definition: totalequation.h:78
Elem(unsigned int uL, flag fOut)
Definition: elem.cc:41
TotalEquation::~TotalEquation ( void  )

Definition at line 117 of file totalequation.cc.

References NO_OP.

118 {
119  NO_OP;
120 };
#define NO_OP
Definition: myassert.h:74

Member Function Documentation

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

Reimplemented from SimulationEntity.

Definition at line 564 of file totalequation.cc.

References ThetaDelta, ThetaDeltaPrev, and Unwrap().

566 {
568 }
Vec3 Unwrap(const Vec3 &vPrev, const Vec3 &v)
Definition: matvec3.cc:1089

Here is the call graph for this function:

void TotalEquation::AfterConvergence ( const VectorHandler X,
const VectorHandler XP,
const VectorHandler XPP 
)
virtual

Reimplemented from SimulationEntity.

Definition at line 571 of file totalequation.cc.

References ThetaDelta, ThetaDeltaPrev, and Unwrap().

573 {
575 }
Vec3 Unwrap(const Vec3 &vPrev, const Vec3 &v)
Definition: matvec3.cc:1089

Here is the call graph for this function:

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

Implements Elem.

Definition at line 637 of file totalequation.cc.

References FullSubMatrixHandler::AddT(), Vec3::Cross(), grad::Cross(), DEBUGCOUT, f2, StructNode::GetRCurr(), StructNode::GetRRef(), StructDispNode::GetVCurr(), StructNode::GetWCurr(), StructDispNode::GetXCurr(), iAgvEqIndex, iAgvIncid, DofOwnerOwner::iGetFirstIndex(), StructDispNode::iGetFirstPositionIndex(), iPosEqIndex, iPosIncid, iRotEqIndex, iRotIncid, iVelEqIndex, iVelIncid, MatCross, MatCrossCross, nAgvConstraints, nConstraints, nPosConstraints, nRotConstraints, nVelConstraints, pNode1, pNode2, FullSubMatrixHandler::PutColIndex(), FullSubMatrixHandler::PutRowIndex(), R1h, R1hr, FullSubMatrixHandler::ResizeReset(), VariableSubMatrixHandler::SetFull(), FullSubMatrixHandler::SubT(), and WorkSpaceDim().

641 {
642  /*
643  See tecman.pdf for details
644  */
645 
646  DEBUGCOUT("Entering TotalEquation::AssJac()" << std::endl);
647 
648  FullSubMatrixHandler& WM = WorkMat.SetFull();
649 
650  /* Ridimensiona la sottomatrice in base alle esigenze */
651  integer iNumRows = 0;
652  integer iNumCols = 0;
653  WorkSpaceDim(&iNumRows, &iNumCols);
654  WM.ResizeReset(iNumRows, iNumCols);
655 
656  /* Recupera gli indici delle varie incognite */
657  integer iNode1FirstPosIndex = pNode1->iGetFirstPositionIndex();
658  integer iNode2FirstPosIndex = pNode2->iGetFirstPositionIndex();
659  integer iFirstReactionIndex = iGetFirstIndex();
660 
661  /* Setta gli indici delle equazioni */
662  for (int iCnt = 1; iCnt <= 6; iCnt++) {
663  WM.PutColIndex(iCnt, iNode1FirstPosIndex + iCnt);
664  WM.PutColIndex(6 + iCnt, iNode2FirstPosIndex + iCnt);
665  }
666 
667  for (unsigned int iCnt = 1; iCnt <= nConstraints; iCnt++) {
668  WM.PutRowIndex(iCnt, iFirstReactionIndex + iCnt);
669  }
670 
671  /* Recupera i dati che servono */
672  Mat3x3 R1(pNode1->GetRRef()*R1h);
673  Mat3x3 R1r(pNode1->GetRRef()*R1hr);
674  Vec3 b2(pNode2->GetRCurr()*f2);
675  Vec3 b1(pNode2->GetXCurr() + b2 - pNode1->GetXCurr());
676 
677 /* Phi/q is the only contribution... */
678 
679  Mat3x3 b1Cross_R1(b1.Cross(R1)); // = [ b1 x ] * R1
680  Mat3x3 b2Cross_R1(b2.Cross(R1)); // = [ b2 x ] * R1
681 
682  for (unsigned iCnt = 0 ; iCnt < nPosConstraints; iCnt++) {
683  Vec3 vR1(R1.GetVec(iPosIncid[iCnt]));
684  Vec3 vb1Cross_R1(b1Cross_R1.GetVec(iPosIncid[iCnt]));
685  Vec3 vb2Cross_R1(b2Cross_R1.GetVec(iPosIncid[iCnt]));
686 
687  /* Constraint, node 1 */
688  WM.SubT(1 + iPosEqIndex[iCnt], 1, vR1);
689  WM.SubT(1 + iPosEqIndex[iCnt], 3 + 1, vb1Cross_R1);
690 
691  /* Constraint, node 2 */
692  WM.AddT(1 + iPosEqIndex[iCnt], 6 + 1, vR1);
693  WM.AddT(1 + iPosEqIndex[iCnt], 9 + 1, vb2Cross_R1);
694  }
695 
696  for (unsigned iCnt = 0 ; iCnt < nRotConstraints; iCnt++) {
697  Vec3 vR1(R1r.GetVec(iRotIncid[iCnt]));
698 
699  /* Constraint, node 1 */
700  WM.SubT(1 + iRotEqIndex[iCnt], 3 + 1, vR1);
701 
702  /* Constraint, node 2 */
703  WM.AddT(1 + iRotEqIndex[iCnt], 9 + 1, vR1);
704  }
705 
706  if (nVelConstraints > 0) {
707  Mat3x3 Omega1Cross_R1(pNode1->GetWCurr().Cross(R1));
708  Mat3x3 Tmp12 = (
714  ) * R1;
715  Mat3x3 Tmp22(MatCrossCross, pNode2->GetWCurr(), b2);
716 
717  for (unsigned iCnt = 0 ; iCnt < nVelConstraints; iCnt++) {
718  Vec3 vR1(R1.GetVec(iVelIncid[iCnt]));
719  Vec3 vb1Cross_R1(b1Cross_R1.GetVec(iVelIncid[iCnt]));
720  Vec3 vb2Cross_R1(b2Cross_R1.GetVec(iVelIncid[iCnt]));
721 
722  Vec3 vOmega1Cross_R1(Omega1Cross_R1.GetVec(iVelIncid[iCnt]));
723  Vec3 vTmp12(Tmp12.GetVec(iVelIncid[iCnt]));
724  Vec3 vTmp22(Tmp22.GetVec(iVelIncid[iCnt]));
725 
726  /* Constraint, node 1 */
727  /* The same as in position constraint*/
728  WM.SubT(1 + iVelEqIndex[iCnt], 1, vR1); // delta_v1
729  WM.SubT(1 + iVelEqIndex[iCnt], 3 + 1, vb1Cross_R1); // delta_W1
730  /* New contributions, related to delta_x1 and delta_g1 */
731  WM.SubT(1 + iVelEqIndex[iCnt], 1, vOmega1Cross_R1 * dCoef); // delta_x1
732  WM.AddT(1 + iVelEqIndex[iCnt], 3 + 1, vTmp12 * dCoef); // delta_g1
733 
734  /* Constraint, node 2 */
735  /* The same as in position constraint*/
736  WM.AddT(1 + iVelEqIndex[iCnt], 6 + 1, vR1); // delta_v2
737  WM.AddT(1 + iVelEqIndex[iCnt], 9 + 1, vb2Cross_R1); // delta_W2
738  /* New contributions, related to delta_x1 and delta_g1 */
739  WM.AddT(1 + iVelEqIndex[iCnt], 6 + 1, vOmega1Cross_R1 * dCoef); // delta_x2
740  WM.AddT(1 + iVelEqIndex[iCnt], 9 + 1, vTmp22 * dCoef); // delta_g2
741  }
742  }
743 
744  if(nAgvConstraints > 0) {
745  Mat3x3 DeltaWCross_R1((pNode1->GetWCurr() - pNode2->GetWCurr()).Cross(R1r));
746  for (unsigned iCnt = 0 ; iCnt < nAgvConstraints; iCnt++) {
747  Vec3 vR1(R1r.GetVec(iAgvIncid[iCnt]));
748  Vec3 vDeltaWCross_R1(DeltaWCross_R1.GetVec(iAgvIncid[iCnt]));
749 
750  /* Constraint, node 1 */
751  WM.SubT(1 + iAgvEqIndex[iCnt], 3 + 1, vR1); // delta_W1
752  /* New contribution, related to delta_g1 */
753  WM.SubT(1 + iAgvEqIndex[iCnt], 3 + 1, vDeltaWCross_R1 * dCoef); // delta_g1
754 
755  /* Constraint, node 2 */
756  WM.AddT(1 + iAgvEqIndex[iCnt], 9 + 1, vR1);// delta_W2
757  }
758  }
759 
760  return WorkMat;
761 }
unsigned int nRotConstraints
Definition: totalequation.h:73
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
Definition: matvec3.h:98
const MatCross_Manip MatCross
Definition: matvec3.cc:639
unsigned int nConstraints
Definition: totalequation.h:71
FullSubMatrixHandler & SetFull(void)
Definition: submat.h:1168
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
const StructNode * pNode1
Definition: totalequation.h:49
unsigned int iRotEqIndex[3]
Definition: totalequation.h:83
unsigned int iAgvIncid[3]
Definition: totalequation.h:80
unsigned int iAgvEqIndex[3]
Definition: totalequation.h:85
unsigned int nVelConstraints
Definition: totalequation.h:74
void AddT(integer iRow, integer iCol, const Vec3 &v)
Definition: submat.cc:227
#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
void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
unsigned int iVelIncid[3]
Definition: totalequation.h:79
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 ResizeReset(integer, integer)
Definition: submat.cc:182
unsigned int nAgvConstraints
Definition: totalequation.h:75
const StructNode * pNode2
Definition: totalequation.h:50
unsigned int iVelEqIndex[3]
Definition: totalequation.h:84
const MatCrossCross_Manip MatCrossCross
Definition: matvec3.cc:640
void SubT(integer iRow, integer iCol, const Vec3 &v)
Definition: submat.cc:233
void PutRowIndex(integer iSubRow, integer iRow)
Definition: submat.h:311
unsigned int iPosEqIndex[3]
Definition: totalequation.h:82
unsigned int iPosIncid[3]
Definition: totalequation.h:77
virtual const Vec3 & GetVCurr(void) const
Definition: strnode.h:322
unsigned int nPosConstraints
Definition: totalequation.h:72
unsigned int iRotIncid[3]
Definition: totalequation.h:78
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 & TotalEquation::AssRes ( SubVectorHandler WorkVec,
doublereal  dCoef,
const VectorHandler XCurr,
const VectorHandler XPrimeCurr 
)
virtual

Implements Elem.

Definition at line 765 of file totalequation.cc.

References ASSERT, Vec3::Cross(), DEBUGCOUT, f2, TplDriveOwner< T >::Get(), StructNode::GetRCurr(), StructDispNode::GetVCurr(), StructNode::GetWCurr(), StructDispNode::GetXCurr(), iAgvEqIndex, iAgvIncid, DofOwnerOwner::iGetFirstIndex(), iPosEqIndex, iPosIncid, iRotEqIndex, iRotIncid, iVelEqIndex, iVelIncid, Mat3x3::MulTM(), Mat3x3::MulTV(), nAgvConstraints, nConstraints, nPosConstraints, nRotConstraints, nVelConstraints, pNode1, pNode2, VectorHandler::PutCoef(), SubVectorHandler::PutRowIndex(), R1h, R1hr, R2hr, VectorHandler::ResizeReset(), RotManip::Rot(), ThetaDelta, ThetaDrv, tilde_f1, RotManip::VecRot(), WorkSpaceDim(), and XDrv.

769 {
770  DEBUGCOUT("Entering TotalEquation::AssRes()" << std::endl);
771 
772  /* Dimensiona e resetta la matrice di lavoro */
773  integer iNumRows = 0;
774  integer iNumCols = 0;
775  WorkSpaceDim(&iNumRows, &iNumCols);
776  WorkVec.ResizeReset(iNumRows);
777 
778  /* Indici */
779  integer iFirstReactionIndex = iGetFirstIndex();
780 
781  /* Indici del vincolo */
782  for (unsigned int iCnt = 1; iCnt <= nConstraints; iCnt++) {
783  WorkVec.PutRowIndex(iCnt, iFirstReactionIndex + iCnt);
784  }
785 
786  Vec3 b2(pNode2->GetRCurr()*f2);
787  Vec3 b1(pNode2->GetXCurr() + b2 - pNode1->GetXCurr());
788 
789  Mat3x3 R1 = pNode1->GetRCurr()*R1h;
790  Mat3x3 R1r = pNode1->GetRCurr()*R1hr;
791  Mat3x3 R2r = pNode2->GetRCurr()*R2hr;
792 
793  Vec3 XDelta = R1.MulTV(b1) - tilde_f1 - XDrv.Get();
794  Vec3 VDelta = R1.MulTV(
795  pNode2->GetVCurr()
796  - b2.Cross(pNode2->GetWCurr())
797  - pNode1->GetVCurr()
798  + b1.Cross(pNode1->GetWCurr())
799  )
800  - XDrv.Get();
801 
802  Mat3x3 R0T = RotManip::Rot(-ThetaDrv.Get()); // -Theta0 to get R0 transposed
803  Mat3x3 RDelta = R1r.MulTM(R2r*R0T);
804  ThetaDelta = RotManip::VecRot(RDelta);
805 
806  Vec3 WDelta = R1r.MulTV(pNode2->GetWCurr() - pNode1->GetWCurr()) - ThetaDrv.Get();
807 
808  /* Constraint equations are divided by dCoef
809  * ONLY if the constraint is on position */
810  ASSERT(dCoef != 0.);
811 
812  /* Position constraint: */
813  for (unsigned iCnt = 0; iCnt < nPosConstraints; iCnt++) {
814  WorkVec.PutCoef(1 + iPosEqIndex[iCnt],
815  -(XDelta(iPosIncid[iCnt])/dCoef));
816  }
817 
818  /* Rotation constraints: */
819  for (unsigned iCnt = 0; iCnt < nRotConstraints; iCnt++) {
820  WorkVec.PutCoef(1 + iRotEqIndex[iCnt],
821  -(ThetaDelta(iRotIncid[iCnt])/dCoef));
822  }
823 
824  /* Linear Velocity Constraint */
825  for (unsigned iCnt = 0; iCnt < nVelConstraints; iCnt++) {
826  WorkVec.PutCoef(1 + iVelEqIndex[iCnt],
827  -(VDelta(iVelIncid[iCnt])));
828  }
829 
830  /* Angular Velocity Constraint */
831  for (unsigned iCnt = 0; iCnt < nAgvConstraints; iCnt++) {
832  WorkVec.PutCoef(1 + iAgvEqIndex[iCnt],
833  -(WDelta(iAgvIncid[iCnt])));
834  }
835 
836  return WorkVec;
837 }
unsigned int nRotConstraints
Definition: totalequation.h:73
Vec3 Cross(const Vec3 &v) const
Definition: matvec3.h:218
TplDriveOwner< Vec3 > XDrv
Definition: totalequation.h:63
Definition: matvec3.h:98
virtual void ResizeReset(integer)
Definition: vh.cc:55
unsigned int nConstraints
Definition: totalequation.h:71
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
const StructNode * pNode1
Definition: totalequation.h:49
unsigned int iRotEqIndex[3]
Definition: totalequation.h:83
unsigned int iAgvIncid[3]
Definition: totalequation.h:80
unsigned int iAgvEqIndex[3]
Definition: totalequation.h:85
unsigned int nVelConstraints
Definition: totalequation.h:74
Vec3 VecRot(const Mat3x3 &Phi)
Definition: Rot.cc:136
Vec3 MulTV(const Vec3 &v) const
Definition: matvec3.cc:482
virtual void PutRowIndex(integer iSubRow, integer iRow)=0
TplDriveOwner< Vec3 > ThetaDrv
Definition: totalequation.h:67
#define DEBUGCOUT(msg)
Definition: myassert.h:232
T Get(const doublereal &dVar) const
Definition: tpldrive.h:109
Mat3x3 Rot(const Vec3 &phi)
Definition: Rot.cc:62
virtual const Vec3 & GetWCurr(void) const
Definition: strnode.h:1030
void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
unsigned int iVelIncid[3]
Definition: totalequation.h:79
#define ASSERT(expression)
Definition: colamd.c:977
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
unsigned int nAgvConstraints
Definition: totalequation.h:75
const StructNode * pNode2
Definition: totalequation.h:50
unsigned int iVelEqIndex[3]
Definition: totalequation.h:84
unsigned int iPosEqIndex[3]
Definition: totalequation.h:82
unsigned int iPosIncid[3]
Definition: totalequation.h:77
virtual const Vec3 & GetVCurr(void) const
Definition: strnode.h:322
unsigned int nPosConstraints
Definition: totalequation.h:72
unsigned int iRotIncid[3]
Definition: totalequation.h:78
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

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

Reimplemented from Elem.

Definition at line 124 of file totalequation.cc.

References bAgvActive, bPosActive, bRotActive, bVelActive, idx2xyz, DofOwnerOwner::iGetFirstIndex(), nAgvConstraints, nConstraints, nPosConstraints, nRotConstraints, and nVelConstraints.

126 {
127  integer iIndex = iGetFirstIndex();
128 
129  if (nPosConstraints > 0 || nVelConstraints > 0) {
130  out << prefix << iIndex + 1;
131  if (nPosConstraints + nVelConstraints > 1) {
132  out << "->" << iIndex + nPosConstraints + nVelConstraints;
133  }
134  out << ": ";
135  out << "reaction force(s) [";
136 
137  for (unsigned int i = 0, cnt = 0; i < 3; i++) {
138  if (bPosActive[i] || bVelActive[i]) {
139  cnt++;
140  if (cnt > 1) {
141  out << ",";
142  }
143  out << "F" << idx2xyz[i];
144  }
145  }
146  out << "]" << std::endl;
147  }
148 
149  if (nRotConstraints > 0 || nAgvConstraints > 0) {
150  out << prefix << iIndex + nPosConstraints + nVelConstraints + 1;
151  if (nRotConstraints + nAgvConstraints > 1) {
152  out << "->" << iIndex + nConstraints ;
153  }
154  out << ": ";
155  out << "reaction couple(s) [";
156 
157  for (unsigned int i = 0, cnt = 0; i < 3; i++) {
158  if (bRotActive[i] || bAgvActive[i]) {
159  cnt++;
160  if (cnt > 1) {
161  out << ",";
162  }
163  out << "m" << idx2xyz[i];
164  }
165  }
166  out << "]" << std::endl;
167  }
168 
169  if (bInitial) {
170  iIndex += nConstraints;
171 
172  if (nPosConstraints > 0) {
173  out << prefix << iIndex + 1;
174  if (nPosConstraints > 1) {
175  out << "->" << iIndex + nPosConstraints;
176  }
177  out << ": ";
178  out << "reaction force(s) derivative(s) [";
179 
180  for (unsigned int i = 0, cnt = 0; i < 3; i++) {
181  if (bPosActive[i]) {
182  cnt++;
183  if (cnt > 1) {
184  out << ",";
185  }
186  out << "FP" << idx2xyz[i];
187  }
188  }
189  out << "]" << std::endl;
190  }
191 
192  if (nRotConstraints > 0) {
193  out << prefix << iIndex + nPosConstraints + 1;
194  if (nRotConstraints > 1) {
195  out << "->" << iIndex + nConstraints;
196  }
197  out << ": ";
198  out << "reaction couple(s) derivative(s) [";
199 
200  for (unsigned int i = 0, cnt = 0; i < 3; i++) {
201  if (bRotActive[i]) {
202  cnt++;
203  if (cnt > 1) {
204  out << ",";
205  }
206  out << "mP" << idx2xyz[i];
207  }
208  }
209  out << "]" << std::endl;
210  }
211  }
212 
213  return out;
214 }
unsigned int nRotConstraints
Definition: totalequation.h:73
bool bAgvActive[3]
Definition: totalequation.h:61
bool bRotActive[3]
Definition: totalequation.h:58
unsigned int nConstraints
Definition: totalequation.h:71
bool bVelActive[3]
Definition: totalequation.h:60
bool bPosActive[3]
Definition: totalequation.h:57
unsigned int nVelConstraints
Definition: totalequation.h:74
unsigned int nAgvConstraints
Definition: totalequation.h:75
static const char idx2xyz[]
unsigned int nPosConstraints
Definition: totalequation.h:72
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 TotalEquation::DescribeDof ( std::vector< std::string > &  desc,
bool  bInitial = false,
int  i = -1 
) const
virtual

Reimplemented from Elem.

Definition at line 217 of file totalequation.cc.

References WithLabel::GetLabel(), iGetInitialNumDof(), and iGetNumDof().

219 {
220  // FIXME: todo
221  int ndof = 1;
222  if (i == -1) {
223  if (bInitial) {
224  ndof = iGetNumDof();
225 
226  } else {
227  ndof = iGetInitialNumDof();
228  }
229  }
230  desc.resize(ndof);
231 
232  std::ostringstream os;
233  os << "TotalEquation(" << GetLabel() << ")";
234 
235  if (i == -1) {
236  std::string name(os.str());
237 
238  for (i = 0; i < ndof; i++) {
239  os.str(name);
240  os.seekp(0, std::ios_base::end);
241  os << ": dof(" << i + 1 << ")";
242  desc[i] = os.str();
243  }
244 
245  } else {
246  os << ": dof(" << i + 1 << ")";
247  desc[0] = os.str();
248  }
249 }
virtual unsigned int iGetNumDof(void) const
virtual unsigned int iGetInitialNumDof(void) const
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

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

Reimplemented from Elem.

Definition at line 253 of file totalequation.cc.

References bAgvActive, bPosActive, bRotActive, bVelActive, idx2xyz, DofOwnerOwner::iGetFirstIndex(), nAgvConstraints, nConstraints, nPosConstraints, nRotConstraints, and nVelConstraints.

255 {
256  integer iIndex = iGetFirstIndex();
257 
258  if (nPosConstraints > 0 || nVelConstraints > 0) {
259  out << prefix << iIndex + 1;
260  if (nPosConstraints + nVelConstraints > 1) {
261  out << "->" << iIndex + nPosConstraints + nVelConstraints;
262  }
263  out << ": ";
264  out << "position/velocity constraint(s) [";
265 
266  for (unsigned int i = 0, cnt = 0; i < 3; i++) {
267  if (bPosActive[i]) {
268  cnt++;
269  if (cnt > 1) {
270  out << ",";
271  }
272  out << "P" << idx2xyz[i] << "1=P" << idx2xyz[i] << "2";
273  } else if (bVelActive[i]) {
274  cnt++;
275  if (cnt > 1) {
276  out << ",";
277  }
278  out << "V" << idx2xyz[i] << "1=V" << idx2xyz[i] << "2";
279  }
280  }
281 
282  out << "]" << std::endl;
283  }
284 
285  if (nRotConstraints > 0 || nAgvConstraints > 0) {
286  out << prefix << iIndex + nPosConstraints + nVelConstraints + 1;
287  if (nRotConstraints + nAgvConstraints > 1) {
288  out << "->" << iIndex + nConstraints ;
289  }
290  out << ": ";
291  out << "orientation/angular velocity constraint(s) [";
292 
293  for (unsigned int i = 0, cnt = 0; i < 3; i++) {
294  if (bRotActive[i]) {
295  cnt++;
296  if (cnt > 1) {
297  out << ",";
298  }
299  out << "g" << idx2xyz[i] << "1=g" << idx2xyz[i] << "2";
300  } else if (bAgvActive[i]) {
301  cnt++;
302  if (cnt > 1) {
303  out << ",";
304  }
305  out << "W" << idx2xyz[i] << "1=W" << idx2xyz[i] << "2";
306  }
307  }
308 
309  out << "]" << std::endl;
310  }
311 
312  if (bInitial) {
313  iIndex += nConstraints;
314 
315  if (nPosConstraints > 0) {
316  out << prefix << iIndex + 1;
317  if (nPosConstraints > 1) {
318  out << "->" << iIndex + nPosConstraints;
319  }
320  out << ": ";
321  out << "velocity constraint(s) [";
322 
323  for (unsigned int i = 0, cnt = 0; i < 3; i++) {
324  if (bPosActive[i]) {
325  cnt++;
326  if (cnt > 1) {
327  out << ",";
328  }
329  out << "v" << idx2xyz[i] << "1=v" << idx2xyz[i] << "2";
330  }
331  }
332 
333  out << "]" << std::endl;
334  }
335 
336  if (nRotConstraints > 0) {
337  out << prefix << iIndex + nPosConstraints + 1;
338  if (nRotConstraints > 1) {
339  out << "->" << iIndex + nConstraints ;
340  }
341  out << ": ";
342  out << "angular velocity constraint(s) [";
343 
344  for (unsigned int i = 0, cnt = 0; i < 3; i++) {
345  if (bRotActive[i]) {
346  cnt++;
347  if (cnt > 1) {
348  out << ",";
349  }
350  out << "w" << idx2xyz[i] << "1=w" << idx2xyz[i] << "2";
351  }
352  }
353 
354  out << "]" << std::endl;
355  }
356  }
357 
358  return out;
359 }
unsigned int nRotConstraints
Definition: totalequation.h:73
bool bAgvActive[3]
Definition: totalequation.h:61
bool bRotActive[3]
Definition: totalequation.h:58
unsigned int nConstraints
Definition: totalequation.h:71
bool bVelActive[3]
Definition: totalequation.h:60
bool bPosActive[3]
Definition: totalequation.h:57
unsigned int nVelConstraints
Definition: totalequation.h:74
unsigned int nAgvConstraints
Definition: totalequation.h:75
static const char idx2xyz[]
unsigned int nPosConstraints
Definition: totalequation.h:72
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 TotalEquation::DescribeEq ( std::vector< std::string > &  desc,
bool  bInitial = false,
int  i = -1 
) const
virtual

Reimplemented from Elem.

Definition at line 362 of file totalequation.cc.

References WithLabel::GetLabel(), iGetInitialNumDof(), and iGetNumDof().

364 {
365  // FIXME: todo
366  int ndof = 1;
367  if (i == -1) {
368  if (bInitial) {
369  ndof = iGetNumDof();
370 
371  } else {
372  ndof = iGetInitialNumDof();
373  }
374  }
375  desc.resize(ndof);
376 
377  std::ostringstream os;
378  os << "TotalEquation(" << GetLabel() << ")";
379 
380  if (i == -1) {
381  std::string name(os.str());
382 
383  for (i = 0; i < ndof; i++) {
384  os.str(name);
385  os.seekp(0, std::ios_base::end);
386  os << ": equation(" << i + 1 << ")";
387  desc[i] = os.str();
388  }
389 
390  } else {
391  os << ": equation(" << i + 1 << ")";
392  desc[0] = os.str();
393  }
394 }
virtual unsigned int iGetNumDof(void) const
virtual unsigned int iGetInitialNumDof(void) const
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

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

Reimplemented from SimulationEntity.

Definition at line 1147 of file totalequation.cc.

References ASSERT, bPosActive, bRotActive, Vec3::Cross(), f1, f2, TplDriveOwner< T >::Get(), StructNode::GetRCurr(), StructDispNode::GetVCurr(), Mat3x3::GetVec(), StructNode::GetWCurr(), StructDispNode::GetXCurr(), Mat3x3::MulTV(), pNode1, pNode2, R1h, R1hr, ThetaDelta, ThetaDeltaPrev, ThetaDrv, Unwrap(), and XDrv.

1148 {
1149  switch (i) {
1150  case 1:
1151  case 2:
1152  case 3: {
1153  Vec3 x(pNode1->GetRCurr().MulTV(
1154  pNode2->GetXCurr() + pNode2->GetRCurr()*f2
1155  - pNode1->GetXCurr()) - f1);
1156  return R1h.GetVec(i)*x;
1157  }
1158 
1159  case 4:
1160  case 5:
1161  case 6: {
1163  return Theta(i - 3);
1164  }
1165 
1166  case 7:
1167  case 8:
1168  case 9:
1169  return 0.;
1170 
1171  case 10:
1172  case 11:
1173  case 12:
1174  return 0.;
1175 
1176  case 13:
1177  case 14:
1178  case 15:
1179  if (!bPosActive[i - 13]) {
1180  return 0.;
1181  }
1182  return XDrv.Get()(i - 12);
1183 
1184  case 16:
1185  case 17:
1186  case 18:
1187  if (!bRotActive[i - 16]) {
1188  return 0.;
1189  }
1190  return ThetaDrv.Get()(i - 15);
1191  case 19:
1192  case 20:
1193  case 21:
1194  // FIXME: blind fix
1195  {
1196  Vec3 v(pNode1->GetRCurr().MulTV(
1198  - pNode1->GetVCurr()) -
1200  pNode2->GetRCurr()*f2
1201  - pNode1->GetXCurr() - f1)
1202  )
1203  );
1204 
1205  return R1h.GetVec(i-18)*v;
1206  }
1207  case 22:
1208  case 23:
1209  case 24:
1210  {
1212  ;
1213 
1214  return R1hr.GetVec(i-21)*W;
1215  }
1216 
1217 
1218 
1219  default:
1220  ASSERT(0);
1221  }
1222 
1223  return 0.;
1224 }
Vec3 Cross(const Vec3 &v) const
Definition: matvec3.h:218
bool bRotActive[3]
Definition: totalequation.h:58
TplDriveOwner< Vec3 > XDrv
Definition: totalequation.h:63
Definition: matvec3.h:98
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
const StructNode * pNode1
Definition: totalequation.h:49
bool bPosActive[3]
Definition: totalequation.h:57
Vec3 GetVec(unsigned short int i) const
Definition: matvec3.h:893
Vec3 MulTV(const Vec3 &v) const
Definition: matvec3.cc:482
TplDriveOwner< Vec3 > ThetaDrv
Definition: totalequation.h:67
T Get(const doublereal &dVar) const
Definition: tpldrive.h:109
virtual const Vec3 & GetWCurr(void) const
Definition: strnode.h:1030
#define ASSERT(expression)
Definition: colamd.c:977
virtual const Vec3 & GetXCurr(void) const
Definition: strnode.h:310
Vec3 Unwrap(const Vec3 &vPrev, const Vec3 &v)
Definition: matvec3.cc:1089
const StructNode * pNode2
Definition: totalequation.h:50
virtual const Vec3 & GetVCurr(void) const
Definition: strnode.h:322

Here is the call graph for this function:

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

Reimplemented from Elem.

Definition at line 236 of file totalequation.h.

References pNode1, and pNode2.

236  {
237  connectedNodes.resize(2);
238  connectedNodes[0] = pNode1;
239  connectedNodes[1] = pNode2;
240  };
const StructNode * pNode1
Definition: totalequation.h:49
const StructNode * pNode2
Definition: totalequation.h:50
DofOrder::Order TotalEquation::GetDofType ( unsigned int  i) const
inlinevirtual

Reimplemented from Elem.

Definition at line 147 of file totalequation.h.

References DofOrder::ALGEBRAIC, ASSERT, and nConstraints.

147  {
148  ASSERT(i >= 0 && i < nConstraints);
149  return DofOrder::ALGEBRAIC;
150  };
unsigned int nConstraints
Definition: totalequation.h:71
#define ASSERT(expression)
Definition: colamd.c:977
virtual Joint::Type TotalEquation::GetJointType ( void  ) const
inlinevirtual

Implements Joint.

Definition at line 117 of file totalequation.h.

References Joint::TOTALEQUATION.

117  {
118  return Joint::TOTALEQUATION;
119  };
virtual unsigned int TotalEquation::iGetInitialNumDof ( void  ) const
inlinevirtual

Implements SubjectToInitialAssembly.

Definition at line 209 of file totalequation.h.

References nConstraints.

Referenced by DescribeDof(), and DescribeEq().

209  {
210  return 2*nConstraints;
211  };
unsigned int nConstraints
Definition: totalequation.h:71
virtual unsigned int TotalEquation::iGetNumDof ( void  ) const
inlinevirtual

Reimplemented from Elem.

Definition at line 122 of file totalequation.h.

References nConstraints.

Referenced by DescribeDof(), and DescribeEq().

122  {
123  return nConstraints;
124  };
unsigned int nConstraints
Definition: totalequation.h:71
unsigned int TotalEquation::iGetNumPrivData ( void  ) const
virtual

Reimplemented from SimulationEntity.

Definition at line 1075 of file totalequation.cc.

1076 {
1077  return 24;
1078 }
unsigned int TotalEquation::iGetPrivDataIdx ( const char *  s) const
virtual

Reimplemented from SimulationEntity.

Definition at line 1081 of file totalequation.cc.

References ASSERT.

1082 {
1083  ASSERT(s != NULL);
1084 
1085  unsigned int off = 0;
1086 
1087  switch (s[0]) {
1088  case 'p':
1089  /* relative position */
1090  break;
1091 
1092  case 'r':
1093  /* relative orientation */
1094  off += 3;
1095  break;
1096 
1097  case 'F':
1098  /* force */
1099  off += 6;
1100  break;
1101 
1102  case 'M':
1103  /* moment */
1104  off += 9;
1105  break;
1106 
1107  case 'd':
1108  /* imposed relative position */
1109  off += 12;
1110  break;
1111 
1112  case 't':
1113  /* imposed relative orientation */
1114  off += 15;
1115  break;
1116 
1117  case 'v':
1118  /* relative linear velocity */
1119  off += 18;
1120  break;
1121 
1122  case 'w':
1123  /* relative angular velocity */
1124  off += 21;
1125  break;
1126 
1127 
1128  default:
1129  return 0;
1130  }
1131 
1132  switch (s[1]) {
1133  case 'x':
1134  return off + 1;
1135 
1136  case 'y':
1137  return off + 2;
1138 
1139  case 'z':
1140  return off + 3;
1141  }
1142 
1143  return 0;
1144 }
#define ASSERT(expression)
Definition: colamd.c:977
VariableSubMatrixHandler & TotalEquation::InitialAssJac ( VariableSubMatrixHandler WorkMat,
const VectorHandler XCurr 
)
virtual

Implements SubjectToInitialAssembly.

Definition at line 873 of file totalequation.cc.

References FullSubMatrixHandler::AddT(), Vec3::Cross(), f2, StructNode::GetRCurr(), StructNode::GetRRef(), StructDispNode::GetVCurr(), StructNode::GetWCurr(), StructDispNode::GetXCurr(), DofOwnerOwner::iGetFirstIndex(), StructDispNode::iGetFirstPositionIndex(), InitialWorkSpaceDim(), iPosIncid, iRotIncid, nConstraints, nPosConstraints, nRotConstraints, pNode1, pNode2, FullSubMatrixHandler::PutColIndex(), FullSubMatrixHandler::PutRowIndex(), R1h, R1hr, FullSubMatrixHandler::ResizeReset(), VariableSubMatrixHandler::SetFull(), and FullSubMatrixHandler::SubT().

875 {
876 
877  /* Per ora usa la matrice piena; eventualmente si puo'
878  * passare a quella sparsa quando si ottimizza */
879  FullSubMatrixHandler& WM = WorkMat.SetFull();
880 
881  /* Dimensiona e resetta la matrice di lavoro */
882  integer iNumRows = 0;
883  integer iNumCols = 0;
884  InitialWorkSpaceDim(&iNumRows, &iNumCols);
885  WM.ResizeReset(iNumRows, iNumCols);
886 
887  /* Equazioni: vedi joints.dvi */
888 
889  /* equazioni ed incognite
890  * F1 Delta_x1 1
891  * M1 Delta_g1 3 + 1
892  * FP1 Delta_xP1 6 + 1
893  * MP1 Delta_w1 9 + 1
894  * F2 Delta_x2 12 + 1
895  * M2 Delta_g2 15 + 1
896  * FP2 Delta_xP2 18 + 1
897  * MP2 Delta_w2 21 + 1
898  * vincolo spostamento Delta_F 24 + 1
899  * vincolo rotazione Delta_M 24 + nPosConstraints
900  * derivata vincolo spostamento Delta_FP 24 + nConstraints
901  * derivata vincolo rotazione Delta_MP 24 + nConstraints + nPosConstraints
902  */
903 
904 
905  /* Indici */
906  integer iNode1FirstPosIndex = pNode1->iGetFirstPositionIndex();
907  integer iNode1FirstVelIndex = iNode1FirstPosIndex + 6;
908  integer iNode2FirstPosIndex = pNode2->iGetFirstPositionIndex();
909  integer iNode2FirstVelIndex = iNode2FirstPosIndex + 6;
910  integer iFirstReactionIndex = iGetFirstIndex();
911  integer iReactionPrimeIndex = iFirstReactionIndex + nConstraints;
912 
913 
914  /* Setta gli indici dei nodi */
915  for (int iCnt = 1; iCnt <= 6; iCnt++) {
916  WM.PutColIndex(iCnt, iNode1FirstPosIndex + iCnt);
917  WM.PutColIndex(6 + iCnt, iNode1FirstVelIndex + iCnt);
918  WM.PutColIndex(12 + iCnt, iNode2FirstPosIndex + iCnt);
919  WM.PutColIndex(18 + iCnt, iNode2FirstVelIndex + iCnt);
920  }
921 
922  /* Setta gli indici delle reazioni */
923  for (unsigned int iCnt = 1; iCnt <= nConstraints; iCnt++) {
924  WM.PutRowIndex(24 + iCnt, iFirstReactionIndex + iCnt);
925  WM.PutRowIndex(24 + nConstraints + iCnt, iReactionPrimeIndex + iCnt);
926  }
927 
928  /* Recupera i dati che servono */
929  Mat3x3 R1(pNode1->GetRRef()*R1h);
930  Mat3x3 R1r(pNode1->GetRRef()*R1hr);
931 
932  Vec3 b2(pNode2->GetRCurr()*f2);
933  Vec3 b1(pNode2->GetXCurr() + b2 - pNode1->GetXCurr());
934 
935  Vec3 Omega1(pNode1->GetWCurr());
936  Vec3 Omega2(pNode2->GetWCurr());
937 
938  Vec3 b1Prime(pNode2->GetVCurr() + Omega2.Cross(b2) - pNode1->GetVCurr());
939 
940  /* Constraints: Add only active rows/columns*/
941 
942  /* Positions contribution:*/
943 
944  Mat3x3 b1Cross_R1(b1.Cross(R1)); // = [ b1 x ] * R1
945  Mat3x3 b2Cross_R1(b2.Cross(R1)); // = [ b2 x ] * R1
946 
947  for (unsigned iCnt = 0 ; iCnt < nPosConstraints; iCnt++) {
948  Vec3 vR1(R1.GetVec(iPosIncid[iCnt]));
949  Vec3 vb1Cross_R1(b1Cross_R1.GetVec(iPosIncid[iCnt]));
950  Vec3 vb2Cross_R1(b2Cross_R1.GetVec(iPosIncid[iCnt]));
951 
952  /* Constraint, node 1 */
953  WM.SubT(24 + 1 + iCnt, 1, vR1); // * Delta_x1
954  WM.SubT(24 + 1 + iCnt, 3 + 1, vb1Cross_R1); // * Delta_g1
955 
956  /* d/dt(Constraint), node 1 */
957  WM.SubT(24 + 1 + nConstraints + iCnt, 6 + 1, vR1); // * Delta_xP1
958  WM.SubT(24 + 1 + nConstraints + iCnt, 9 + 1, vb1Cross_R1); // * Delta_W1
959 
960  /* Constraint, node 2 */
961  WM.AddT(24 + 1 + iCnt, 12 + 1, vR1); // * Delta_x2
962  WM.AddT(24 + 1 + iCnt, 15 + 1, vb2Cross_R1); // * Delta_g2
963 
964  /* d/dt(Constraint), node 2 */
965  WM.AddT(24 + 1 + nConstraints + iCnt, 18 + 1, vR1); // * Delta_xP2
966  WM.AddT(24 + 1 + nConstraints + iCnt, 21 + 1, vb2Cross_R1); // * Delta_W2
967  }
968 
969  for (unsigned iCnt = 0 ; iCnt < nRotConstraints; iCnt++) {
970  Vec3 vR1(R1r.GetVec(iRotIncid[iCnt]));
971 
972  /* Constraint, node 1 */
973  WM.SubT(24 + 1 + nPosConstraints + iCnt, 3 + 1, vR1); // * Delta_g1
974 
975  /* d/dt(Constraint), node 1 */
976  WM.SubT(24 + 1 + nConstraints + nPosConstraints + iCnt, 9 + 1, vR1); // * Delta_W1
977 
978  /* Constraint, node 2 */
979  WM.AddT(24 + 1 + nPosConstraints + iCnt, 15 + 1, vR1); // * Delta_g2
980 
981  /* d/dt(Constraint), node 2 */
982  WM.AddT(24 + 1 + nConstraints + nPosConstraints + iCnt, 21 + 1, vR1); // * Delta_W2
983  }
984 
985  return WorkMat;
986 }
unsigned int nRotConstraints
Definition: totalequation.h:73
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
Definition: matvec3.h:98
unsigned int nConstraints
Definition: totalequation.h:71
FullSubMatrixHandler & SetFull(void)
Definition: submat.h:1168
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
const StructNode * pNode1
Definition: totalequation.h:49
void AddT(integer iRow, integer iCol, const Vec3 &v)
Definition: submat.cc:227
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 ResizeReset(integer, integer)
Definition: submat.cc:182
const StructNode * pNode2
Definition: totalequation.h:50
void SubT(integer iRow, integer iCol, const Vec3 &v)
Definition: submat.cc:233
void PutRowIndex(integer iSubRow, integer iRow)
Definition: submat.h:311
unsigned int iPosIncid[3]
Definition: totalequation.h:77
virtual const Vec3 & GetVCurr(void) const
Definition: strnode.h:322
unsigned int nPosConstraints
Definition: totalequation.h:72
unsigned int iRotIncid[3]
Definition: totalequation.h:78
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
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 & TotalEquation::InitialAssRes ( SubVectorHandler WorkVec,
const VectorHandler XCurr 
)
virtual

Implements SubjectToInitialAssembly.

Definition at line 991 of file totalequation.cc.

References TplDriveOwner< T >::bIsDifferentiable(), Vec3::Cross(), DEBUGCOUT, f2, TplDriveOwner< T >::Get(), TplDriveOwner< T >::GetP(), StructNode::GetRCurr(), StructNode::GetRRef(), StructDispNode::GetVCurr(), StructNode::GetWCurr(), StructDispNode::GetXCurr(), DofOwnerOwner::iGetFirstIndex(), StructDispNode::iGetFirstPositionIndex(), InitialWorkSpaceDim(), iPosIncid, iRotIncid, Mat3x3::MulTM(), nConstraints, nPosConstraints, nRotConstraints, pNode1, pNode2, VectorHandler::PutCoef(), SubVectorHandler::PutRowIndex(), R1h, R1hr, R2hr, VectorHandler::ResizeReset(), RotManip::Rot(), ThetaDelta, ThetaDrv, tilde_f1, RotManip::VecRot(), and XDrv.

993 {
994 
995  DEBUGCOUT("Entering TotalEquation::InitialAssRes()" << std::endl);
996 
997  /* Dimensiona e resetta la matrice di lavoro */
998  integer iNumRows = 0;
999  integer iNumCols = 0;
1000  InitialWorkSpaceDim(&iNumRows, &iNumCols);
1001  WorkVec.ResizeReset(iNumRows);
1002 
1003  /* Indici */
1004  integer iNode1FirstPosIndex = pNode1->iGetFirstPositionIndex();
1005  integer iNode1FirstVelIndex = iNode1FirstPosIndex + 6;
1006  integer iNode2FirstPosIndex = pNode2->iGetFirstPositionIndex();
1007  integer iNode2FirstVelIndex = iNode2FirstPosIndex + 6;
1008  integer iFirstReactionIndex = iGetFirstIndex();
1009  integer iReactionPrimeIndex = iFirstReactionIndex + nConstraints;
1010 
1011  /* Setta gli indici */
1012  for (int iCnt = 1; iCnt <= 6; iCnt++) {
1013  WorkVec.PutRowIndex(iCnt, iNode1FirstPosIndex+iCnt);
1014  WorkVec.PutRowIndex(6 + iCnt, iNode1FirstVelIndex + iCnt);
1015  WorkVec.PutRowIndex(12 + iCnt, iNode2FirstPosIndex + iCnt);
1016  WorkVec.PutRowIndex(18 + iCnt, iNode2FirstVelIndex + iCnt);
1017  }
1018 
1019  for (unsigned int iCnt = 1; iCnt <= nConstraints; iCnt++) {
1020  WorkVec.PutRowIndex(24 + iCnt, iFirstReactionIndex + iCnt);
1021  WorkVec.PutRowIndex(24 + nConstraints + iCnt, iReactionPrimeIndex + iCnt);
1022  }
1023 
1024  /* Recupera i dati */
1025  /* Recupera i dati che servono */
1026  Mat3x3 R1(pNode1->GetRRef()*R1h);
1027  Mat3x3 R1r(pNode1->GetRRef()*R1hr);
1028  Mat3x3 R2r(pNode2->GetRCurr()*R2hr);
1029 
1030  Vec3 b2(pNode2->GetRCurr()*f2);
1031  Vec3 b1(pNode2->GetXCurr() + b2 - pNode1->GetXCurr());
1032 
1033  Vec3 Omega1(pNode1->GetWCurr());
1034  Vec3 Omega2(pNode2->GetWCurr());
1035 
1036  Vec3 b1Prime(pNode2->GetVCurr() + Omega2.Cross(b2) - pNode1->GetVCurr());
1037 
1038 
1039  /* Constraint Equations */
1040 
1041  Vec3 XDelta = R1.MulTV(b1) - tilde_f1 - XDrv.Get();
1042  Vec3 XDeltaPrime = R1.MulTV(b1Prime + b1.Cross(Omega1));
1043 
1044  if(XDrv.bIsDifferentiable()) {
1045  XDeltaPrime -= XDrv.GetP();
1046  }
1047 
1048  Mat3x3 R0T = RotManip::Rot(-ThetaDrv.Get()); // -Theta0 to get R0 transposed
1049  Mat3x3 RDelta = R1r.MulTM(R2r*R0T);
1050  ThetaDelta = RotManip::VecRot(RDelta);
1051  Vec3 ThetaDeltaPrime = R1r.MulTV(Omega2 - Omega1);
1052 
1053  if(ThetaDrv.bIsDifferentiable()) {
1054  ThetaDeltaPrime -= RDelta*ThetaDrv.GetP();
1055  }
1056 
1057 
1058  /* Position constraint: */
1059  for (unsigned iCnt = 0; iCnt < nPosConstraints; iCnt++) {
1060  WorkVec.PutCoef(24 + 1 + iCnt, -XDelta(iPosIncid[iCnt]));
1061  WorkVec.PutCoef(24 + 1 + nConstraints + iCnt, -XDeltaPrime(iPosIncid[iCnt]));
1062  }
1063 
1064  /* Rotation constraints: */
1065  for (unsigned iCnt = 0; iCnt < nRotConstraints; iCnt++) {
1066  WorkVec.PutCoef(24 + 1 + nPosConstraints + iCnt, -ThetaDelta(iRotIncid[iCnt]));
1067  WorkVec.PutCoef(24 + 1 + nPosConstraints + nConstraints + iCnt, -ThetaDeltaPrime(iRotIncid[iCnt]));
1068  }
1069 
1070 return WorkVec;
1071 }
unsigned int nRotConstraints
Definition: totalequation.h:73
Vec3 Cross(const Vec3 &v) const
Definition: matvec3.h:218
virtual const Mat3x3 & GetRRef(void) const
Definition: strnode.h:1006
virtual bool bIsDifferentiable(void) const
Definition: tpldrive.h:118
TplDriveOwner< Vec3 > XDrv
Definition: totalequation.h:63
Definition: matvec3.h:98
virtual void ResizeReset(integer)
Definition: vh.cc:55
unsigned int nConstraints
Definition: totalequation.h:71
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
const StructNode * pNode1
Definition: totalequation.h:49
Vec3 VecRot(const Mat3x3 &Phi)
Definition: Rot.cc:136
virtual T GetP(void) const
Definition: tpldrive.h:121
virtual void PutRowIndex(integer iSubRow, integer iRow)=0
TplDriveOwner< Vec3 > ThetaDrv
Definition: totalequation.h:67
#define DEBUGCOUT(msg)
Definition: myassert.h:232
T Get(const doublereal &dVar) const
Definition: tpldrive.h:109
Mat3x3 Rot(const Vec3 &phi)
Definition: Rot.cc:62
virtual integer iGetFirstPositionIndex(void) const
Definition: strnode.h:452
virtual const Vec3 & GetWCurr(void) const
Definition: strnode.h:1030
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
const StructNode * pNode2
Definition: totalequation.h:50
unsigned int iPosIncid[3]
Definition: totalequation.h:77
virtual const Vec3 & GetVCurr(void) const
Definition: strnode.h:322
unsigned int nPosConstraints
Definition: totalequation.h:72
unsigned int iRotIncid[3]
Definition: totalequation.h:78
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

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

Implements SubjectToInitialAssembly.

Definition at line 213 of file totalequation.h.

References nConstraints.

Referenced by InitialAssJac(), and InitialAssRes().

213  {
214  *piNumCols = *piNumRows = 24 + 2*nConstraints;
215  };
unsigned int nConstraints
Definition: totalequation.h:71
void TotalEquation::Output ( OutputHandler OH) const
virtual

Reimplemented from ToBeOutput.

Definition at line 840 of file totalequation.cc.

References ToBeOutput::bToBeOutput(), f2, WithLabel::GetLabel(), StructNode::GetRCurr(), StructDispNode::GetVCurr(), StructNode::GetWCurr(), StructDispNode::GetXCurr(), OutputHandler::Joints(), Mat3x3::MulTM(), Mat3x3::MulTV(), Joint::Output(), pNode1, pNode2, R1h, R1hr, R2hr, tilde_f1, V1, V2, RotManip::VecRot(), and Zero3.

841 {
842  if (bToBeOutput()) {
843  const Vec3& X1(pNode1->GetXCurr());
844  const Vec3& X2(pNode2->GetXCurr());
845  const Mat3x3& R1(pNode1->GetRCurr());
846  const Mat3x3& R2(pNode2->GetRCurr());
847  const Vec3& V1(pNode1->GetVCurr());
848  const Vec3& V2(pNode2->GetVCurr());
849  const Vec3& Omega1(pNode1->GetWCurr());
850  const Vec3& Omega2(pNode2->GetWCurr());
851 
852  Mat3x3 R1Tmp(R1*R1h);
853  Mat3x3 R1rTmp(R1*R1hr);
854  Mat3x3 R2rTmp(R2*R2hr);
855  Mat3x3 RTmp(R1rTmp.MulTM(R2rTmp));
856  Vec3 b2(R2*f2);
857  Vec3 b1(X2 + b2 - X1);
858  Vec3 X(R1Tmp.MulTV(b1) - tilde_f1);
859 
860  Joint::Output(OH.Joints(), "TotalEquation", GetLabel(),
861  Zero3, Zero3, Zero3, Zero3)
862  << " " << X
863  << " " << RotManip::VecRot(RTmp)
864  << " " << R1Tmp.MulTV(V2 + Omega2.Cross(b2) - V1 - Omega1.Cross(b1))
865  << " " << R1rTmp.MulTV(Omega2 - Omega1)
866  << std::endl;
867  // accelerations?
868  }
869 }
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 * pNode1
Definition: totalequation.h:49
Definition: matvec3.h:50
Vec3 VecRot(const Mat3x3 &Phi)
Definition: Rot.cc:136
virtual const Vec3 & GetWCurr(void) const
Definition: strnode.h:1030
std::ostream & Joints(void) const
Definition: output.h:443
virtual const Vec3 & GetXCurr(void) const
Definition: strnode.h:310
const StructNode * pNode2
Definition: totalequation.h:50
Definition: matvec3.h:49
virtual const Vec3 & GetVCurr(void) const
Definition: strnode.h:322
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 * TotalEquation::ParseHint ( DataManager pDM,
const char *  s 
) const
virtual

Reimplemented from SimulationEntity.

Definition at line 487 of file totalequation.cc.

References STRLENOF.

488 {
489  if (strncasecmp(s, "offset{" /*}*/ , STRLENOF("offset{" /*}*/ )) == 0)
490  {
491  s += STRLENOF("offset{" /*}*/ );
492 
493  if (strcmp(&s[1], /*{*/ "}") != 0) {
494  return 0;
495  }
496 
497  switch (s[0]) {
498  case '1':
499  return new Joint::OffsetHint<1>;
500 
501  case '2':
502  return new Joint::OffsetHint<2>;
503  }
504 
505  } else if (strncasecmp(s, "position-hinge{" /*}*/, STRLENOF("position-hinge{" /*}*/)) == 0) {
506  s += STRLENOF("position-hinge{" /*}*/);
507 
508  if (strcmp(&s[1], /*{*/ "}") != 0) {
509  return 0;
510  }
511 
512  switch (s[0]) {
513  case '1':
514  return new Joint::HingeHint<1>;
515 
516  case '2':
517  return new Joint::HingeHint<2>;
518  }
519 
520  } else if (strncasecmp(s, "position-drive3{" /*}*/, STRLENOF("position-drive3{" /*}*/)) == 0) {
521  s += STRLENOF("position-");
522 
523  Hint *pH = ::ParseHint(pDM, s);
524  if (pH) {
525  TplDriveHint<Vec3> *pTDH = dynamic_cast<TplDriveHint<Vec3> *>(pH);
526  if (pTDH) {
527  return new PositionDriveHint<Vec3>(pTDH);
528  }
529  }
530  return 0;
531 
532  } else if (strncasecmp(s, "orientation-hinge{" /*}*/, STRLENOF("orientation-hinge{" /*}*/)) == 0) {
533  s += STRLENOF("orientation-hinge{" /*}*/);
534 
535  if (strcmp(&s[1], /*{*/ "}") != 0) {
536  return 0;
537  }
538 
539  switch (s[0]) {
540  case '1':
541  return new Joint::HingeHint<1>;
542 
543  case '2':
544  return new Joint::HingeHint<2>;
545  }
546 
547  } else if (strncasecmp(s, "orientation-drive3{" /*}*/, STRLENOF("orientation-drive3{" /*}*/)) == 0) {
548  s += STRLENOF("orientation-");
549 
550  Hint *pH = ::ParseHint(pDM, s);
551  if (pH) {
552  TplDriveHint<Vec3> *pTDH = dynamic_cast<TplDriveHint<Vec3> *>(pH);
553  if (pTDH) {
554  return new OrientationDriveHint<Vec3>(pTDH);
555  }
556  }
557  return 0;
558  }
559 
560  return 0;
561 }
Definition: hint.h:38
virtual Hint * ParseHint(DataManager *pDM, const char *s) const
#define STRLENOF(s)
Definition: mbdyn.h:166
std::ostream & TotalEquation::Restart ( std::ostream &  out) const
virtual

Implements Elem.

Definition at line 580 of file totalequation.cc.

References bPosActive, bRotActive, f1, f2, WithLabel::GetLabel(), Mat3x3::GetVec(), pNode1, pNode2, R1h, R1hr, R2h, R2hr, Joint::Restart(), and Vec3::Write().

581 {
582  Joint::Restart(out) << ", total equation, "
583  << pNode1->GetLabel() << ", "
584  << "position, ";
585  f1.Write(out, ", ") << ", "
586  << "position orientation, "
587  "1 , ";
588  R1h.GetVec(1).Write(out, ", ") << ", "
589  "2 , ";
590  R1h.GetVec(2).Write(out, ", ") << ", "
591  << "rotation orientation, "
592  "1 , ";
593  R1hr.GetVec(1).Write(out, ", ") << ", "
594  "2 , ";
595  R1hr.GetVec(2).Write(out, ", ") << ", "
596  << pNode2->GetLabel() << ", "
597  << "position, ";
598  f2.Write(out, ", ") << ", "
599  << "position orientation, "
600  "1 , ";
601  R2h.GetVec(1).Write(out, ", ") << ", "
602  "2 , ";
603  R2h.GetVec(2).Write(out, ", ") << ", "
604  << "rotation orientation, "
605  "1 , ";
606  R2hr.GetVec(1).Write(out, ", ") << ", "
607  "2 , ";
608  R2hr.GetVec(2).Write(out, ", ");
609 
610  if (bPosActive[0] || bPosActive[1] || bPosActive[2]) {
611  out << ", position constraint";
612  for (unsigned i = 0; i < 3; i++) {
613  if (bPosActive[i]) {
614  out << ", active";
615  } else {
616  out << ", inactive";
617  }
618  }
619  }
620 
621  if (bRotActive[0] || bRotActive[1] || bRotActive[2]) {
622  out << ", orientation constraint";
623  for (unsigned i = 0; i < 3; i++) {
624  if (bRotActive[i]) {
625  out << ", active";
626  } else {
627  out << ", inactive";
628  }
629  }
630  }
631 
632  return out << std::endl;
633 }
std::ostream & Write(std::ostream &out, const char *sFill=" ") const
Definition: matvec3.cc:738
bool bRotActive[3]
Definition: totalequation.h:58
const StructNode * pNode1
Definition: totalequation.h:49
bool bPosActive[3]
Definition: totalequation.h:57
Vec3 GetVec(unsigned short int i) const
Definition: matvec3.h:893
virtual std::ostream & Restart(std::ostream &out) const
Definition: joint.h:195
const StructNode * pNode2
Definition: totalequation.h:50
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

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

Reimplemented from Joint.

Definition at line 397 of file totalequation.cc.

References f1, f2, TplDriveOwner< T >::Get(), StructNode::GetRCurr(), StructDispNode::GetXCurr(), MBDYN_EXCEPT_ARGS, Mat3x3::MulTM(), Mat3x3::MulTV(), OmegaDrv, OmegaPDrv, pNode1, pNode2, Joint::JointDriveHint< T >::pTDH, R1h, R1hr, R2h, R2hr, TplDriveOwner< T >::Set(), ThetaDrv, tilde_f1, WithLabel::uLabel, XDrv, XPDrv, and XPPDrv.

400 {
401  if (ph) {
402  for (unsigned int i = 0; i < ph->size(); i++) {
403  Joint::JointHint *pjh = dynamic_cast<Joint::JointHint *>((*ph)[i]);
404 
405  if (pjh) {
406 
407  if (dynamic_cast<Joint::OffsetHint<1> *>(pjh)) {
408  const Mat3x3& R1(pNode1->GetRCurr());
409  Vec3 fTmp2(pNode2->GetRCurr()*f2);
410 
411  f1 = R1.MulTV(pNode2->GetXCurr() + fTmp2 - pNode1->GetXCurr());
412  tilde_f1 = R1h.MulTV(f1) - XDrv.Get();
413 
414  } else if (dynamic_cast<Joint::OffsetHint<2> *>(pjh)) {
415  const Mat3x3& R2(pNode2->GetRCurr());
416  Mat3x3 R1(pNode1->GetRCurr()*R1h);
417  Vec3 fTmp1(pNode1->GetRCurr()*f1);
418 
419  f2 = R2.MulTV(pNode1->GetXCurr() + fTmp1 - pNode2->GetXCurr() + R1*XDrv.Get());
420 
421  } else if (dynamic_cast<Joint::HingeHint<1> *>(pjh)) {
422  if (dynamic_cast<Joint::PositionHingeHint<1> *>(pjh)) {
423  const Mat3x3& R1(pNode1->GetRCurr());
424  R1h = R1.MulTM(pNode2->GetRCurr()*R2h);
425 
426  } else if (dynamic_cast<Joint::OrientationHingeHint<1> *>(pjh)) {
427  const Mat3x3& R1(pNode1->GetRCurr());
428  R1hr = R1.MulTM(pNode2->GetRCurr()*R2hr);
429  }
430 
431  } else if (dynamic_cast<Joint::HingeHint<2> *>(pjh)) {
432  if (dynamic_cast<Joint::PositionHingeHint<2> *>(pjh)) {
433  const Mat3x3& R2(pNode2->GetRCurr());
434  R2h = R2.MulTM(pNode1->GetRCurr()*R1h);
435 
436  } else if (dynamic_cast<Joint::OrientationHingeHint<2> *>(pjh)) {
437  const Mat3x3& R2(pNode2->GetRCurr());
438  R2hr = R2.MulTM(pNode1->GetRCurr()*R1hr);
439  }
440 
441  } else if (dynamic_cast<Joint::JointDriveHint<Vec3> *>(pjh)) {
443  = dynamic_cast<Joint::JointDriveHint<Vec3> *>(pjh);
444  pedantic_cout("TotalEquation(" << uLabel << "): "
445  "creating drive from hint[" << i << "]..." << std::endl);
446 
447  TplDriveCaller<Vec3> *pDC = pjdh->pTDH->pCreateDrive(pDM);
448  if (pDC == 0) {
449  silent_cerr("TotalEquation(" << uLabel << "): "
450  "unable to create drive "
451  "after hint #" << i << std::endl);
453  }
454 
455  if (dynamic_cast<Joint::PositionDriveHint<Vec3> *>(pjdh)) {
456  XDrv.Set(pDC);
457 
458  } else if (dynamic_cast<Joint::VelocityDriveHint<Vec3> *>(pjdh)) {
459  XPDrv.Set(pDC);
460 
461  } else if (dynamic_cast<Joint::AccelerationDriveHint<Vec3> *>(pjdh)) {
462  XPPDrv.Set(pDC);
463 
464  } else if (dynamic_cast<Joint::OrientationDriveHint<Vec3> *>(pjdh)) {
465  ThetaDrv.Set(pDC);
466 
467  } else if (dynamic_cast<Joint::AngularVelocityDriveHint<Vec3> *>(pjdh)) {
468  OmegaDrv.Set(pDC);
469 
470  } else if (dynamic_cast<Joint::AngularAccelerationDriveHint<Vec3> *>(pjdh)) {
471  OmegaPDrv.Set(pDC);
472 
473  } else {
474  delete pDC;
475  }
476 
477  } else if (dynamic_cast<Joint::ReactionsHint *>(pjh)) {
478  /* TODO */
479  }
480  continue;
481  }
482  }
483  }
484 }
TplDriveOwner< Vec3 > XDrv
Definition: totalequation.h:63
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Definition: matvec3.h:98
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
TplDriveHint< T > * pTDH
Definition: joint.h:137
const StructNode * pNode1
Definition: totalequation.h:49
TplDriveOwner< Vec3 > OmegaDrv
Definition: totalequation.h:68
void Set(const TplDriveCaller< T > *pDC)
Definition: tpldrive.h:97
TplDriveOwner< Vec3 > OmegaPDrv
Definition: totalequation.h:69
Vec3 MulTV(const Vec3 &v) const
Definition: matvec3.cc:482
TplDriveOwner< Vec3 > XPDrv
Definition: totalequation.h:64
TplDriveOwner< Vec3 > ThetaDrv
Definition: totalequation.h:67
T Get(const doublereal &dVar) const
Definition: tpldrive.h:109
unsigned int uLabel
Definition: withlab.h:44
Mat3x3 MulTM(const Mat3x3 &m) const
Definition: matvec3.cc:500
virtual const Vec3 & GetXCurr(void) const
Definition: strnode.h:310
TplDriveOwner< Vec3 > XPPDrv
Definition: totalequation.h:65
const StructNode * pNode2
Definition: totalequation.h:50

Here is the call graph for this function:

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

Implements Elem.

Definition at line 170 of file totalequation.h.

References nConstraints.

Referenced by AssJac(), and AssRes().

170  {
171  *piNumRows = nConstraints ;
172  *piNumCols = 12;
173  };
unsigned int nConstraints
Definition: totalequation.h:71

Friends And Related Function Documentation

friend class TotalReaction
friend

Definition at line 94 of file totalequation.h.

Member Data Documentation

bool TotalEquation::bAgvActive[3]
private

Definition at line 61 of file totalequation.h.

Referenced by DescribeDof(), DescribeEq(), and TotalEquation().

bool TotalEquation::bPosActive[3]
private

Definition at line 57 of file totalequation.h.

Referenced by DescribeDof(), DescribeEq(), dGetPrivData(), Restart(), and TotalEquation().

bool TotalEquation::bRotActive[3]
private

Definition at line 58 of file totalequation.h.

Referenced by DescribeDof(), DescribeEq(), dGetPrivData(), Restart(), and TotalEquation().

bool TotalEquation::bVelActive[3]
private

Definition at line 60 of file totalequation.h.

Referenced by DescribeDof(), DescribeEq(), and TotalEquation().

Vec3 TotalEquation::F
mutableprivate

Definition at line 90 of file totalequation.h.

Vec3 TotalEquation::f1
private

Definition at line 51 of file totalequation.h.

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

Vec3 TotalEquation::f2
private
unsigned int TotalEquation::iAgvEqIndex[3]
private

Definition at line 85 of file totalequation.h.

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

unsigned int TotalEquation::iAgvIncid[3]
private

Definition at line 80 of file totalequation.h.

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

unsigned int TotalEquation::iPosEqIndex[3]
private

Definition at line 82 of file totalequation.h.

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

unsigned int TotalEquation::iPosIncid[3]
private

Definition at line 77 of file totalequation.h.

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

unsigned int TotalEquation::iRotEqIndex[3]
private

Definition at line 83 of file totalequation.h.

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

unsigned int TotalEquation::iRotIncid[3]
private

Definition at line 78 of file totalequation.h.

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

unsigned int TotalEquation::iVelEqIndex[3]
private

Definition at line 84 of file totalequation.h.

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

unsigned int TotalEquation::iVelIncid[3]
private

Definition at line 79 of file totalequation.h.

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

Vec3 TotalEquation::M
mutableprivate

Definition at line 89 of file totalequation.h.

unsigned int TotalEquation::nAgvConstraints
private

Definition at line 75 of file totalequation.h.

Referenced by AssJac(), AssRes(), DescribeDof(), DescribeEq(), and TotalEquation().

unsigned int TotalEquation::nPosConstraints
private
unsigned int TotalEquation::nRotConstraints
private
unsigned int TotalEquation::nVelConstraints
private

Definition at line 74 of file totalequation.h.

Referenced by AssJac(), AssRes(), DescribeDof(), DescribeEq(), and TotalEquation().

TplDriveOwner<Vec3> TotalEquation::OmegaDrv
private

Definition at line 68 of file totalequation.h.

Referenced by SetValue().

TplDriveOwner<Vec3> TotalEquation::OmegaPDrv
private

Definition at line 69 of file totalequation.h.

Referenced by SetValue().

const StructNode* TotalEquation::pNode1
private
const StructNode* TotalEquation::pNode2
private
Mat3x3 TotalEquation::R1h
private
Mat3x3 TotalEquation::R1hr
private
Mat3x3 TotalEquation::R2h
private

Definition at line 55 of file totalequation.h.

Referenced by Restart(), and SetValue().

Mat3x3 TotalEquation::R2hr
private

Definition at line 56 of file totalequation.h.

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

Vec3 TotalEquation::ThetaDelta
mutableprivate

Definition at line 91 of file totalequation.h.

Referenced by AfterConvergence(), AssRes(), dGetPrivData(), and InitialAssRes().

Vec3 TotalEquation::ThetaDeltaPrev
mutableprivate

Definition at line 92 of file totalequation.h.

Referenced by AfterConvergence(), and dGetPrivData().

TplDriveOwner<Vec3> TotalEquation::ThetaDrv
private

Definition at line 67 of file totalequation.h.

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

Vec3 TotalEquation::tilde_f1
private

Definition at line 87 of file totalequation.h.

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

TplDriveOwner<Vec3> TotalEquation::XDrv
private

Definition at line 63 of file totalequation.h.

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

TplDriveOwner<Vec3> TotalEquation::XPDrv
private

Definition at line 64 of file totalequation.h.

Referenced by SetValue().

TplDriveOwner<Vec3> TotalEquation::XPPDrv
private

Definition at line 65 of file totalequation.h.

Referenced by SetValue().


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