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

#include <body.h>

Inheritance diagram for DynamicBody:
Collaboration diagram for DynamicBody:

Public Member Functions

 DynamicBody (unsigned int uL, const DynamicStructNode *pNodeTmp, doublereal dMassTmp, const Vec3 &XgcTmp, const Mat3x3 &JTmp, flag fOut)
 
virtual ~DynamicBody (void)
 
virtual void WorkSpaceDim (integer *piNumRows, integer *piNumCols) const
 
virtual VariableSubMatrixHandlerAssJac (VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual void AssMats (VariableSubMatrixHandler &WorkMatA, VariableSubMatrixHandler &WorkMatB, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual SubVectorHandlerAssRes (SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual void InitialWorkSpaceDim (integer *piNumRows, integer *piNumCols) const
 
virtual VariableSubMatrixHandlerInitialAssJac (VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
 
virtual SubVectorHandlerInitialAssRes (SubVectorHandler &WorkVec, const VectorHandler &XCurr)
 
virtual void SetValue (DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *ph=0)
 
- Public Member Functions inherited from Elem
 Elem (unsigned int uL, flag fOut)
 
virtual ~Elem (void)
 
virtual unsigned int iGetNumDof (void) const
 
virtual std::ostream & DescribeDof (std::ostream &out, const char *prefix="", bool bInitial=false) const
 
virtual void DescribeDof (std::vector< std::string > &desc, bool bInitial=false, int i=-1) const
 
virtual std::ostream & DescribeEq (std::ostream &out, const char *prefix="", bool bInitial=false) const
 
virtual void DescribeEq (std::vector< std::string > &desc, bool bInitial=false, int i=-1) const
 
virtual DofOrder::Order GetDofType (unsigned int) const
 
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 HintParseHint (DataManager *pDM, const char *s) const
 
virtual void BeforePredict (VectorHandler &, VectorHandler &, VectorHandler &, VectorHandler &) const
 
virtual void Update (const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual void DerivativesUpdate (const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual void Update (const VectorHandler &XCurr, InverseDynamics::Order iOrder)
 
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
 
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 Body
 Body (unsigned int uL, const StructNode *pNode, doublereal dMassTmp, const Vec3 &XgcTmp, const Mat3x3 &JTmp, flag fOut)
 
virtual ~Body (void)
 
virtual std::ostream & Restart (std::ostream &out) const
 
doublereal dGetM (void) const
 
Vec3 GetS (void) const
 
Mat3x3 GetJ (void) const
 
const StructNodepGetNode (void) const
 
virtual Elem::Type GetElemType (void) const
 
virtual unsigned int iGetInitialNumDof (void) const
 
virtual void AfterPredict (VectorHandler &X, VectorHandler &XP)
 
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 ElemGravityOwner
 ElemGravityOwner (unsigned int uL, flag fOut)
 
virtual ~ElemGravityOwner (void)
 
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 InitialAssemblyElem
 InitialAssemblyElem (unsigned int uL, flag fOut)
 
virtual ~InitialAssemblyElem (void)
 
- Public Member Functions inherited from SubjectToInitialAssembly
 SubjectToInitialAssembly (void)
 
virtual ~SubjectToInitialAssembly (void)
 

Private Member Functions

Vec3 GetB_int (void) const
 
Vec3 GetG_int (void) const
 
void AssMats (FullSubMatrixHandler &WorkMatA, FullSubMatrixHandler &WorkMatB, doublereal dCoef, bool bGravity, const Vec3 &GravityAcceleration)
 

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 }
 
- Protected Member Functions inherited from Body
Vec3 GetS_int (void) const
 
Mat3x3 GetJ_int (void) const
 
void AssVecRBK_int (SubVectorHandler &WorkVec)
 
void AssMatsRBK_int (FullSubMatrixHandler &WMA, FullSubMatrixHandler &WMB, const doublereal &dCoef, const Vec3 &Sc)
 
- Protected Attributes inherited from WithLabel
unsigned int uLabel
 
std::string sName
 
- Protected Attributes inherited from ToBeOutput
flag fOutput
 
- Protected Attributes inherited from Body
const StructNodepNode
 
doublereal dMass
 
Vec3 Xgc
 
Vec3 S0
 
Mat3x3 J0
 
Vec3 STmp
 
Mat3x3 JTmp
 
- Protected Attributes inherited from GravityOwner
GravitypGravity
 

Detailed Description

Definition at line 354 of file body.h.

Constructor & Destructor Documentation

DynamicBody::DynamicBody ( unsigned int  uL,
const DynamicStructNode pNodeTmp,
doublereal  dMassTmp,
const Vec3 XgcTmp,
const Mat3x3 JTmp,
flag  fOut 
)

Definition at line 1002 of file body.cc.

References NO_OP.

1008 : Elem(uL, fOut),
1009 Body(uL, pNode, dMass, Xgc, J, fOut)
1010 {
1011  NO_OP;
1012 }
#define NO_OP
Definition: myassert.h:74
doublereal dMass
Definition: body.h:274
Elem(unsigned int uL, flag fOut)
Definition: elem.cc:41
const StructNode * pNode
Definition: body.h:273
Vec3 Xgc
Definition: body.h:275
Body(unsigned int uL, const StructNode *pNode, doublereal dMassTmp, const Vec3 &XgcTmp, const Mat3x3 &JTmp, flag fOut)
Definition: body.cc:722
DynamicBody::~DynamicBody ( void  )
virtual

Definition at line 1016 of file body.cc.

References NO_OP.

1017 {
1018  NO_OP;
1019 }
#define NO_OP
Definition: myassert.h:74

Member Function Documentation

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

Implements Elem.

Reimplemented in ModalBody.

Definition at line 1036 of file body.cc.

References AssMats(), GravityOwner::bGetGravity(), DEBUGCOUTFNAME, StructDispNode::GetXCurr(), StructDispNode::iGetFirstMomentumIndex(), StructDispNode::iGetFirstPositionIndex(), StructDispNode::pGetRBK(), Body::pNode, FullSubMatrixHandler::PutColIndex(), FullSubMatrixHandler::PutRowIndex(), FullSubMatrixHandler::ResizeReset(), and VariableSubMatrixHandler::SetFull().

1040 {
1041  DEBUGCOUTFNAME("DynamicBody::AssJac");
1042 
1043  /* Casting di WorkMat */
1044  FullSubMatrixHandler& WM = WorkMat.SetFull();
1045 
1046  Vec3 GravityAcceleration;
1048  GravityAcceleration);
1049 
1050  integer iNumRows = 6;
1051  if (g || pNode->pGetRBK()) {
1052  iNumRows = 12;
1053  }
1054 
1055  /* Dimensiona e resetta la matrice di lavoro */
1056  WM.ResizeReset(iNumRows, 6);
1057 
1058  /* Setta gli indici della matrice - le incognite sono ordinate come:
1059  * - posizione (3)
1060  * - parametri di rotazione (3)
1061  * - quantita' di moto (3)
1062  * - momento della quantita' di moto
1063  * e gli indici sono consecutivi. La funzione pGetFirstPositionIndex()
1064  * ritorna il valore del primo indice -1, in modo che l'indice i-esimo
1065  * e' dato da iGetFirstPositionIndex()+i */
1066  integer iFirstPositionIndex = pNode->iGetFirstPositionIndex();
1067  for (integer iCnt = 1; iCnt <= 6; iCnt++) {
1068  WM.PutRowIndex(iCnt, iFirstPositionIndex + iCnt);
1069  WM.PutColIndex(iCnt, iFirstPositionIndex + iCnt);
1070  }
1071 
1072  if (iNumRows == 12) {
1073  integer iFirstMomentumIndex = pNode->iGetFirstMomentumIndex();
1074  for (integer iCnt = 1; iCnt <= 6; iCnt++) {
1075  WM.PutRowIndex(6 + iCnt, iFirstMomentumIndex + iCnt);
1076  }
1077  }
1078 
1079  AssMats(WM, WM, dCoef, g, GravityAcceleration);
1080 
1081  return WorkMat;
1082 }
void PutColIndex(integer iSubCol, integer iCol)
Definition: submat.h:325
Definition: matvec3.h:98
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
FullSubMatrixHandler & SetFull(void)
Definition: submat.h:1168
void AssMats(FullSubMatrixHandler &WorkMatA, FullSubMatrixHandler &WorkMatB, doublereal dCoef, bool bGravity, const Vec3 &GravityAcceleration)
Definition: body.cc:1139
virtual bool bGetGravity(const Vec3 &X, Vec3 &Acc) const
Definition: gravity.cc:208
virtual integer iGetFirstMomentumIndex(void) const =0
virtual integer iGetFirstPositionIndex(void) const
Definition: strnode.h:452
const RigidBodyKinematics * pGetRBK(void) const
Definition: strnode.cc:152
virtual const Vec3 & GetXCurr(void) const
Definition: strnode.h:310
virtual void ResizeReset(integer, integer)
Definition: submat.cc:182
void PutRowIndex(integer iSubRow, integer iRow)
Definition: submat.h:311
long int integer
Definition: colamd.c:51
const StructNode * pNode
Definition: body.h:273

Here is the call graph for this function:

void DynamicBody::AssMats ( FullSubMatrixHandler WorkMatA,
FullSubMatrixHandler WorkMatB,
doublereal  dCoef,
bool  bGravity,
const Vec3 GravityAcceleration 
)
private

Definition at line 1139 of file body.cc.

References FullSubMatrixHandler::Add(), Body::AssMatsRBK_int(), Vec3::Cross(), DEBUGCOUTFNAME, Body::dMass, StructDispNode::GetVCurr(), StructNode::GetWCurr(), FullSubMatrixHandler::IncCoef(), Body::JTmp, MatCross, MatCrossCross, StructDispNode::pGetRBK(), Body::pNode, Body::STmp, and FullSubMatrixHandler::Sub().

Referenced by AssJac(), and AssMats().

1144 {
1145  DEBUGCOUTFNAME("DynamicBody::AssMats");
1146 
1147  const Vec3& V(pNode->GetVCurr());
1148  const Vec3& W(pNode->GetWCurr());
1149 
1150  // STmp, JTmp computed by AssRes()
1151  // const Mat3x3& R(pNode->GetRCurr());
1152  // STmp = R*S0;
1153  // JTmp = R*J0.MulMT(R);
1154 
1155  Mat3x3 SWedge(MatCross, STmp); /* S /\ */
1156  Vec3 Sc(STmp*dCoef);
1157 
1158  /*
1159  * momentum:
1160  *
1161  * m * I DeltaV - S /\ DeltagP + ( S /\ W ) /\ Deltag
1162  */
1163  WMB.IncCoef(1, 1, dMass);
1164  WMB.IncCoef(2, 2, dMass);
1165  WMB.IncCoef(3, 3, dMass);
1166 
1167  WMB.Sub(1, 3 + 1, SWedge);
1168  WMA.Add(1, 3 + 1, Mat3x3(MatCross, Sc.Cross(W)));
1169 
1170  /*
1171  * momenta moment:
1172  *
1173  * S /\ DeltaV + J DeltagP + ( V /\ S /\ - ( J * W ) /\ ) Deltag
1174  */
1175  WMB.Add(3 + 1, 1, SWedge);
1176 
1177  WMB.Add(3 + 1, 3 + 1, JTmp);
1178  WMA.Add(3 + 1, 3 + 1, Mat3x3(MatCrossCross, V, Sc) - Mat3x3(MatCross, JTmp*(W*dCoef)));
1179 
1180  if (bGravity) {
1181  WMA.Sub(9 + 1, 3 + 1, Mat3x3(MatCrossCross, GravityAcceleration, Sc));
1182  }
1183 
1184  const RigidBodyKinematics *pRBK = pNode->pGetRBK();
1185  if (pRBK) {
1186  AssMatsRBK_int(WMA, WMB, dCoef, Sc);
1187  }
1188 }
Definition: matvec3.h:98
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
const MatCross_Manip MatCross
Definition: matvec3.cc:639
Vec3 STmp
Definition: body.h:279
doublereal dMass
Definition: body.h:274
virtual const Vec3 & GetWCurr(void) const
Definition: strnode.h:1030
void AssMatsRBK_int(FullSubMatrixHandler &WMA, FullSubMatrixHandler &WMB, const doublereal &dCoef, const Vec3 &Sc)
Definition: body.cc:928
const RigidBodyKinematics * pGetRBK(void) const
Definition: strnode.cc:152
Mat3x3 JTmp
Definition: body.h:280
const MatCrossCross_Manip MatCrossCross
Definition: matvec3.cc:640
virtual const Vec3 & GetVCurr(void) const
Definition: strnode.h:322
const StructNode * pNode
Definition: body.h:273

Here is the call graph for this function:

void DynamicBody::AssMats ( VariableSubMatrixHandler WorkMatA,
VariableSubMatrixHandler WorkMatB,
const VectorHandler XCurr,
const VectorHandler XPrimeCurr 
)
virtual

Reimplemented from Elem.

Reimplemented in ModalBody.

Definition at line 1086 of file body.cc.

References AssMats(), GravityOwner::bGetGravity(), DEBUGCOUTFNAME, StructDispNode::GetXCurr(), StructDispNode::iGetFirstMomentumIndex(), StructDispNode::iGetFirstPositionIndex(), Body::pNode, FullSubMatrixHandler::PutColIndex(), FullSubMatrixHandler::PutRowIndex(), FullSubMatrixHandler::ResizeReset(), and VariableSubMatrixHandler::SetFull().

1090 {
1091  DEBUGCOUTFNAME("DynamicBody::AssMats");
1092 
1093  /* Casting di WorkMat */
1094  FullSubMatrixHandler& WMA = WorkMatA.SetFull();
1095  FullSubMatrixHandler& WMB = WorkMatB.SetFull();
1096 
1097  Vec3 GravityAcceleration;
1099  GravityAcceleration);
1100 
1101  integer iNumRows = 6;
1102  if (g) {
1103  iNumRows = 12;
1104  }
1105 
1106  /* Dimensiona e resetta la matrice di lavoro */
1107  WMA.ResizeReset(iNumRows, 6);
1108  WMB.ResizeReset(6, 6);
1109 
1110  /* Setta gli indici della matrice - le incognite sono ordinate come:
1111  * - posizione (3)
1112  * - parametri di rotazione (3)
1113  * - quantita' di moto (3)
1114  * - momento della quantita' di moto
1115  * e gli indici sono consecutivi. La funzione pGetFirstPositionIndex()
1116  * ritorna il valore del primo indice -1, in modo che l'indice i-esimo
1117  * e' dato da iGetFirstPositionIndex()+i */
1118  integer iFirstPositionIndex = pNode->iGetFirstPositionIndex();
1119  for (integer iCnt = 1; iCnt <= 6; iCnt++) {
1120  WMA.PutRowIndex(iCnt, iFirstPositionIndex + iCnt);
1121  WMA.PutColIndex(iCnt, iFirstPositionIndex + iCnt);
1122 
1123  WMB.PutRowIndex(iCnt, iFirstPositionIndex + iCnt);
1124  WMB.PutColIndex(iCnt, iFirstPositionIndex + iCnt);
1125  }
1126 
1127  if (g) {
1128  integer iFirstMomentumIndex = pNode->iGetFirstMomentumIndex();
1129  for (integer iCnt = 1; iCnt <= 6; iCnt++) {
1130  WMA.PutRowIndex(6 + iCnt, iFirstMomentumIndex + iCnt);
1131  }
1132  }
1133 
1134  AssMats(WMA, WMB, 1., g, GravityAcceleration);
1135 }
void PutColIndex(integer iSubCol, integer iCol)
Definition: submat.h:325
Definition: matvec3.h:98
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
FullSubMatrixHandler & SetFull(void)
Definition: submat.h:1168
void AssMats(FullSubMatrixHandler &WorkMatA, FullSubMatrixHandler &WorkMatB, doublereal dCoef, bool bGravity, const Vec3 &GravityAcceleration)
Definition: body.cc:1139
virtual bool bGetGravity(const Vec3 &X, Vec3 &Acc) const
Definition: gravity.cc:208
virtual integer iGetFirstMomentumIndex(void) const =0
virtual integer iGetFirstPositionIndex(void) const
Definition: strnode.h:452
virtual const Vec3 & GetXCurr(void) const
Definition: strnode.h:310
virtual void ResizeReset(integer, integer)
Definition: submat.cc:182
void PutRowIndex(integer iSubRow, integer iRow)
Definition: submat.h:311
long int integer
Definition: colamd.c:51
const StructNode * pNode
Definition: body.h:273

Here is the call graph for this function:

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

Implements Elem.

Reimplemented in ModalBody.

Definition at line 1192 of file body.cc.

References VectorHandler::Add(), DynamicStructNode::AddInertia(), ASSERT, Body::AssVecRBK_int(), GravityOwner::bGetGravity(), DEBUGCOUTFNAME, Body::dMass, StructNode::GetRCurr(), StructDispNode::GetVCurr(), StructNode::GetWCurr(), StructDispNode::GetXCurr(), StructDispNode::iGetFirstPositionIndex(), Body::J0, Body::JTmp, Mat3x3::MulMT(), StructDispNode::pGetRBK(), Body::pNode, SubVectorHandler::PutRowIndex(), R, VectorHandler::ResizeReset(), Body::S0, Body::STmp, and VectorHandler::Sub().

1196 {
1197  DEBUGCOUTFNAME("DynamicBody::AssRes");
1198 
1199  /* Se e' definita l'accelerazione di gravita',
1200  * la aggiunge (solo al residuo) */
1201  Vec3 GravityAcceleration;
1203  GravityAcceleration);
1204 
1205  const RigidBodyKinematics *pRBK = pNode->pGetRBK();
1206 
1207  integer iNumRows = 6;
1208  if (g || pRBK) {
1209  iNumRows = 12;
1210  }
1211 
1212  WorkVec.ResizeReset(iNumRows);
1213 
1214  integer iFirstPositionIndex = pNode->iGetFirstPositionIndex();
1215  for (integer iCnt = 1; iCnt <= iNumRows; iCnt++) {
1216  WorkVec.PutRowIndex(iCnt, iFirstPositionIndex + iCnt);
1217  }
1218 
1219  const Vec3& V(pNode->GetVCurr());
1220  const Vec3& W(pNode->GetWCurr());
1221 
1222  /* Aggiorna i suoi dati (saranno pronti anche per AssJac) */
1223  const Mat3x3& R(pNode->GetRCurr());
1224  STmp = R*S0;
1225  JTmp = R*J0.MulMT(R);
1226 
1227  /* Quantita' di moto: R[1] = Q - M * V - W /\ S */
1228  WorkVec.Sub(1, V*dMass + W.Cross(STmp));
1229 
1230  /* Momento della quantita' di moto: R[2] = G - S /\ V - J * W */
1231  WorkVec.Sub(3 + 1, JTmp*W + STmp.Cross(V));
1232 
1233  if (g) {
1234  WorkVec.Add(6 + 1, GravityAcceleration*dMass);
1235  /* FIXME: this should go into Jacobian matrix
1236  * as Gravity /\ S /\ Delta g */
1237  WorkVec.Add(9 + 1, STmp.Cross(GravityAcceleration));
1238  }
1239 
1240  if (pRBK) {
1241  AssVecRBK_int(WorkVec);
1242  }
1243 
1244  const DynamicStructNode *pDN = dynamic_cast<const DynamicStructNode *>(pNode);
1245  ASSERT(pDN != 0);
1246 
1247  pDN->AddInertia(dMass, STmp, JTmp);
1248 
1249  return WorkVec;
1250 }
Definition: matvec3.h:98
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
virtual void ResizeReset(integer)
Definition: vh.cc:55
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
Vec3 STmp
Definition: body.h:279
virtual void Sub(integer iRow, const Vec3 &v)
Definition: vh.cc:78
virtual bool bGetGravity(const Vec3 &X, Vec3 &Acc) const
Definition: gravity.cc:208
void AssVecRBK_int(SubVectorHandler &WorkVec)
Definition: body.cc:888
Mat3x3 J0
Definition: body.h:277
virtual void PutRowIndex(integer iSubRow, integer iRow)=0
virtual integer iGetFirstPositionIndex(void) const
Definition: strnode.h:452
doublereal dMass
Definition: body.h:274
virtual const Vec3 & GetWCurr(void) const
Definition: strnode.h:1030
#define ASSERT(expression)
Definition: colamd.c:977
const RigidBodyKinematics * pGetRBK(void) const
Definition: strnode.cc:152
virtual const Vec3 & GetXCurr(void) const
Definition: strnode.h:310
virtual void Add(integer iRow, const Vec3 &v)
Definition: vh.cc:63
Mat3x3 JTmp
Definition: body.h:280
Vec3 S0
Definition: body.h:276
virtual const Vec3 & GetVCurr(void) const
Definition: strnode.h:322
Mat3x3 MulMT(const Mat3x3 &m) const
Definition: matvec3.cc:444
long int integer
Definition: colamd.c:51
const StructNode * pNode
Definition: body.h:273
Mat3x3 R
virtual void AddInertia(const doublereal &dm, const Vec3 &dS, const Mat3x3 &dJ) const
Definition: strnode.cc:3092

Here is the call graph for this function:

Vec3 DynamicBody::GetB_int ( void  ) const
privatevirtual

Reimplemented from ElemGravityOwner.

Definition at line 1395 of file body.cc.

References Body::dMass, StructNode::GetRCurr(), StructDispNode::GetVCurr(), StructNode::GetWCurr(), Body::pNode, R, and Body::S0.

1396 {
1397  const Vec3& V(pNode->GetVCurr());
1398  const Vec3& W(pNode->GetWCurr());
1399  const Mat3x3& R(pNode->GetRCurr());
1400 
1401  return V*dMass + W.Cross(R*S0);
1402 }
Definition: matvec3.h:98
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
doublereal dMass
Definition: body.h:274
virtual const Vec3 & GetWCurr(void) const
Definition: strnode.h:1030
Vec3 S0
Definition: body.h:276
virtual const Vec3 & GetVCurr(void) const
Definition: strnode.h:322
const StructNode * pNode
Definition: body.h:273
Mat3x3 R

Here is the call graph for this function:

Vec3 DynamicBody::GetG_int ( void  ) const
privatevirtual

Reimplemented from ElemGravityOwner.

Definition at line 1407 of file body.cc.

References Body::dMass, StructNode::GetRCurr(), StructDispNode::GetVCurr(), StructNode::GetWCurr(), StructDispNode::GetXCurr(), Body::J0, Mat3x3::MulTV(), Body::pNode, R, Body::S0, and Body::STmp.

1408 {
1409  const Vec3& X(pNode->GetXCurr());
1410  const Mat3x3& R(pNode->GetRCurr());
1411  const Vec3& V(pNode->GetVCurr());
1412  const Vec3& W(pNode->GetWCurr());
1413 
1414  Vec3 STmp(R*S0);
1415 
1416  // NOTE: with respect to the origin of the global reference frame!
1417  return (STmp + X*dMass).Cross(V) + R*(J0*(R.MulTV(W)))
1418  - X.Cross(STmp.Cross(W));
1419 }
Vec3 Cross(const Vec3 &v) const
Definition: matvec3.h:218
Definition: matvec3.h:98
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
Vec3 STmp
Definition: body.h:279
Mat3x3 J0
Definition: body.h:277
Vec3 MulTV(const Vec3 &v) const
Definition: matvec3.cc:482
doublereal dMass
Definition: body.h:274
virtual const Vec3 & GetWCurr(void) const
Definition: strnode.h:1030
virtual const Vec3 & GetXCurr(void) const
Definition: strnode.h:310
Vec3 S0
Definition: body.h:276
virtual const Vec3 & GetVCurr(void) const
Definition: strnode.h:322
const StructNode * pNode
Definition: body.h:273
Mat3x3 R

Here is the call graph for this function:

VariableSubMatrixHandler & DynamicBody::InitialAssJac ( VariableSubMatrixHandler WorkMat,
const VectorHandler XCurr 
)
virtual

Implements SubjectToInitialAssembly.

Definition at line 1255 of file body.cc.

References FullSubMatrixHandler::Add(), Vec3::Cross(), DEBUGCOUTFNAME, StructNode::GetWRef(), StructDispNode::iGetFirstPositionIndex(), InitialWorkSpaceDim(), Body::JTmp, MatCross, MatCrossCross, Body::pNode, FullSubMatrixHandler::PutColIndex(), FullSubMatrixHandler::PutRowIndex(), FullSubMatrixHandler::ResizeReset(), VariableSubMatrixHandler::SetFull(), and Body::STmp.

1257 {
1258  DEBUGCOUTFNAME("DynamicBody::InitialAssJac");
1259 
1260  /* Casting di WorkMat */
1261  FullSubMatrixHandler& WM = WorkMat.SetFull();
1262 
1263  /* Dimensiona e resetta la matrice di lavoro */
1264  integer iNumRows = 0;
1265  integer iNumCols = 0;
1266  InitialWorkSpaceDim(&iNumRows, &iNumCols);
1267  WM.ResizeReset(iNumRows, iNumCols);
1268 
1269  /* Setta gli indici della matrice - le incognite sono ordinate come:
1270  * - posizione (3)
1271  * - parametri di rotazione (3)
1272  * - quantita' di moto (3)
1273  * - momento della quantita' di moto
1274  * e gli indici sono consecutivi. La funzione pGetFirstPositionIndex()
1275  * ritorna il valore del primo indice -1, in modo che l'indice i-esimo
1276  * e' dato da iGetFirstPositionIndex()+i */
1277  integer iFirstPositionIndex = pNode->iGetFirstPositionIndex();
1278  integer iFirstVelocityIndex = iFirstPositionIndex+6;
1279  for (integer iCnt = 1; iCnt <= 6; iCnt++) {
1280  WM.PutRowIndex(iCnt, iFirstPositionIndex+iCnt);
1281  WM.PutRowIndex(6+iCnt, iFirstVelocityIndex+iCnt);
1282  WM.PutColIndex(iCnt, iFirstPositionIndex+iCnt);
1283  }
1284 
1285  /* Prepara matrici e vettori */
1286 
1287  /* Velocita' angolare corrente */
1288  const Vec3& W(pNode->GetWRef());
1289 
1290  Vec3 SWedgeW(STmp.Cross(W));
1291  Mat3x3 WWedgeSWedge(MatCrossCross, -W, STmp);
1292  Mat3x3 WWedge(MatCross, W);
1293  Mat3x3 WWedgeWWedgeSWedge(W.Cross(WWedgeSWedge));
1294  Mat3x3 FDeltaW(Mat3x3(MatCross, SWedgeW) + WWedgeSWedge);
1295 
1296  // STmp, JTmp computed by InitialAssRes()
1297  Vec3 JW(JTmp*W);
1298  Mat3x3 JWWedge(MatCross, JW);
1299  Mat3x3 MDeltag(W.Cross(JTmp*WWedge - JWWedge));
1300  Mat3x3 MDeltaW(W.Cross(JTmp) - JWWedge);
1301 
1302  /* Forza */
1303  WM.Add(1, 1, WWedgeWWedgeSWedge);
1304  WM.Add(1, 4, FDeltaW);
1305 
1306  /* Momento */
1307  WM.Add(4, 1, MDeltag);
1308  WM.Add(4, 4, MDeltaW);
1309 
1310  /* Derivata forza */
1311  WM.Add(7, 1, Mat3x3(MatCross, W.Cross(SWedgeW)) + W.Cross(FDeltaW));
1312  WM.Add(7, 4, W.Cross(WWedgeWWedgeSWedge));
1313 
1314  /* Derivata Momento */
1315  WM.Add(4, 1, W.Cross(MDeltag));
1316  WM.Add(4, 4, W.Cross(MDeltaW) - Mat3x3(MatCross, W.Cross(JW)));
1317 
1318  return WorkMat;
1319 }
void PutColIndex(integer iSubCol, integer iCol)
Definition: submat.h:325
Vec3 Cross(const Vec3 &v) const
Definition: matvec3.h:218
Definition: matvec3.h:98
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
const MatCross_Manip MatCross
Definition: matvec3.cc:639
FullSubMatrixHandler & SetFull(void)
Definition: submat.h:1168
void Add(integer iRow, integer iCol, const Vec3 &v)
Definition: submat.cc:209
Vec3 STmp
Definition: body.h:279
virtual const Vec3 & GetWRef(void) const
Definition: strnode.h:1024
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: body.cc:1029
virtual integer iGetFirstPositionIndex(void) const
Definition: strnode.h:452
Mat3x3 JTmp
Definition: body.h:280
virtual void ResizeReset(integer, integer)
Definition: submat.cc:182
const MatCrossCross_Manip MatCrossCross
Definition: matvec3.cc:640
void PutRowIndex(integer iSubRow, integer iRow)
Definition: submat.h:311
long int integer
Definition: colamd.c:51
const StructNode * pNode
Definition: body.h:273

Here is the call graph for this function:

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

Implements SubjectToInitialAssembly.

Definition at line 1324 of file body.cc.

References VectorHandler::Add(), GravityOwner::bGetGravity(), grad::Cross(), DEBUGCOUTFNAME, Body::dMass, StructNode::GetRCurr(), StructNode::GetWCurr(), StructDispNode::GetXCurr(), StructDispNode::iGetFirstPositionIndex(), InitialWorkSpaceDim(), Body::J0, Body::JTmp, Mat3x3::MulMT(), Body::pNode, SubVectorHandler::PutRowIndex(), R, VectorHandler::ResizeReset(), Body::S0, and Body::STmp.

1326 {
1327  DEBUGCOUTFNAME("DynamicBody::InitialAssRes");
1328 
1329  integer iNumRows;
1330  integer iNumCols;
1331  InitialWorkSpaceDim(&iNumRows, &iNumCols);
1332  WorkVec.ResizeReset(iNumRows);
1333 
1334  integer iFirstPositionIndex = pNode->iGetFirstPositionIndex();
1335  for (integer iCnt = 1; iCnt <= 12; iCnt++) {
1336  WorkVec.PutRowIndex(iCnt, iFirstPositionIndex+iCnt);
1337  }
1338 
1339  const Vec3& X(pNode->GetXCurr());
1340  const Vec3& W(pNode->GetWCurr());
1341 
1342  // Aggiorna i suoi dati (saranno pronti anche per InitialAssJac)
1343  const Mat3x3& R(pNode->GetRCurr());
1344  STmp = R*S0;
1345  JTmp = R*J0.MulMT(R);
1346 
1347  Vec3 FC(-W.Cross(W.Cross(STmp)));
1348  Vec3 MC(-W.Cross(JTmp*W));
1349 
1350  /* Forza */
1351  WorkVec.Add(1, FC);
1352 
1353  /* Momento */
1354  WorkVec.Add(4, MC);
1355 
1356  /* Derivata forza */
1357  WorkVec.Add(7, W.Cross(FC));
1358 
1359  /* Derivata momento */
1360  WorkVec.Add(10, W.Cross(MC));
1361 
1362  /* Se e' definita l'accelerazione di gravita',
1363  * la aggiunge (solo al residuo) */
1364  Vec3 GravityAcceleration;
1365  if (GravityOwner::bGetGravity(X, GravityAcceleration)) {
1366  WorkVec.Add(1, GravityAcceleration*dMass);
1367  WorkVec.Add(3 + 1, STmp.Cross(GravityAcceleration));
1368  WorkVec.Add(9 + 1, (W.Cross(STmp)).Cross(GravityAcceleration));
1369  }
1370 
1371  return WorkVec;
1372 }
Definition: matvec3.h:98
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
virtual void ResizeReset(integer)
Definition: vh.cc:55
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
Vec3 STmp
Definition: body.h:279
virtual bool bGetGravity(const Vec3 &X, Vec3 &Acc) const
Definition: gravity.cc:208
Mat3x3 J0
Definition: body.h:277
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: body.cc:1029
virtual void PutRowIndex(integer iSubRow, integer iRow)=0
virtual integer iGetFirstPositionIndex(void) const
Definition: strnode.h:452
doublereal dMass
Definition: body.h:274
virtual const Vec3 & GetWCurr(void) const
Definition: strnode.h:1030
VectorExpression< VectorCrossExpr< VectorLhsExpr, VectorRhsExpr >, 3 > Cross(const VectorExpression< VectorLhsExpr, 3 > &u, const VectorExpression< VectorRhsExpr, 3 > &v)
Definition: matvec.h:3248
virtual const Vec3 & GetXCurr(void) const
Definition: strnode.h:310
virtual void Add(integer iRow, const Vec3 &v)
Definition: vh.cc:63
Mat3x3 JTmp
Definition: body.h:280
Vec3 S0
Definition: body.h:276
Mat3x3 MulMT(const Mat3x3 &m) const
Definition: matvec3.cc:444
long int integer
Definition: colamd.c:51
const StructNode * pNode
Definition: body.h:273
Mat3x3 R

Here is the call graph for this function:

void DynamicBody::InitialWorkSpaceDim ( integer piNumRows,
integer piNumCols 
) const
virtual

Implements SubjectToInitialAssembly.

Definition at line 1029 of file body.cc.

Referenced by InitialAssJac(), and InitialAssRes().

1030 {
1031  *piNumRows = 12;
1032  *piNumCols = 6;
1033 }
void DynamicBody::SetValue ( DataManager pDM,
VectorHandler X,
VectorHandler XP,
SimulationEntity::Hints ph = 0 
)
virtual

Reimplemented from SimulationEntity.

Definition at line 1377 of file body.cc.

References VectorHandler::Add(), Body::dMass, StructNode::GetRCurr(), StructDispNode::GetVCurr(), StructNode::GetWCurr(), StructDispNode::iGetFirstMomentumIndex(), Body::J0, Body::JTmp, Mat3x3::MulMT(), Body::pNode, R, Body::S0, and Body::STmp.

1380 {
1381  integer iFirstIndex = pNode->iGetFirstMomentumIndex();
1382 
1383  // TODO: make configurable
1384  const Vec3& V(pNode->GetVCurr());
1385  const Vec3& W(pNode->GetWCurr());
1386  const Mat3x3& R(pNode->GetRCurr());
1387  STmp = R*S0;
1388  JTmp = R*J0.MulMT(R);
1389  X.Add(iFirstIndex + 1, V*dMass + W.Cross(STmp));
1390  X.Add(iFirstIndex + 4, STmp.Cross(V) + JTmp*W);
1391 }
Definition: matvec3.h:98
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
Vec3 STmp
Definition: body.h:279
Mat3x3 J0
Definition: body.h:277
virtual integer iGetFirstMomentumIndex(void) const =0
doublereal dMass
Definition: body.h:274
virtual const Vec3 & GetWCurr(void) const
Definition: strnode.h:1030
virtual void Add(integer iRow, const Vec3 &v)
Definition: vh.cc:63
Mat3x3 JTmp
Definition: body.h:280
Vec3 S0
Definition: body.h:276
virtual const Vec3 & GetVCurr(void) const
Definition: strnode.h:322
Mat3x3 MulMT(const Mat3x3 &m) const
Definition: matvec3.cc:444
long int integer
Definition: colamd.c:51
const StructNode * pNode
Definition: body.h:273
Mat3x3 R

Here is the call graph for this function:

void DynamicBody::WorkSpaceDim ( integer piNumRows,
integer piNumCols 
) const
virtual

Implements Elem.

Reimplemented in ModalBody.

Definition at line 1022 of file body.cc.

1023 {
1024  *piNumRows = 12;
1025  *piNumCols = 6;
1026 }

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