53 pNode1(pN1), pNode2(pN2), R1h(R1), R2h(R2),
54 M(
Zero3), dTheta(0.), dPhi(0.), od(od)
94 std::ostream& out = OH.
Joints();
138 DEBUGCOUT(
"Entering GimbalRotationJoint::AssJac()" << std::endl);
156 for (
int iCnt = 1; iCnt <= 3; iCnt++) {
159 WM.
PutRowIndex(3 + iCnt, iNode2FirstMomIndex + iCnt);
160 WM.
PutColIndex(3 + iCnt, iNode2FirstPosIndex + iCnt);
163 for (
int iCnt = 1; iCnt <= 5; iCnt++) {
164 WM.
PutRowIndex(6 + iCnt, iFirstReactionIndex + iCnt);
165 WM.
PutColIndex(6 + iCnt, iFirstReactionIndex + iCnt);
187 Mat3x3 RaT(Ra.Transpose());
196 Vec3 w_theta(dSinTheta*dSinPhi, 1. + dCosPhi, -dCosTheta*dSinPhi);
197 Vec3 w_phi(dCosTheta, 0., dSinTheta);
199 Vec3 w_theta_theta(dCosTheta*dSinPhi, 0., dSinTheta*dSinPhi);
200 Vec3 w_theta_phi(dSinTheta*dCosPhi, -dSinPhi, -dCosTheta*dCosPhi);
201 Vec3 w_phi_theta(-dSinTheta, 0., dCosTheta);
205 WM.
Add(1, 6 + 1, Ra);
206 WM.
Sub(3 + 1, 6 + 1, Ra);
212 WM.
Add(3 + 1, 1, MTmp);
217 WM.
Add(6 + 1, 1, MTmp);
218 WM.
Sub(6 + 1, 3 + 1, MTmp);
221 Vec3 VTmp(R_ab*w_theta);
222 WM.
IncCoef(6 + 1, 9 + 1, VTmp(1));
223 WM.
IncCoef(6 + 2, 9 + 1, VTmp(2));
224 WM.
IncCoef(6 + 3, 9 + 1, VTmp(3));
226 WM.
IncCoef(9 + 1, 6 + 1, VTmp(1));
227 WM.
IncCoef(9 + 1, 6 + 2, VTmp(2));
228 WM.
IncCoef(9 + 1, 6 + 3, VTmp(3));
231 VTmp =
Vec3(R_ab*w_phi);
232 WM.
IncCoef(6 + 1, 9 + 2, VTmp(1));
233 WM.
IncCoef(6 + 2, 9 + 2, VTmp(2));
234 WM.
IncCoef(6 + 3, 9 + 2, VTmp(3));
236 WM.
IncCoef(9 + 2, 6 + 1, VTmp(1));
237 WM.
IncCoef(9 + 2, 6 + 2, VTmp(2));
238 WM.
IncCoef(9 + 2, 6 + 3, VTmp(3));
242 VTmp = (Rb*w_theta).
Cross(Lambda*dCoef);
247 WM.
IncCoef(9 + 1, 3 + 1, VTmp(1));
248 WM.
IncCoef(9 + 1, 3 + 2, VTmp(2));
249 WM.
IncCoef(9 + 1, 3 + 3, VTmp(3));
252 WM.
IncCoef(9 + 1, 9 + 1, (Rb*w_theta_theta)*Lambda);
255 WM.
IncCoef(9 + 1, 9 + 2, (Rb*w_theta_phi)*Lambda);
259 VTmp = (Rb*w_phi).
Cross(Lambda*dCoef);
264 WM.
IncCoef(9 + 2, 3 + 1, VTmp(1));
265 WM.
IncCoef(9 + 2, 3 + 2, VTmp(2));
266 WM.
IncCoef(9 + 2, 3 + 3, VTmp(3));
269 WM.
IncCoef(9 + 2, 9 + 1, (Rb*w_phi_theta)*Lambda);
280 DEBUGCOUT(
"Entering GimbalRotationJoint::AssRes()" << std::endl);
294 for (
int iCnt = 1; iCnt <= 3; iCnt++) {
295 WorkVec.
PutRowIndex(iCnt, iNode1FirstMomIndex + iCnt);
296 WorkVec.
PutRowIndex(3 + iCnt, iNode2FirstMomIndex + iCnt);
299 for (
int iCnt = 1; iCnt <= 5; iCnt++) {
300 WorkVec.
PutRowIndex(6 + iCnt, iFirstReactionIndex + iCnt);
303 M =
Vec3(XCurr, iFirstReactionIndex + 1);
304 dTheta = XCurr(iFirstReactionIndex + 3 + 1);
305 dPhi = XCurr(iFirstReactionIndex + 3 + 2);
329 Mat3x3 R_rel(ExpTheta*ExpPhi*ExpTheta);
330 Mat3x3 R_ab(Ra.Transpose()*Rb);
332 WorkVec.
Sub(1, MTmp);
333 WorkVec.
Add(3 + 1, MTmp);
337 Vec3 w_theta(dSinTheta*dSinPhi, 1. + dCosPhi, -dCosTheta*dSinPhi);
338 Vec3 w_phi(dCosTheta, 0., dSinTheta);
340 WorkVec.
DecCoef(9 + 1, (R_ab*w_theta)*M);
341 WorkVec.
DecCoef(9 + 2, (R_ab*w_phi)*M);
355 DEBUGCOUT(
"Entering GimbalRotationJoint::InitialAssJac()" << std::endl);
371 for (
int iCnt = 1; iCnt <= 3; iCnt++) {
374 WM.
PutRowIndex(3 + iCnt, iNode2FirstPosIndex + iCnt);
375 WM.
PutColIndex(3 + iCnt, iNode2FirstPosIndex + iCnt);
378 for (
int iCnt = 1; iCnt <= 5; iCnt++) {
379 WM.
PutRowIndex(6 + iCnt, iFirstReactionIndex + iCnt);
380 WM.
PutColIndex(6 + iCnt, iFirstReactionIndex + iCnt);
394 DEBUGCOUT(
"Entering GimbalRotationJoint::InitialAssRes()" << std::endl);
408 for (
int iCnt = 1; iCnt <= 3; iCnt++) {
409 WorkVec.
PutRowIndex(iCnt, iNode1FirstPosIndex + iCnt);
410 WorkVec.
PutRowIndex(3 + iCnt, iNode2FirstPosIndex + iCnt);
413 for (
int iCnt = 1; iCnt <= 5; iCnt++) {
414 WorkVec.
PutRowIndex(6 + iCnt, iFirstReactionIndex + iCnt);
432 if (strncmp(s,
"lambda[" ,
STRLENOF(
"lambda[" )) == 0) {
434 if (strcmp(&s[1],
"]") != 0) {
448 }
else if (strcmp(s,
"theta") == 0) {
451 }
else if (strcmp(s,
"phi") == 0) {
virtual doublereal dGetPrivData(unsigned int i=0) const
virtual void Output(OutputHandler &OH) const
void PutColIndex(integer iSubCol, integer iCol)
virtual SubVectorHandler & InitialAssRes(SubVectorHandler &WorkVec, const VectorHandler &XCurr)
const Vec3 Zero3(0., 0., 0.)
void AssVec(SubVectorHandler &WorkVec, doublereal dCoef)
virtual bool bToBeOutput(void) const
const StructNode * pNode1
#define MBDYN_EXCEPT_ARGS
GradientExpression< UnaryExpr< FuncSin, Expr > > sin(const GradientExpression< Expr > &u)
virtual void ResizeReset(integer)
const MatCross_Manip MatCross
FullSubMatrixHandler & SetFull(void)
virtual const Mat3x3 & GetRCurr(void) const
virtual Node::Type GetNodeType(void) const
void Add(integer iRow, integer iCol, const Vec3 &v)
std::ostream & Write(std::ostream &out, const FullMatrixHandler &m, const char *s, const char *s2)
virtual void Sub(integer iRow, const Vec3 &v)
void IncCoef(integer iRow, integer iCol, const doublereal &dCoef)
Vec3 GetVec(unsigned short int i) const
virtual VariableSubMatrixHandler & InitialAssJac(VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
Vec3 VecRot(const Mat3x3 &Phi)
void DecCoef(integer iRow, integer iCol, const doublereal &dCoef)
virtual void PutRowIndex(integer iSubRow, integer iRow)=0
virtual void DecCoef(integer iRow, const doublereal &dCoef)=0
const StructNode * pNode2
OrientationDescription od
virtual VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Vec3 MatR2EulerAngles313(const Mat3x3 &R)
virtual SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
GimbalRotationJoint(unsigned int uL, const DofOwner *pDO, const StructNode *pN1, const StructNode *pN2, const Mat3x3 &R1, const Mat3x3 &R2, const OrientationDescription &od, flag fOut)
virtual unsigned int iGetNumPrivData(void) const
Vec3 MatR2EulerAngles123(const Mat3x3 &R)
virtual ~GimbalRotationJoint(void)
Mat3x3 Rot(const Vec3 &phi)
virtual integer iGetFirstMomentumIndex(void) const =0
virtual integer iGetFirstPositionIndex(void) const
virtual std::ostream & Restart(std::ostream &out) const
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
std::ostream & Joints(void) const
#define ASSERT(expression)
VectorExpression< VectorCrossExpr< VectorLhsExpr, VectorRhsExpr >, 3 > Cross(const VectorExpression< VectorLhsExpr, 3 > &u, const VectorExpression< VectorRhsExpr, 3 > &v)
virtual std::ostream & Restart(std::ostream &out) const
virtual void Add(integer iRow, const Vec3 &v)
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
virtual void ResizeReset(integer, integer)
Mat3x3 Transpose(void) const
void PutRowIndex(integer iSubRow, integer iRow)
Vec3 MatR2EulerAngles321(const Mat3x3 &R)
void Sub(integer iRow, integer iCol, const Vec3 &v)
GradientExpression< UnaryExpr< FuncCos, Expr > > cos(const GradientExpression< Expr > &u)
virtual integer iGetFirstIndex(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
unsigned int GetLabel(void) const
void AssMat(FullSubMatrixHandler &WM, doublereal dCoef)
virtual void AfterPredict(VectorHandler &X, VectorHandler &XP)
virtual unsigned int iGetPrivDataIdx(const char *s) const