MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
vehj.cc
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/struct/vehj.cc,v 1.93 2017/01/12 14:46:44 masarati Exp $ */
2 /*
3  * MBDyn (C) is a multibody analysis code.
4  * http://www.mbdyn.org
5  *
6  * Copyright (C) 1996-2017
7  *
8  * Pierangelo Masarati <masarati@aero.polimi.it>
9  * Paolo Mantegazza <mantegazza@aero.polimi.it>
10  *
11  * Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano
12  * via La Masa, 34 - 20156 Milano, Italy
13  * http://www.aero.polimi.it
14  *
15  * Changing this copyright notice is forbidden.
16  *
17  * This program is free software; you can redistribute it and/or modify
18  * it under the terms of the GNU General Public License as published by
19  * the Free Software Foundation (version 2 of the License).
20  *
21  *
22  * This program is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25  * GNU General Public License for more details.
26  *
27  * You should have received a copy of the GNU General Public License
28  * along with this program; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */
31 
32 /* Cerniera deformabile */
33 
34 #include "mbconfig.h" /* This goes first in every *.c,*.cc file */
35 
36 #include "dataman.h"
37 #include "vehj.h"
38 
39 #include "matvecexp.h"
40 #include "Rot.hh"
41 
42 /* DeformableHingeJoint - begin */
43 
44 /* Costruttore non banale */
46  const DofOwner* pDO,
47  const ConstitutiveLaw3D* pCL,
48  const StructNode* pN1,
49  const StructNode* pN2,
50  const Mat3x3& tilde_R1h,
51  const Mat3x3& tilde_R2h,
52  const OrientationDescription& od,
53  flag fOut)
54 : Elem(uL, fOut),
55 Joint(uL, pDO, fOut),
57 pNode1(pN1),
58 pNode2(pN2),
59 tilde_R1h(tilde_R1h),
60 tilde_R2h(tilde_R2h),
61 od(od),
62 #ifdef USE_NETCDF
63 Var_Phi(0),
64 Var_Omega(0),
65 #endif // USE_NETCDF
66 bFirstRes(false)
67 {
68  ASSERT(pNode1 != NULL);
69  ASSERT(pNode2 != NULL);
72 }
73 
74 /* Distruttore */
76 {
77  NO_OP;
78 }
79 
80 /* assemblaggio jacobiano */
81 /* Used by all "attached" hinges */
82 void
84  doublereal dCoef)
85 {
86  /* M was updated by AssRes */
87  Mat3x3 MTmp(MatCross, M*dCoef);
88 
89  WMA.Add(1, 1, MTmp);
90  WMA.Sub(4, 1, MTmp);
91 }
92 
93 /* Used by all "invariant" hinges */
94 void
96 {
97  /* M was updated by AssRes;
98  * hat_I and hat_IT were updated by AfterPredict */
99  Vec3 MCoef(M*dCoef);
100  Mat3x3 MTmp(MCoef.Cross(hat_IT));
101 
102  WMA.Add(1, 1, MTmp);
103  WMA.Sub(4, 1, MTmp);
104 
105  MTmp = MCoef.Cross(hat_I);
106 
107  WMA.Add(1, 4, MTmp);
108  WMA.Sub(4, 4, MTmp);
109 }
110 
111 /* Used by all hinges */
112 void
114  doublereal dCoef)
115 {
116  Mat3x3 MTmp(MDE*dCoef);
117 
118  WMA.Add(1, 1, MTmp);
119  WMA.Sub(1, 4, MTmp);
120  WMA.Sub(4, 1, MTmp);
121  WMA.Add(4, 4, MTmp);
122 }
123 
124 /* Used by all "attached" hinges */
125 void
127  FullSubMatrixHandler& WMB, doublereal dCoef)
128 {
129  WMB.Add(1, 1, MDEPrime);
130  WMB.Sub(1, 4, MDEPrime);
131  WMB.Sub(4, 1, MDEPrime);
132  WMB.Add(4, 4, MDEPrime);
133 
134  Mat3x3 MTmp(MDEPrime*Mat3x3(MatCross, pNode2->GetWCurr()*dCoef));
135  WMA.Sub(1, 1, MTmp);
136  WMA.Add(1, 4, MTmp);
137  WMA.Add(4, 1, MTmp);
138  WMA.Sub(4, 4, MTmp);
139 }
140 
141 /* Used by all "invariant" hinges */
142 void
144  FullSubMatrixHandler& WMB, doublereal dCoef)
145 {
146  /* hat_I and hat_IT were updated by AfterPredict */
147  WMB.Add(1, 1, MDEPrime);
148  WMB.Sub(1, 4, MDEPrime);
149  WMB.Sub(4, 1, MDEPrime);
150  WMB.Add(4, 4, MDEPrime);
151 
152  Vec3 W1(pNode1->GetWCurr()*dCoef);
153  Vec3 W2(pNode2->GetWCurr()*dCoef);
154  Mat3x3 MTmp(MDEPrime*(W2.Cross(hat_IT) + W1.Cross(hat_I)));
155  WMA.Sub(1, 1, MTmp);
156  WMA.Add(1, 4, MTmp);
157  WMA.Add(4, 1, MTmp);
158  WMA.Sub(4, 4, MTmp);
159 }
160 
161 /* Contributo al file di restart */
162 std::ostream&
163 DeformableHingeJoint::Restart(std::ostream& out) const
164 {
165  /* FIXME: does not work for invariant hinge */
166  Joint::Restart(out) << ", deformable hinge, "
167  << pNode1->GetLabel() << ", hinge, reference, node, 1, ",
168  (tilde_R1h.GetVec(1)).Write(out, ", ")
169  << ", 2, ", (tilde_R1h.GetVec(2)).Write(out, ", ") << ", "
170  << pNode2->GetLabel() << ", hinge, reference, node, 1, ",
171  (tilde_R2h.GetVec(1)).Write(out, ", ")
172  << ", 2, ", (tilde_R2h.GetVec(2)).Write(out, ", ") << ", ";
173  return pGetConstLaw()->Restart(out) << ';' << std::endl;
174 }
175 
176 void
178 {
179  if (bToBeOutput()) {
180 #ifdef USE_NETCDF
182  std::string name;
183  OutputPrepare_int("deformable hinge", OH, name);
184 
185  Var_Phi = OH.CreateRotationVar(name, "", od, "global");
186 
187  Var_Omega = OH.CreateVar<Vec3>(name + "Omega", "radian/s",
188  "local relative angular velocity (x, y, z)");
189  }
190 #endif // USE_NETCDF
191  }
192 }
193 
194 void
196 {
197  if (bToBeOutput()) {
200  Mat3x3 R(R1h.MulTM(R2h));
201  Vec3 OmegaTmp(R1h.MulTV(pNode2->GetWCurr() - pNode1->GetWCurr()));
202  Vec3 v(GetF());
203  Vec3 E;
204  switch (od) {
205  case EULER_123:
207  break;
208 
209  case EULER_313:
211  break;
212 
213  case EULER_321:
215  break;
216 
217  case ORIENTATION_VECTOR:
218  E = RotManip::VecRot(R);
219  break;
220 
221  case ORIENTATION_MATRIX:
222  break;
223 
224  default:
225  /* impossible */
226  break;
227  }
228 
229 #ifdef USE_NETCDF
231  Var_F_local->put_rec(Zero3.pGetVec(), OH.GetCurrentStep());
232  Var_M_local->put_rec(v.pGetVec(), OH.GetCurrentStep());
233  Var_F_global->put_rec(Zero3.pGetVec(), OH.GetCurrentStep());
234  Var_M_global->put_rec((R1h*v).pGetVec(), OH.GetCurrentStep());
235  Var_Omega->put_rec(OmegaTmp.pGetVec(), OH.GetCurrentStep());
236 
237  switch (od) {
238  case EULER_123:
239  case EULER_313:
240  case EULER_321:
241  case ORIENTATION_VECTOR:
242  Var_Phi->put_rec(E.pGetVec(), OH.GetCurrentStep());
243  break;
244 
245  case ORIENTATION_MATRIX:
246  Var_Phi->put_rec(R.pGetMat(), OH.GetCurrentStep());
247  break;
248 
249  default:
250  /* impossible */
251  break;
252  }
253 
254 
255  }
256 #endif // USE_NETCDF
257  if (OH.UseText(OutputHandler::JOINTS)) {
258  Joint::Output(OH.Joints(), "DeformableHinge", GetLabel(),
259  Zero3, v, Zero3, R1h*v) << " ";
260 
261  switch (od) {
262  case EULER_123:
263  case EULER_313:
264  case EULER_321:
265  case ORIENTATION_VECTOR:
266  OH.Joints() << E;
267  break;
268 
269  case ORIENTATION_MATRIX:
270  OH.Joints() << R;
271  break;
272 
273  default:
274  /* impossible */
275  break;
276  }
277 
278 
280  OH.Joints() << " " << OmegaTmp;
281  }
282 
283  OH.Joints() << std::endl;
284  }
285  }
286 }
287 
288 void
290 {
291  if (bToBeOutput()) {
294  Mat3x3 R(R1h.MulTM(R2h));
295  Mat3x3 hat_R(R1h*RotManip::Rot(RotManip::VecRot(R)/2.));
296 
297  Vec3 v(GetF());
298  Joint::Output(OH.Joints(), "DeformableHinge", GetLabel(),
299  Zero3, v, Zero3, hat_R*v) << " ";
300 
301  switch (od) {
302  case EULER_123:
304  break;
305 
306  case EULER_313:
308  break;
309 
310  case EULER_321:
312  break;
313 
314  case ORIENTATION_VECTOR:
315  OH.Joints() << RotManip::VecRot(R);
316  break;
317 
318  case ORIENTATION_MATRIX:
319  OH.Joints() << R;
320  break;
321 
322  default:
323  /* impossible */
324  break;
325  }
326 
328  OH.Joints() << " " << hat_R.MulTV(pNode2->GetWCurr() - pNode1->GetWCurr());
329  }
330  OH.Joints() << std::endl;
331  }
332 }
333 
334 void
336  VectorHandler& /* XP */ )
337 {
338  bFirstRes = true;
339 
340  AfterPredict();
341 }
342 
343 void
347 {
348  if (ph) {
349  for (unsigned i = 0; i < ph->size(); i++) {
350  Joint::JointHint *pjh = dynamic_cast<Joint::JointHint *>((*ph)[i]);
351 
352  if (pjh) {
353  if (dynamic_cast<Joint::HingeHint<1> *>(pjh)) {
355 
356  } else if (dynamic_cast<Joint::HingeHint<2> *>(pjh)) {
358 
359  } else if (dynamic_cast<Joint::ReactionsHint *>(pjh)) {
360  /* TODO */
361  }
362 
363  continue;
364  }
365 
366  /* else, pass to constitutive law */
367  ConstitutiveLaw3DOwner::SetValue(pDM, X, XP, ph);
368  }
369  }
370 }
371 
372 /* inverse dynamics capable element */
373 bool
375 {
376  return true;
377 }
378 
379 void
381 {
382  AfterPredict();
383 }
384 
385 Hint *
387 {
388  if (strncasecmp(s, "hinge{" /*}*/, STRLENOF("hinge{" /*}*/)) == 0) {
389  s += STRLENOF("hinge{" /*}*/);
390 
391  if (strcmp(&s[1], /*{*/ "}") != 0) {
392  return 0;
393  }
394 
395  switch (s[0]) {
396  case '1':
397  return new Joint::HingeHint<1>;
398 
399  case '2':
400  return new Joint::HingeHint<2>;
401  }
402  }
403 
404  return ConstitutiveLaw3DOwner::ParseHint(pDM, s);
405 }
406 
407 unsigned int
409 {
411 }
412 
413 unsigned int
415 {
416  ASSERT(s != NULL);
417 
418  unsigned idx = 0;
419 
420  switch (s[0]) {
421  case 'r':
422  break;
423 
424  case 'w':
425  idx += 3;
426  break;
427 
428  case 'M':
429  idx += 6;
430  break;
431 
432  default:
433  {
434  const size_t l = STRLENOF("constitutiveLaw.");
435  if (strncmp(s, "constitutiveLaw.", l) == 0) {
437  if (idx > 0) {
438  return 9 + idx;
439  }
440  }
441  return 0;
442  }
443  }
444 
445  switch (s[1]) {
446  case 'x':
447  idx += 1;
448  break;
449 
450  case 'y':
451  idx += 2;
452  break;
453 
454  case 'z':
455  idx += 3;
456  break;
457 
458  default:
459  return 0;
460  }
461 
462  if (s[2] != '\0') {
463  return 0;
464  }
465 
466  return idx;
467 }
468 
471 {
472  ASSERT(i > 0);
473 
474  ASSERT(i <= iGetNumPrivData());
475 
476  switch (i) {
477  case 1:
478  case 2:
479  case 3:
480  {
481  /* NOTE: this is correct also in the invariant case */
484 
485  Vec3 v(RotManip::VecRot(R1h.MulTM(R2h)));
486 
487  return v(i);
488  }
489 
490  case 4:
491  case 5:
492  case 6:
493  {
495  Vec3 w(R1h.MulTV(pNode2->GetWCurr() - pNode1->GetWCurr()));
496 
497  return w(i - 3);
498  }
499 
500  case 7:
501  case 8:
502  case 9:
503  return GetF()(i - 6);
504 
505  default:
507  }
508 }
509 
512 {
513  ASSERT(i > 0);
514 
515  ASSERT(i <= iGetNumPrivData());
516 
517  switch (i) {
518  case 4:
519  case 5:
520  case 6:
521  {
524  Mat3x3 hat_R(R1h*RotManip::Rot(RotManip::VecRot(R1h.MulTM(R2h)/2.)));
525  Vec3 w(hat_R.MulTV(pNode2->GetWCurr() - pNode1->GetWCurr()));
526 
527  return w(i - 3);
528  }
529 
530  default:
531  /* fall back to regular one */
533  }
534 }
535 
536 /* DeformableHingeJoint - end */
537 
538 
539 /* ElasticHingeJoint - begin */
540 
542  const DofOwner* pDO,
543  const ConstitutiveLaw3D* pCL,
544  const StructNode* pN1,
545  const StructNode* pN2,
546  const Mat3x3& tilde_R1h,
547  const Mat3x3& tilde_R2h,
548  const OrientationDescription& od,
549  flag fOut)
550 : Elem(uL, fOut),
551 DeformableHingeJoint(uL, pDO, pCL, pN1, pN2, tilde_R1h, tilde_R2h, od, fOut),
552 ThetaRef(Zero3)
553 {
554  // force update of MDE/MDEPrime as needed
555  AfterPredict();
556 }
557 
559 {
560  NO_OP;
561 }
562 
563 void
565  const VectorHandler& XP)
566 {
568 }
569 
570 /* assemblaggio jacobiano */
573  doublereal dCoef,
574  const VectorHandler& /* XCurr */ ,
575  const VectorHandler& /* XPrimeCurr */ )
576 {
577  DEBUGCOUT("Entering ElasticHingeJoint::AssJac()" << std::endl);
578 
579  FullSubMatrixHandler& WM = WorkMat.SetFull();
580 
581  /* Dimensiona e resetta la matrice di lavoro */
582  integer iNumRows = 0;
583  integer iNumCols = 0;
584  WorkSpaceDim(&iNumRows, &iNumCols);
585  WM.ResizeReset(iNumRows, iNumCols);
586 
587  /* Recupera gli indici */
588  integer iNode1FirstPosIndex = pNode1->iGetFirstPositionIndex() + 3;
589  integer iNode1FirstMomIndex = pNode1->iGetFirstMomentumIndex() + 3;
590  integer iNode2FirstPosIndex = pNode2->iGetFirstPositionIndex() + 3;
591  integer iNode2FirstMomIndex = pNode2->iGetFirstMomentumIndex() + 3;
592 
593  /* Setta gli indici della matrice */
594  for (int iCnt = 1; iCnt <= 3; iCnt++) {
595  WM.PutRowIndex(iCnt, iNode1FirstMomIndex + iCnt);
596  WM.PutColIndex(iCnt, iNode1FirstPosIndex + iCnt);
597  WM.PutRowIndex(3 + iCnt, iNode2FirstMomIndex + iCnt);
598  WM.PutColIndex(3 + iCnt, iNode2FirstPosIndex + iCnt);
599  }
600 
601  AssMat(WM, dCoef);
602 
603  return WorkMat;
604 }
605 
606 /* assemblaggio jacobiano */
607 void
609  VariableSubMatrixHandler& WorkMatB,
610  const VectorHandler& /* XCurr */ ,
611  const VectorHandler& /* XPrimeCurr */ )
612 {
613  DEBUGCOUT("Entering ElasticHingeJoint::AssJac()" << std::endl);
614 
615  FullSubMatrixHandler& WMA = WorkMatA.SetFull();
616  WorkMatB.SetNullMatrix();
617 
618  /* Dimensiona e resetta la matrice di lavoro */
619  integer iNumRows = 0;
620  integer iNumCols = 0;
621  WorkSpaceDim(&iNumRows, &iNumCols);
622  WMA.ResizeReset(iNumRows, iNumCols);
623 
624  /* Recupera gli indici */
625  integer iNode1FirstPosIndex = pNode1->iGetFirstPositionIndex() + 3;
626  integer iNode1FirstMomIndex = pNode1->iGetFirstMomentumIndex() + 3;
627  integer iNode2FirstPosIndex = pNode2->iGetFirstPositionIndex() + 3;
628  integer iNode2FirstMomIndex = pNode2->iGetFirstMomentumIndex() + 3;
629 
630  /* Setta gli indici della matrice */
631  for (int iCnt = 1; iCnt <= 3; iCnt++) {
632  WMA.PutRowIndex(iCnt, iNode1FirstMomIndex + iCnt);
633  WMA.PutColIndex(iCnt, iNode1FirstPosIndex + iCnt);
634  WMA.PutRowIndex(3 + iCnt, iNode2FirstMomIndex + iCnt);
635  WMA.PutColIndex(3 + iCnt, iNode2FirstPosIndex + iCnt);
636  }
637 
638  AssMat(WMA, 1.);
639 }
640 
641 void
643 {
644  /* Calcola le deformazioni, aggiorna il legame costitutivo
645  * e crea la MDE */
646 
647  /* Recupera i dati */
648  Mat3x3 R1h(pNode1->GetRRef()*tilde_R1h);
649  Mat3x3 R2h(pNode2->GetRRef()*tilde_R2h);
650 
651  /* Calcola la deformazione corrente nel sistema locale (nodo a) */
652  ThetaCurr = ThetaRef = RotManip::VecRot(R1h.MulTM(R2h));
653 
654  /* Aggiorna il legame costitutivo */
656 
657  /* Calcola l'inversa di Gamma di ThetaRef */
658  Mat3x3 GammaRefm1 = RotManip::DRot_I(ThetaRef);
659 
660  /* Chiede la matrice tangente di riferimento e la porta
661  * nel sistema globale */
662  MDE = R1h*ConstitutiveLaw3DOwner::GetFDE()*GammaRefm1.MulMT(R1h);
663 }
664 
665 void
667 {
668 #if 0
669  // Calcola l'inversa di Gamma di ThetaRef
670  Mat3x3 GammaCurrm1 = RotManip::DRot_I(ThetaCurr);
671 
672  // Chiede la matrice tangente di riferimento e la porta
673  // nel sistema globale
674  MDE = R1h*ConstitutiveLaw3DOwner::GetFDE()*GammaCurrm1.MulMT(R1h);
675 #endif
676 
677  AssMatM(WMA, dCoef);
678  AssMatMDE(WMA, dCoef);
679 }
680 
681 /* assemblaggio residuo */
684  doublereal /* dCoef */ ,
685  const VectorHandler& /* XCurr */ ,
686  const VectorHandler& /* XPrimeCurr */ )
687 {
688  DEBUGCOUT("Entering ElasticHingeJoint::AssRes()" << std::endl);
689 
690  /* Dimensiona e resetta la matrice di lavoro */
691  integer iNumRows = 0;
692  integer iNumCols = 0;
693  WorkSpaceDim(&iNumRows, &iNumCols);
694  WorkVec.ResizeReset(iNumRows);
695 
696  /* Recupera gli indici */
697  integer iNode1FirstMomIndex = pNode1->iGetFirstMomentumIndex() + 3;
698  integer iNode2FirstMomIndex = pNode2->iGetFirstMomentumIndex() + 3;
699 
700  /* Setta gli indici della matrice */
701  for (int iCnt = 1; iCnt <= 3; iCnt++) {
702  WorkVec.PutRowIndex(iCnt, iNode1FirstMomIndex + iCnt);
703  WorkVec.PutRowIndex(3 + iCnt, iNode2FirstMomIndex + iCnt);
704  }
705 
706  AssVec(WorkVec);
707 
708  return WorkVec;
709 }
710 
711 /* Inverse Dynamics Jacobian matrix assembly */
714  const VectorHandler& XCurr)
715 {
716  ASSERT(bIsErgonomy());
717 
718  // HACK? Need to call AfterPredict() here to update MDE and so
719  AfterPredict();
720 
721  return AssJac(WorkMat, 1., XCurr, XCurr);
722 }
723 
724 /* Inverse Dynamics Residual Assembly */
727  const VectorHandler& /* XCurr */,
728  const VectorHandler& /* XPrimeCurr */,
729  const VectorHandler& /* XPrimePrimeCurr */,
730  InverseDynamics::Order iOrder)
731 {
732  DEBUGCOUT("Entering ElasticHingeJoint::AssRes()" << std::endl);
733 
735  || (iOrder == InverseDynamics::POSITION && bIsErgonomy()));
736 
737  /* There is no need to call AfterPredict, everything is done in AssVec*/
738  bFirstRes = false;
739 
740  /* Dimensiona e resetta la matrice di lavoro */
741  integer iNumRows = 0;
742  integer iNumCols = 0;
743  WorkSpaceDim(&iNumRows, &iNumCols);
744  WorkVec.ResizeReset(iNumRows);
745 
746  /* Recupera gli indici */
747  integer iNode1FirstMomIndex = pNode1->iGetFirstPositionIndex() + 3;
748  integer iNode2FirstMomIndex = pNode2->iGetFirstPositionIndex() + 3;
749 
750  /* Setta gli indici della matrice */
751  for (int iCnt = 1; iCnt <= 3; iCnt++) {
752  WorkVec.PutRowIndex(iCnt, iNode1FirstMomIndex + iCnt);
753  WorkVec.PutRowIndex(3 + iCnt, iNode2FirstMomIndex + iCnt);
754  }
755 
756  AssVec(WorkVec);
757 
758  return WorkVec;
759 }
760 
761 /* Inverse Dynamics update */
762 void
764 {
765  NO_OP;
766 }
767 
768 /* Inverse Dynamics after convergence */
769 void
771  const VectorHandler& XP, const VectorHandler& XPP)
772 {
774 }
775 
776 void
778 {
780 
781  if (bFirstRes) {
782  bFirstRes = false;
783 
784  } else {
786  ThetaCurr = RotManip::VecRot(R1h.MulTM(R2h));
788  }
789 
790  /* Couple attached to node 1 */
791  M = R1h*GetF();
792 
793  WorkVec.Add(1, M);
794  WorkVec.Sub(4, M);
795 }
796 
797 /* Contributo allo jacobiano durante l'assemblaggio iniziale */
800  const VectorHandler& /* XCurr */ )
801 {
802  DEBUGCOUT("Entering ElasticHingeJoint::InitialAssJac()" << std::endl);
803 
804  FullSubMatrixHandler& WM = WorkMat.SetFull();
805 
806  /* Dimensiona e resetta la matrice di lavoro */
807  integer iNumRows = 0;
808  integer iNumCols = 0;
809  InitialWorkSpaceDim(&iNumRows, &iNumCols);
810  WM.ResizeReset(iNumRows, iNumCols);
811 
812  /* Recupera gli indici */
813  integer iNode1FirstPosIndex = pNode1->iGetFirstPositionIndex() + 3;
814  integer iNode2FirstPosIndex = pNode2->iGetFirstPositionIndex() + 3;
815 
816  /* Setta gli indici della matrice */
817  for (int iCnt = 1; iCnt <= 3; iCnt++) {
818  WM.PutRowIndex(iCnt, iNode1FirstPosIndex + iCnt);
819  WM.PutColIndex(iCnt, iNode1FirstPosIndex + iCnt);
820  WM.PutRowIndex(3 + iCnt, iNode2FirstPosIndex + iCnt);
821  WM.PutColIndex(3 + iCnt, iNode2FirstPosIndex + iCnt);
822  }
823 
824  AssMat(WM, 1.);
825 
826  return WorkMat;
827 }
828 
829 /* Contributo al residuo durante l'assemblaggio iniziale */
832  const VectorHandler& /* XCurr */ )
833 {
834  /* Dimensiona e resetta la matrice di lavoro */
835  integer iNumRows = 0;
836  integer iNumCols = 0;
837  InitialWorkSpaceDim(&iNumRows, &iNumCols);
838  WorkVec.ResizeReset(iNumRows);
839 
840  /* Recupera gli indici */
841  integer iNode1FirstPosIndex = pNode1->iGetFirstPositionIndex() + 3;
842  integer iNode2FirstPosIndex = pNode2->iGetFirstPositionIndex() + 3;
843 
844  /* Setta gli indici della matrice */
845  for (int iCnt = 1; iCnt <= 3; iCnt++) {
846  WorkVec.PutRowIndex(iCnt, iNode1FirstPosIndex + iCnt);
847  WorkVec.PutRowIndex(3 + iCnt, iNode2FirstPosIndex + iCnt);
848  }
849 
850  AssVec(WorkVec);
851 
852  return WorkVec;
853 }
854 
855 /* ElasticHingeJoint - end */
856 
857 
858 /* ElasticHingeJointInv - begin */
859 
860 void
862 {
863  /* Recupera i dati */
864  Mat3x3 R1h(pNode1->GetRRef()*tilde_R1h);
865  Mat3x3 R2h(pNode2->GetRRef()*tilde_R2h);
866  ThetaCurr = ThetaRef = RotManip::VecRot(R1h.MulTM(R2h));
867 
868  /* Aggiorna il legame costitutivo */
870 
871  Mat3x3 tilde_R(RotManip::Rot(ThetaRef/2.));
872  Mat3x3 hat_R(R1h*tilde_R);
873 
874  /* Calcola l'inversa di Gamma di ThetaRef */
875  Mat3x3 GammaRefm1 = RotManip::DRot_I(ThetaRef);
876 
877  /* Chiede la matrice tangente di riferimento e la porta
878  * nel sistema globale */
879  MDE = hat_R*ConstitutiveLaw3DOwner::GetFDE()*GammaRefm1.MulMT(R1h);
880 
881  hat_I = hat_R*(Eye3 + tilde_R).Inv().MulMT(hat_R);
882  hat_IT = hat_I.Transpose();
883 }
884 
886  const DofOwner* pDO,
887  const ConstitutiveLaw3D* pCL,
888  const StructNode* pN1,
889  const StructNode* pN2,
890  const Mat3x3& tilde_R1h,
891  const Mat3x3& tilde_R2h,
892  const OrientationDescription& od,
893  flag fOut)
894 : Elem(uL, fOut),
895 ElasticHingeJoint(uL, pDO, pCL, pN1, pN2, tilde_R1h, tilde_R2h, od, fOut)
896 {
897  NO_OP;
898 }
899 
901 {
902  NO_OP;
903 }
904 
905 void
907 {
909 }
910 
911 void
913 {
915 
916  if (bFirstRes) {
917  /* ThetaCurr and the constitutive laws were updated
918  * by AfterPredict */
919  bFirstRes = false;
920 
921  } else {
923  ThetaCurr = RotManip::VecRot(R1h.MulTM(R2h));
924 
925  /* aggiorna il legame costitutivo */
927  }
928 
929  Mat3x3 hat_R(R1h*RotManip::Rot(ThetaCurr/2.));
930  M = hat_R*GetF();
931 
932  WorkVec.Add(1, M);
933  WorkVec.Sub(4, M);
934 }
935 
936 void
938 {
940 }
941 
944 {
946 }
947 
948 /* ElasticHingeJointInv - end */
949 
950 
951 /* ViscousHingeJoint - begin */
952 
954  const DofOwner* pDO,
955  const ConstitutiveLaw3D* pCL,
956  const StructNode* pN1,
957  const StructNode* pN2,
958  const Mat3x3& tilde_R1h,
959  const Mat3x3& tilde_R2h,
960  const OrientationDescription& od,
961  flag fOut)
962 : Elem(uL, fOut),
963 DeformableHingeJoint(uL, pDO, pCL, pN1, pN2, tilde_R1h, tilde_R2h, od, fOut)
964 {
965  // force update of MDE/MDEPrime as needed
966  AfterPredict();
967 }
968 
970 {
971  NO_OP;
972 }
973 
974 void
976  const VectorHandler& XP)
977 {
979 }
980 
981 void
983 {
984  /* Calcola le deformazioni, aggiorna il legame costitutivo
985  * e crea la MDE */
986 
987  /* Recupera i dati */
988  Mat3x3 R1h(pNode1->GetRRef()*tilde_R1h);
989 
990  /* Aggiorna il legame costitutivo */
991  Omega = R1h.MulTV(pNode2->GetWRef() - pNode1->GetWRef());
993 
994  /* Chiede la matrice tangente di riferimento e la porta
995  * nel sistema globale */
996  MDEPrime = R1h*GetFDEPrime().MulMT(R1h);
997 }
998 
999 /* assemblaggio jacobiano */
1002  doublereal dCoef,
1003  const VectorHandler& /* XCurr */ ,
1004  const VectorHandler& /* XPrimeCurr */ )
1005 {
1006  FullSubMatrixHandler& WM = WorkMat.SetFull();
1007 
1008  /* Dimensiona e resetta la matrice di lavoro */
1009  integer iNumRows = 0;
1010  integer iNumCols = 0;
1011  WorkSpaceDim(&iNumRows, &iNumCols);
1012  WM.ResizeReset(iNumRows, iNumCols);
1013 
1014  /* Recupera gli indici */
1015  integer iNode1FirstPosIndex = pNode1->iGetFirstPositionIndex() + 3;
1016  integer iNode1FirstMomIndex = pNode1->iGetFirstMomentumIndex() + 3;
1017  integer iNode2FirstPosIndex = pNode2->iGetFirstPositionIndex() + 3;
1018  integer iNode2FirstMomIndex = pNode2->iGetFirstMomentumIndex() + 3;
1019 
1020  /* Setta gli indici della matrice */
1021  for (int iCnt = 1; iCnt <= 3; iCnt++) {
1022  WM.PutRowIndex(iCnt, iNode1FirstMomIndex + iCnt);
1023  WM.PutColIndex(iCnt, iNode1FirstPosIndex + iCnt);
1024  WM.PutRowIndex(3 + iCnt, iNode2FirstMomIndex + iCnt);
1025  WM.PutColIndex(3 + iCnt, iNode2FirstPosIndex + iCnt);
1026  }
1027 
1028  AssMats(WM, WM, dCoef);
1029 
1030  return WorkMat;
1031 }
1032 
1033 /* assemblaggio jacobiano */
1034 void
1036  VariableSubMatrixHandler& WorkMatB,
1037  const VectorHandler& /* XCurr */ ,
1038  const VectorHandler& /* XPrimeCurr */ )
1039 {
1040  FullSubMatrixHandler& WMA = WorkMatA.SetFull();
1041  FullSubMatrixHandler& WMB = WorkMatB.SetFull();
1042 
1043  /* Dimensiona e resetta la matrice di lavoro */
1044  integer iNumRows = 0;
1045  integer iNumCols = 0;
1046  WorkSpaceDim(&iNumRows, &iNumCols);
1047  WMA.ResizeReset(iNumRows, iNumCols);
1048  WMB.ResizeReset(iNumRows, iNumCols);
1049 
1050  /* Recupera gli indici */
1051  integer iNode1FirstPosIndex = pNode1->iGetFirstPositionIndex() + 3;
1052  integer iNode1FirstMomIndex = pNode1->iGetFirstMomentumIndex() + 3;
1053  integer iNode2FirstPosIndex = pNode2->iGetFirstPositionIndex() + 3;
1054  integer iNode2FirstMomIndex = pNode2->iGetFirstMomentumIndex() + 3;
1055 
1056  /* Setta gli indici della matrice */
1057  for (int iCnt = 1; iCnt <= 3; iCnt++) {
1058  WMA.PutRowIndex(iCnt, iNode1FirstMomIndex + iCnt);
1059  WMA.PutColIndex(iCnt, iNode1FirstPosIndex + iCnt);
1060  WMA.PutRowIndex(3 + iCnt, iNode2FirstMomIndex + iCnt);
1061  WMA.PutColIndex(3 + iCnt, iNode2FirstPosIndex + iCnt);
1062 
1063  WMB.PutRowIndex(iCnt, iNode1FirstMomIndex + iCnt);
1064  WMB.PutColIndex(iCnt, iNode1FirstPosIndex + iCnt);
1065  WMB.PutRowIndex(3 + iCnt, iNode2FirstMomIndex + iCnt);
1066  WMB.PutColIndex(3 + iCnt, iNode2FirstPosIndex + iCnt);
1067  }
1068 
1069  AssMats(WMA, WMA, 1.);
1070 }
1071 
1072 /* assemblaggio jacobiano */
1073 void
1075  FullSubMatrixHandler& WMB,
1076  doublereal dCoef)
1077 {
1078  AssMatM(WMA, dCoef);
1079  AssMatMDEPrime(WMA, WMB, dCoef);
1080 }
1081 
1082 /* assemblaggio residuo */
1085  doublereal /* dCoef */ ,
1086  const VectorHandler& /* XCurr */ ,
1087  const VectorHandler& /* XPrimeCurr */ )
1088 {
1089  /* Dimensiona e resetta la matrice di lavoro */
1090  integer iNumRows = 0;
1091  integer iNumCols = 0;
1092  WorkSpaceDim(&iNumRows, &iNumCols);
1093  WorkVec.ResizeReset(iNumRows);
1094 
1095  /* Recupera gli indici */
1096  integer iNode1FirstMomIndex = pNode1->iGetFirstMomentumIndex() + 3;
1097  integer iNode2FirstMomIndex = pNode2->iGetFirstMomentumIndex() + 3;
1098 
1099  /* Setta gli indici della matrice */
1100  for (int iCnt = 1; iCnt <= 3; iCnt++) {
1101  WorkVec.PutRowIndex(iCnt, iNode1FirstMomIndex + iCnt);
1102  WorkVec.PutRowIndex(3 + iCnt, iNode2FirstMomIndex + iCnt);
1103  }
1104 
1105  AssVec(WorkVec);
1106 
1107  return WorkVec;
1108 }
1109 
1110 /* Inverse Dynamics Residual Assembly */
1113  const VectorHandler& /* XCurr */,
1114  const VectorHandler& /* XPrimeCurr */,
1115  const VectorHandler& /* XPrimePrimeCurr */,
1116  InverseDynamics::Order iOrder)
1117 {
1119 
1120  bFirstRes = false;
1121 
1122  /* Dimensiona e resetta la matrice di lavoro */
1123  integer iNumRows = 0;
1124  integer iNumCols = 0;
1125  WorkSpaceDim(&iNumRows, &iNumCols);
1126  WorkVec.ResizeReset(iNumRows);
1127 
1128  /* Recupera gli indici */
1129  integer iNode1FirstMomIndex = pNode1->iGetFirstPositionIndex() + 3;
1130  integer iNode2FirstMomIndex = pNode2->iGetFirstPositionIndex() + 3;
1131 
1132  /* Setta gli indici della matrice */
1133  for (int iCnt = 1; iCnt <= 3; iCnt++) {
1134  WorkVec.PutRowIndex(iCnt, iNode1FirstMomIndex + iCnt);
1135  WorkVec.PutRowIndex(3 + iCnt, iNode2FirstMomIndex + iCnt);
1136  }
1137 
1138  AssVec(WorkVec);
1139 
1140  return WorkVec;
1141 }
1142 
1143 /* assemblaggio residuo */
1144 void
1146 {
1147  Mat3x3 R1h(pNode1->GetRCurr()*tilde_R1h);
1148 
1149  if (bFirstRes) {
1150  bFirstRes = false;
1151 
1152  } else {
1153  Omega = R1h.MulTV(pNode2->GetWCurr() - pNode1->GetWCurr());
1154 
1156  }
1157 
1159 
1160  WorkVec.Add(1, M);
1161  WorkVec.Sub(4, M);
1162 }
1163 
1164 /* Contributo allo jacobiano durante l'assemblaggio iniziale */
1167  const VectorHandler& /* XCurr */ )
1168 {
1169  FullSubMatrixHandler& WM = WorkMat.SetFull();
1170 
1171  /* Dimensiona e resetta la matrice di lavoro */
1172  integer iNumRows = 0;
1173  integer iNumCols = 0;
1174  InitialWorkSpaceDim(&iNumRows, &iNumCols);
1175  WM.ResizeReset(iNumRows, iNumCols);
1176 
1177  /* Recupera gli indici */
1178  integer iNode1FirstPosIndex = pNode1->iGetFirstPositionIndex() + 3;
1179  integer iNode1FirstVelIndex = iNode1FirstPosIndex + 6;
1180  integer iNode2FirstPosIndex = pNode2->iGetFirstPositionIndex() + 3;
1181  integer iNode2FirstVelIndex = iNode2FirstPosIndex + 6;
1182 
1183  /* Setta gli indici della matrice */
1184  for (int iCnt = 1; iCnt <= 3; iCnt++) {
1185  WM.PutRowIndex(iCnt, iNode1FirstPosIndex + iCnt);
1186  WM.PutColIndex(iCnt, iNode1FirstPosIndex + iCnt);
1187  WM.PutColIndex(3 + iCnt, iNode1FirstVelIndex + iCnt);
1188 
1189  WM.PutRowIndex(3 + iCnt, iNode2FirstPosIndex + iCnt);
1190  WM.PutColIndex(6 + iCnt, iNode2FirstPosIndex + iCnt);
1191  WM.PutColIndex(9 + iCnt, iNode2FirstVelIndex + iCnt);
1192  }
1193 
1194  Mat3x3 R1h(pNode1->GetRCurr()*tilde_R1h);
1195 
1196  const Vec3& W2(pNode2->GetWCurr());
1197 
1198  MDEPrime = R1h*ConstitutiveLaw3DOwner::GetFDEPrime().MulMT(R1h);
1199 
1200  Mat3x3 Tmp(MDEPrime*Mat3x3(MatCross, W2));
1201  WM.Add(4, 7, Tmp);
1202  WM.Sub(1, 7, Tmp);
1203 
1205  WM.Add(1, 1, Tmp);
1206  WM.Sub(4, 1, Tmp);
1207 
1208  WM.Add(1, 4, MDEPrime);
1209  WM.Add(4, 10, MDEPrime);
1210 
1211  WM.Sub(1, 10, MDEPrime);
1212  WM.Sub(4, 4, MDEPrime);
1213 
1214  return WorkMat;
1215 }
1216 
1217 /* Contributo al residuo durante l'assemblaggio iniziale */
1220  const VectorHandler& /* XCurr */ )
1221 {
1222  /* Dimensiona e resetta la matrice di lavoro */
1223  integer iNumRows = 0;
1224  integer iNumCols = 0;
1225  InitialWorkSpaceDim(&iNumRows, &iNumCols);
1226  WorkVec.ResizeReset(iNumRows);
1227 
1228  /* Recupera gli indici */
1229  integer iNode1FirstPosIndex = pNode1->iGetFirstPositionIndex() + 3;
1230  integer iNode2FirstPosIndex = pNode2->iGetFirstPositionIndex() + 3;
1231 
1232  /* Setta gli indici della matrice */
1233  for (int iCnt = 1; iCnt <= 3; iCnt++) {
1234  WorkVec.PutRowIndex(iCnt, iNode1FirstPosIndex + iCnt);
1235  WorkVec.PutRowIndex(3 + iCnt, iNode2FirstPosIndex + iCnt);
1236  }
1237 
1238  Mat3x3 R1h(pNode1->GetRCurr()*tilde_R1h);
1239 
1240  if (bFirstRes) {
1241  bFirstRes = false;
1242 
1243  } else {
1244  Omega = R1h.MulTV(pNode2->GetWCurr() - pNode1->GetWCurr());
1245 
1247  }
1248 
1250 
1251  WorkVec.Add(1, M);
1252  WorkVec.Sub(4, M);
1253 
1254  return WorkVec;
1255 }
1256 
1257 /* ViscousHingeJoint - end */
1258 
1259 
1260 /* ViscousHingeJointInv - begin */
1261 
1263  const DofOwner* pDO,
1264  const ConstitutiveLaw3D* pCL,
1265  const StructNode* pN1,
1266  const StructNode* pN2,
1267  const Mat3x3& tilde_R1h,
1268  const Mat3x3& tilde_R2h,
1269  const OrientationDescription& od,
1270  flag fOut)
1271 : Elem(uL, fOut),
1272 ViscousHingeJoint(uL, pDO, pCL, pN1, pN2, tilde_R1h, tilde_R2h, od, fOut)
1273 {
1274  NO_OP;
1275 }
1276 
1278 {
1279  NO_OP;
1280 }
1281 
1282 void
1284 {
1285  /* Calcola le deformazioni, aggiorna il legame costitutivo
1286  * e crea la MDE */
1287 
1288  /* Recupera i dati */
1289  Mat3x3 R1h(pNode1->GetRRef()*tilde_R1h);
1290  Mat3x3 R2h(pNode2->GetRRef()*tilde_R2h);
1291  Vec3 tilde_Theta(RotManip::VecRot(R1h.MulTM(R2h))/2.);
1292  Mat3x3 tilde_R(RotManip::Rot(tilde_Theta));
1293  Mat3x3 hat_R(R1h*tilde_R);
1294 
1295  /* Aggiorna il legame costitutivo */
1296  Omega = hat_R.MulTV(pNode2->GetWRef() - pNode1->GetWRef());
1298 
1299  /* Chiede la matrice tangente di riferimento e la porta
1300  * nel sistema globale */
1301  /* FIXME: Jacobian matrix not implemented yet */
1302  MDEPrime = hat_R*GetFDEPrime().MulMT(hat_R);
1303 
1304  hat_I = hat_R*(Eye3 + tilde_R).Inv().MulMT(hat_R);
1305  hat_IT = hat_I.Transpose();
1306 }
1307 
1308 void
1310 {
1312 }
1313 
1314 void
1316  FullSubMatrixHandler& WMB, doublereal dCoef)
1317 {
1318  DeformableHingeJoint::AssMatMDEPrimeInv(WMA, WMB, dCoef);
1319 }
1320 
1321 /* assemblaggio residuo */
1322 void
1324 {
1325  Mat3x3 R1h(pNode1->GetRCurr()*tilde_R1h);
1326  Mat3x3 R2h(pNode2->GetRCurr()*tilde_R2h);
1327  Vec3 tilde_Theta(RotManip::VecRot(R1h.MulTM(R2h))/2.);
1328  Mat3x3 hat_R(R1h*RotManip::Rot(tilde_Theta));
1329 
1330  if (bFirstRes) {
1331  bFirstRes = false;
1332 
1333  } else {
1334  /* velocita' relativa nel riferimento intermedio */
1335  Omega = hat_R.MulTV(pNode2->GetWCurr() - pNode1->GetWCurr());
1336 
1337  /* aggiorna la legge costitutiva */
1339  }
1340 
1341  M = hat_R*GetF();
1342 
1343  WorkVec.Add(1, M);
1344  WorkVec.Sub(4, M);
1345 }
1346 
1347 void
1349 {
1351 }
1352 
1353 doublereal
1355 {
1357 }
1358 
1359 /* ViscousHingeJointInv - end */
1360 
1361 
1362 /* ViscoElasticHingeJoint - begin */
1363 
1365  const DofOwner* pDO,
1366  const ConstitutiveLaw3D* pCL,
1367  const StructNode* pN1,
1368  const StructNode* pN2,
1369  const Mat3x3& tilde_R1h,
1370  const Mat3x3& tilde_R2h,
1371  const OrientationDescription& od,
1372  flag fOut)
1373 : Elem(uL, fOut),
1374 DeformableHingeJoint(uL, pDO, pCL, pN1, pN2, tilde_R1h, tilde_R2h, od, fOut),
1375 ThetaRef(Zero3)
1376 {
1377  // force update of MDE/MDEPrime as needed
1378  AfterPredict();
1379 }
1380 
1382 {
1383  NO_OP;
1384 }
1385 
1386 void
1388  const VectorHandler& XP)
1389 {
1391 }
1392 
1393 void
1395 {
1396  /* Computes strains, updates constitutive law and generates
1397  * MDE and MDEPrime */
1398 
1399  Mat3x3 R1h(pNode1->GetRRef()*tilde_R1h);
1400  Mat3x3 R2h(pNode2->GetRRef()*tilde_R2h);
1401 
1402  /* Current strain in material reference frame (node 1) */
1403  ThetaCurr = ThetaRef = RotManip::VecRot(R1h.MulTM(R2h));
1404 
1405  /* Relative angular velocity */
1406  Omega = R1h.MulTV(pNode2->GetWRef() - pNode1->GetWRef());
1407 
1408  /* Updates constitutive law */
1410 
1411  /* don't repeat the above operations during AssRes */
1412  bFirstRes = true;
1413 
1414  /* Inverse of Gamma(ThetaRef) */
1415  Mat3x3 GammaRefm1 = RotManip::DRot_I(ThetaRef);
1416 
1417  /* Tangent matrices are updated and projected in the global
1418  * reference frame; they won't change during the solution
1419  * of the current time step, according to the updated-updated
1420  * approach */
1421  MDE = R1h*ConstitutiveLaw3DOwner::GetFDE()*GammaRefm1.MulMT(R1h);
1422  MDEPrime = R1h*GetFDEPrime().MulMT(R1h);
1423 }
1424 
1425 /* assemblaggio jacobiano */
1428  doublereal dCoef,
1429  const VectorHandler& /* XCurr */ ,
1430  const VectorHandler& /* XPrimeCurr */ )
1431 {
1432  FullSubMatrixHandler& WM = WorkMat.SetFull();
1433 
1434  /* Dimensiona e resetta la matrice di lavoro */
1435  integer iNumRows = 0;
1436  integer iNumCols = 0;
1437  WorkSpaceDim(&iNumRows, &iNumCols);
1438  WM.ResizeReset(iNumRows, iNumCols);
1439 
1440  /* Recupera gli indici */
1441  integer iNode1FirstPosIndex = pNode1->iGetFirstPositionIndex() + 3;
1442  integer iNode1FirstMomIndex = pNode1->iGetFirstMomentumIndex() + 3;
1443  integer iNode2FirstPosIndex = pNode2->iGetFirstPositionIndex() + 3;
1444  integer iNode2FirstMomIndex = pNode2->iGetFirstMomentumIndex() + 3;
1445 
1446  /* Setta gli indici della matrice */
1447  for (int iCnt = 1; iCnt <= 3; iCnt++) {
1448  WM.PutRowIndex(iCnt, iNode1FirstMomIndex + iCnt);
1449  WM.PutColIndex(iCnt, iNode1FirstPosIndex + iCnt);
1450  WM.PutRowIndex(3 + iCnt, iNode2FirstMomIndex + iCnt);
1451  WM.PutColIndex(3 + iCnt, iNode2FirstPosIndex + iCnt);
1452  }
1453 
1454  AssMats(WM, WM, dCoef);
1455 
1456  return WorkMat;
1457 }
1458 
1459 /* assemblaggio jacobiano */
1460 void
1462  VariableSubMatrixHandler& WorkMatB,
1463  const VectorHandler& /* XCurr */ ,
1464  const VectorHandler& /* XPrimeCurr */ )
1465 {
1466  FullSubMatrixHandler& WMA = WorkMatA.SetFull();
1467  FullSubMatrixHandler& WMB = WorkMatB.SetFull();
1468 
1469  /* Dimensiona e resetta la matrice di lavoro */
1470  integer iNumRows = 0;
1471  integer iNumCols = 0;
1472  WorkSpaceDim(&iNumRows, &iNumCols);
1473  WMA.ResizeReset(iNumRows, iNumCols);
1474  WMB.ResizeReset(iNumRows, iNumCols);
1475 
1476  /* Recupera gli indici */
1477  integer iNode1FirstPosIndex = pNode1->iGetFirstPositionIndex() + 3;
1478  integer iNode1FirstMomIndex = pNode1->iGetFirstMomentumIndex() + 3;
1479  integer iNode2FirstPosIndex = pNode2->iGetFirstPositionIndex() + 3;
1480  integer iNode2FirstMomIndex = pNode2->iGetFirstMomentumIndex() + 3;
1481 
1482  /* Setta gli indici della matrice */
1483  for (int iCnt = 1; iCnt <= 3; iCnt++) {
1484  WMA.PutRowIndex(iCnt, iNode1FirstMomIndex + iCnt);
1485  WMA.PutColIndex(iCnt, iNode1FirstPosIndex + iCnt);
1486  WMA.PutRowIndex(3 + iCnt, iNode2FirstMomIndex + iCnt);
1487  WMA.PutColIndex(3 + iCnt, iNode2FirstPosIndex + iCnt);
1488 
1489  WMB.PutRowIndex(iCnt, iNode1FirstMomIndex + iCnt);
1490  WMB.PutColIndex(iCnt, iNode1FirstPosIndex + iCnt);
1491  WMB.PutRowIndex(3 + iCnt, iNode2FirstMomIndex + iCnt);
1492  WMB.PutColIndex(3 + iCnt, iNode2FirstPosIndex + iCnt);
1493  }
1494 
1495  AssMats(WMA, WMB, 1.);
1496 }
1497 
1498 /* assemblaggio jacobiano */
1499 void
1501  FullSubMatrixHandler& WMB,
1502  doublereal dCoef)
1503 {
1504  AssMatM(WMA, dCoef);
1505  AssMatMDE(WMA, dCoef);
1506  AssMatMDEPrime(WMA, WMB, dCoef);
1507 }
1508 
1509 /* assemblaggio residuo */
1512  doublereal /* dCoef */ ,
1513  const VectorHandler& /* XCurr */ ,
1514  const VectorHandler& /* XPrimeCurr */ )
1515 {
1516  /* Dimensiona e resetta la matrice di lavoro */
1517  integer iNumRows = 0;
1518  integer iNumCols = 0;
1519  WorkSpaceDim(&iNumRows, &iNumCols);
1520  WorkVec.ResizeReset(iNumRows);
1521 
1522  /* Recupera gli indici */
1523  integer iNode1FirstMomIndex = pNode1->iGetFirstMomentumIndex() + 3;
1524  integer iNode2FirstMomIndex = pNode2->iGetFirstMomentumIndex() + 3;
1525 
1526  /* Setta gli indici della matrice */
1527  for (int iCnt = 1; iCnt <= 3; iCnt++) {
1528  WorkVec.PutRowIndex(iCnt, iNode1FirstMomIndex + iCnt);
1529  WorkVec.PutRowIndex(3 + iCnt, iNode2FirstMomIndex + iCnt);
1530  }
1531 
1532  AssVec(WorkVec);
1533 
1534  return WorkVec;
1535 }
1536 
1537 /* Inverse Dynamics Residual Assembly */
1540  const VectorHandler& /* XCurr */,
1541  const VectorHandler& /* XPrimeCurr */,
1542  const VectorHandler& /* XPrimePrimeCurr */,
1543  InverseDynamics::Order iOrder)
1544 {
1546 
1547  bFirstRes = false;
1548 
1549  /* Dimensiona e resetta la matrice di lavoro */
1550  integer iNumRows = 0;
1551  integer iNumCols = 0;
1552  WorkSpaceDim(&iNumRows, &iNumCols);
1553  WorkVec.ResizeReset(iNumRows);
1554 
1555  /* Recupera gli indici */
1556  integer iNode1FirstMomIndex = pNode1->iGetFirstPositionIndex() + 3;
1557  integer iNode2FirstMomIndex = pNode2->iGetFirstPositionIndex() + 3;
1558 
1559  /* Setta gli indici della matrice */
1560  for (int iCnt = 1; iCnt <= 3; iCnt++) {
1561  WorkVec.PutRowIndex(iCnt, iNode1FirstMomIndex + iCnt);
1562  WorkVec.PutRowIndex(3 + iCnt, iNode2FirstMomIndex + iCnt);
1563  }
1564 
1565  AssVec(WorkVec);
1566 
1567  return WorkVec;
1568 }
1569 
1570 /* assemblaggio residuo */
1571 void
1573 {
1574  Mat3x3 R1h(pNode1->GetRCurr()*tilde_R1h);
1575 
1576  if (bFirstRes) {
1577  bFirstRes = false;
1578 
1579  } else {
1580  Mat3x3 R2h(pNode2->GetRCurr()*tilde_R2h);
1581 
1582  /* orientazione intermedia */
1583  ThetaCurr = RotManip::VecRot(R1h.MulTM(R2h));
1584 
1585  /* velocita' relativa nel riferimento intermedio */
1586  Omega = R1h.MulTV(pNode2->GetWCurr() - pNode1->GetWCurr());
1587 
1588  /* aggiorna il legame costitutivo */
1589  ConstitutiveLaw3DOwner::Update(ThetaCurr, Omega);
1590  }
1591 
1593 
1594  WorkVec.Add(1, M);
1595  WorkVec.Sub(4, M);
1596 }
1597 
1598 /* Contributo allo jacobiano durante l'assemblaggio iniziale */
1601  const VectorHandler& /* XCurr */ )
1602 {
1603  FullSubMatrixHandler& WM = WorkMat.SetFull();
1604 
1605  /* Dimensiona e resetta la matrice di lavoro */
1606  integer iNumRows = 0;
1607  integer iNumCols = 0;
1608  InitialWorkSpaceDim(&iNumRows, &iNumCols);
1609  WM.ResizeReset(iNumRows, iNumCols);
1610 
1611  /* Recupera gli indici */
1612  integer iNode1FirstPosIndex = pNode1->iGetFirstPositionIndex() + 3;
1613  integer iNode1FirstVelIndex = iNode1FirstPosIndex + 6;
1614  integer iNode2FirstPosIndex = pNode2->iGetFirstPositionIndex() + 3;
1615  integer iNode2FirstVelIndex = iNode2FirstPosIndex + 6;
1616 
1617  /* Setta gli indici della matrice */
1618  for (int iCnt = 1; iCnt <= 3; iCnt++) {
1619  WM.PutRowIndex(iCnt, iNode1FirstPosIndex + iCnt);
1620  WM.PutColIndex(iCnt, iNode1FirstPosIndex + iCnt);
1621  WM.PutColIndex(3 + iCnt, iNode1FirstVelIndex + iCnt);
1622 
1623  WM.PutRowIndex(3 + iCnt, iNode2FirstPosIndex + iCnt);
1624  WM.PutColIndex(6 + iCnt, iNode2FirstPosIndex + iCnt);
1625  WM.PutColIndex(9 + iCnt, iNode2FirstVelIndex + iCnt);
1626  }
1627 
1628  Mat3x3 R1h(pNode1->GetRCurr()*tilde_R1h);
1629  const Vec3& W2(pNode2->GetWCurr());
1630 
1631  MDE = R1h*ConstitutiveLaw3DOwner::GetFDE().MulMT(R1h);
1632  MDEPrime = R1h*ConstitutiveLaw3DOwner::GetFDEPrime().MulMT(R1h);
1633 
1634  Mat3x3 Tmp(MDE + MDEPrime*Mat3x3(MatCross, W2));
1635  WM.Add(4, 7, Tmp);
1636  WM.Sub(1, 7, Tmp);
1637 
1639  WM.Add(1, 1, Tmp);
1640  WM.Sub(4, 1, Tmp);
1641 
1642  WM.Add(1, 4, MDEPrime);
1643  WM.Add(4, 10, MDEPrime);
1644 
1645  WM.Sub(1, 10, MDEPrime);
1646  WM.Sub(4, 4, MDEPrime);
1647 
1648  return WorkMat;
1649 }
1650 
1651 /* Contributo al residuo durante l'assemblaggio iniziale */
1654  const VectorHandler& /* XCurr */ )
1655 {
1656  /* Dimensiona e resetta la matrice di lavoro */
1657  integer iNumRows = 0;
1658  integer iNumCols = 0;
1659  InitialWorkSpaceDim(&iNumRows, &iNumCols);
1660  WorkVec.ResizeReset(iNumRows);
1661 
1662  /* Recupera gli indici */
1663  integer iNode1FirstPosIndex = pNode1->iGetFirstPositionIndex() + 3;
1664  integer iNode2FirstPosIndex = pNode2->iGetFirstPositionIndex() + 3;
1665 
1666  /* Setta gli indici della matrice */
1667  for (int iCnt = 1; iCnt <= 3; iCnt++) {
1668  WorkVec.PutRowIndex(iCnt, iNode1FirstPosIndex + iCnt);
1669  WorkVec.PutRowIndex(3 + iCnt, iNode2FirstPosIndex + iCnt);
1670  }
1671 
1672  Mat3x3 R1h(pNode1->GetRCurr()*tilde_R1h);
1673 
1674  if (bFirstRes) {
1675  bFirstRes = false;
1676 
1677  } else {
1678  Mat3x3 R2h(pNode2->GetRCurr()*tilde_R2h);
1679 
1680  ThetaCurr = RotManip::VecRot(R1h.MulTM(R2h));
1681  Omega = R1h.MulTV(pNode2->GetWCurr() - pNode1->GetWCurr());
1682 
1683  ConstitutiveLaw3DOwner::Update(ThetaCurr, Omega);
1684  }
1685 
1687 
1688  WorkVec.Add(1, M);
1689  WorkVec.Sub(4, M);
1690 
1691  return WorkVec;
1692 }
1693 
1694 /* ViscoElasticHingeJoint - end */
1695 
1696 /* ViscoElasticHingeJointInv - begin */
1697 
1699  const DofOwner* pDO,
1700  const ConstitutiveLaw3D* pCL,
1701  const StructNode* pN1,
1702  const StructNode* pN2,
1703  const Mat3x3& tilde_R1h,
1704  const Mat3x3& tilde_R2h,
1705  const OrientationDescription& od,
1706  flag fOut)
1707 : Elem(uL, fOut),
1708 ViscoElasticHingeJoint(uL, pDO, pCL, pN1, pN2, tilde_R1h, tilde_R2h, od, fOut)
1709 {
1710  NO_OP;
1711 }
1712 
1714 {
1715  NO_OP;
1716 }
1717 
1718 void
1720 {
1721  /* Calcola le deformazioni, aggiorna il legame costitutivo
1722  * e crea le MDE e MDEPrime */
1723 
1724  /* Recupera i dati */
1725  Mat3x3 R1h(pNode1->GetRRef()*tilde_R1h);
1726  Mat3x3 R2h(pNode2->GetRRef()*tilde_R2h);
1727  ThetaCurr = ThetaRef = RotManip::VecRot(R1h.MulTM(R2h));
1728  Mat3x3 tilde_R(RotManip::Rot(ThetaRef/2.));
1729  Mat3x3 hat_R(R1h*tilde_R);
1730 
1731  /* velocita' relativa nel sistema intermedio */
1732  Omega = hat_R.MulTV(pNode2->GetWRef() - pNode1->GetWRef());
1733 
1734  /* Aggiorna il legame costitutivo */
1736 
1737  /* Chiede la matrice tangente di riferimento e la porta
1738  * nel sistema globale */
1739 
1740  /* Calcola l'inversa di Gamma di ThetaRef */
1741  Mat3x3 GammaRefm1 = RotManip::DRot_I(ThetaRef);
1742 
1743  /* Chiede la matrice tangente di riferimento e la porta
1744  * nel sistema globale */
1745  MDE = hat_R*ConstitutiveLaw3DOwner::GetFDE()*GammaRefm1.MulMT(R1h);
1746  MDEPrime = hat_R*ConstitutiveLaw3DOwner::GetFDEPrime().MulMT(hat_R);
1747 
1748  hat_I = hat_R*(Eye3 + tilde_R).Inv().MulMT(hat_R);
1749  hat_IT = hat_I.Transpose();
1750 }
1751 
1752 /* NOTE: duplicate of ElasticHingeJointInv and ViscousHingeJointInv */
1753 void
1755 {
1757 }
1758 
1759 /* NOTE: duplicate of ViscousHingeJointInv */
1760 void
1762  FullSubMatrixHandler& WMB, doublereal dCoef)
1763 {
1764  DeformableHingeJoint::AssMatMDEPrimeInv(WMA, WMB, dCoef);
1765 }
1766 
1767 /* assemblaggio residuo */
1768 void
1770 {
1771  Mat3x3 R1h(pNode1->GetRCurr()*tilde_R1h);
1772  Mat3x3 hat_R;
1773 
1774  if (bFirstRes) {
1775  bFirstRes = false;
1776  hat_R = R1h*RotManip::Rot(ThetaCurr/2.);
1777 
1778  } else {
1779  Mat3x3 R2h(pNode2->GetRCurr()*tilde_R2h);
1780  ThetaCurr = RotManip::VecRot(R1h.MulTM(R2h));
1781 
1782  /* orientazione intermedia */
1783  hat_R = R1h*RotManip::Rot(ThetaCurr/2.);
1784 
1785  /* velocita' relativa nell'orientazione intermedia */
1786  Omega = hat_R.MulTV(pNode2->GetWCurr() - pNode1->GetWCurr());
1787 
1788  /* aggiorna il legame costitutivo */
1790  }
1791 
1792  M = hat_R*GetF();
1793 
1794  WorkVec.Add(1, M);
1795  WorkVec.Sub(4, M);
1796 }
1797 
1798 void
1800 {
1802 }
1803 
1804 doublereal
1806 {
1808 }
1809 
1810 /* ViscoElasticHingeJointInv - end */
1811 
1812 
1813 /* InvAngularConstitutiveLaw - begin */
1814 
1816 : public ConstitutiveLaw<Vec3, Mat3x3> {
1817 private:
1820 
1821 public:
1824  virtual ~InvAngularConstitutiveLaw(void);
1825 
1826  ConstLawType::Type GetConstLawType(void) const;
1827 
1828  virtual ConstitutiveLaw<Vec3, Mat3x3>* pCopy(void) const;
1829  virtual std::ostream& Restart(std::ostream& out) const;
1830 
1831  virtual void Update(const Vec3& Eps, const Vec3& /* EpsPrime */ = Zero3);
1832 };
1833 
1834 
1837 : dXi(dxi), pCL(pcl)
1838 {
1839  NO_OP;
1840 }
1841 
1843 {
1844  if (pCL) {
1845  delete pCL;
1846  }
1847 }
1848 
1851 {
1853 }
1854 
1857 {
1858  ConstitutiveLaw<Vec3, Mat3x3>* pcl = NULL;
1859 
1860  typedef InvAngularConstitutiveLaw cl;
1861  SAFENEWWITHCONSTRUCTOR(pcl, cl, cl(dXi, pCL->pCopy()));
1862  return pcl;
1863 }
1864 
1865 std::ostream&
1866 InvAngularConstitutiveLaw::Restart(std::ostream& out) const
1867 {
1868  out << "invariant, " << dXi << ", ";
1869  return pCL->Restart(out);
1870 }
1871 
1872 void
1873 InvAngularConstitutiveLaw::Update(const Vec3& Eps, const Vec3& EpsPrime)
1874 {
1875  // Save Eps, just in case
1877 
1878  // Theta_xi = Theta * xi
1879  Vec3 Tx(Eps*dXi);
1880 
1881  // R_xi = exp(xi*Theta x)
1882  Mat3x3 Rx(RotManip::Rot(Tx));
1883 
1884  // If the underlying CL needs EpsPrime, re-orient it accordingly
1885  Vec3 EP;
1887  EP = Rx.MulTV(EpsPrime);
1888  }
1889 
1890  // EP is passed uninitialized if the underlying CL has no VISCOUS
1891  pCL->Update(Eps, EP);
1892 
1893  // F = R_xi * K * Theta
1895 
1896  // Gamma_xi
1897  Mat3x3 Gx(RotManip::DRot(Tx));
1898 
1899  // re-orientation of moment
1901 
1902  // stiffness, if any
1905  }
1906 
1907  // viscosity, if any
1909  // NOTE: RDE will be incomplete; it'll miss the
1910  // delta hatR^T * (w_b - w_a) term in case of VISCOUS
1912  }
1913 }
1914 
1915 /* InvAngularConstitutiveLaw - end */
1916 
1917 
1918 /* InvAngularCLR - begin */
1919 
1922 {
1924 
1925  doublereal dXi = HP.GetReal();
1926 
1927  ConstitutiveLaw<Vec3, Mat3x3>* pCL2 = HP.GetConstLaw3D(CLType);
1928  CLType = ConstLawType::Type(ConstLawType::ELASTIC | CLType);
1929 
1930  typedef InvAngularConstitutiveLaw L;
1931  SAFENEWWITHCONSTRUCTOR(pCL, L, L(dXi, pCL2));
1932 
1933  return pCL;
1934 }
1935 
1936 /* InvAngularCLR - end */
Definition: hint.h:38
~ViscoElasticHingeJointInv(void)
Definition: vehj.cc:1713
virtual void AssMatM(FullSubMatrixHandler &WMA, doublereal dCoef)
Definition: vehj.cc:1754
virtual const T & GetF(void) const
Definition: constltp.h:125
virtual void AssVec(SubVectorHandler &WorkVec)
Definition: vehj.cc:777
virtual ~ElasticHingeJoint(void)
Definition: vehj.cc:558
void PutColIndex(integer iSubCol, integer iCol)
Definition: submat.h:325
const Vec3 Zero3(0., 0., 0.)
Vec3 Cross(const Vec3 &v) const
Definition: matvec3.h:218
void Update(const VectorHandler &XCurr, InverseDynamics::Order iOrder=InverseDynamics::INVERSE_DYNAMICS)
Definition: vehj.cc:763
long int flag
Definition: mbdyn.h:43
virtual const Mat3x3 & GetRRef(void) const
Definition: strnode.h:1006
virtual bool bToBeOutput(void) const
Definition: output.cc:890
virtual void AssMats(FullSubMatrixHandler &WMA, FullSubMatrixHandler &WMB, doublereal dCoef)
Definition: vehj.cc:1074
virtual void AfterConvergence(const VectorHandler &X, const VectorHandler &XP)
Definition: vehj.cc:1387
virtual SubVectorHandler & InitialAssRes(SubVectorHandler &WorkVec, const VectorHandler &XCurr)
Definition: vehj.cc:1219
ConstitutiveLaw< T, Tder > * pGetConstLaw(void) const
Definition: constltp.h:278
Definition: matvec3.h:98
virtual void AssVec(SubVectorHandler &WorkVec)
Definition: vehj.cc:1323
virtual void AssMatM(FullSubMatrixHandler &WMA, doublereal dCoef)
Definition: vehj.cc:1309
virtual void ResizeReset(integer)
Definition: vh.cc:55
Vec3 ThetaRef
Definition: vehj.h:180
const MatCross_Manip MatCross
Definition: matvec3.cc:639
bool UseNetCDF(int out) const
Definition: output.cc:491
FullSubMatrixHandler & SetFull(void)
Definition: submat.h:1168
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
virtual Node::Type GetNodeType(void) const
Definition: strnode.cc:145
virtual void AssMatM(FullSubMatrixHandler &WMA, doublereal dCoef)
Definition: vehj.cc:83
virtual void AfterPredict(void)
Definition: vehj.cc:861
virtual std::ostream & Restart(std::ostream &out) const
Definition: vehj.cc:1866
bool bIsErgonomy(void) const
Definition: elem.cc:83
void Add(integer iRow, integer iCol, const Vec3 &v)
Definition: submat.cc:209
virtual unsigned int iGetPrivDataIdx(const char *s) const
Definition: constltp.h:361
Mat3x3 DRot(const Vec3 &phi)
Definition: Rot.cc:74
virtual Hint * ParseHint(DataManager *pDM, const char *s) const
Definition: simentity.cc:76
std::ostream & Write(std::ostream &out, const FullMatrixHandler &m, const char *s, const char *s2)
Definition: fullmh.cc:376
virtual void AssMats(FullSubMatrixHandler &WMA, FullSubMatrixHandler &WMB, doublereal dCoef)
Definition: vehj.cc:1500
virtual SubVectorHandler & InitialAssRes(SubVectorHandler &WorkVec, const VectorHandler &XCurr)
Definition: vehj.cc:1653
ViscoElasticHingeJoint(unsigned int uL, const DofOwner *pDO, const ConstitutiveLaw3D *pCL, const StructNode *pN1, const StructNode *pN2, const Mat3x3 &tilde_R1h, const Mat3x3 &tilde_R2h, const OrientationDescription &od, flag fOut)
Definition: vehj.cc:1364
virtual unsigned int iGetNumPrivData(void) const
Definition: vehj.cc:408
virtual const Tder & GetFDE(void) const
Definition: constltp.h:129
virtual void Sub(integer iRow, const Vec3 &v)
Definition: vh.cc:78
virtual void AssMatMDEPrime(FullSubMatrixHandler &WMA, FullSubMatrixHandler &WMB, doublereal dCoef)
Definition: vehj.cc:1761
const Tder & GetFDE(void) const
Definition: constltp.h:298
ElasticHingeJointInv(unsigned int uL, const DofOwner *pDO, const ConstitutiveLaw3D *pCL, const StructNode *pN1, const StructNode *pN2, const Mat3x3 &tilde_R1h, const Mat3x3 &tilde_R2h, const OrientationDescription &od, flag fOut)
Definition: vehj.cc:885
const Mat3x3 Eye3(1., 0., 0., 0., 1., 0., 0., 0., 1.)
OrientationDescription
Definition: matvec3.h:1597
virtual VariableSubMatrixHandler & InitialAssJac(VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
Definition: vehj.cc:1600
virtual SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: vehj.cc:683
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: vehj.h:437
virtual unsigned int iGetNumPrivData(void) const
Definition: constltp.h:352
virtual ~ElasticHingeJointInv(void)
Definition: vehj.cc:900
void SetValue(DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *ph=0)
Definition: vehj.cc:344
virtual const Vec3 & GetWRef(void) const
Definition: strnode.h:1024
#define NO_OP
Definition: myassert.h:74
virtual Hint * ParseHint(DataManager *pDM, const char *s) const
Definition: vehj.cc:386
std::vector< Hint * > Hints
Definition: simentity.h:89
virtual void SetInitialValue(VectorHandler &)
Definition: vehj.cc:380
virtual doublereal dGetPrivData(unsigned int i) const
Definition: vehj.cc:943
Mat3x3 hat_I
Definition: vehj.h:70
Vec3 GetVec(unsigned short int i) const
Definition: matvec3.h:893
virtual doublereal dGetPrivData(unsigned int i) const
Definition: vehj.cc:470
virtual doublereal dGetPrivData(unsigned int i) const
Definition: vehj.cc:1805
const StructNode * pNode1
Definition: vehj.h:48
Vec3 VecRot(const Mat3x3 &Phi)
Definition: Rot.cc:136
virtual VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: vehj.cc:1001
Vec3 MulTV(const Vec3 &v) const
Definition: matvec3.cc:482
InvAngularConstitutiveLaw(const doublereal &dxi, ConstitutiveLaw< Vec3, Mat3x3 > *pcl)
Definition: vehj.cc:1835
virtual void PutRowIndex(integer iSubRow, integer iRow)=0
virtual std::ostream & Restart(std::ostream &out) const
Definition: constltp.h:107
virtual void Output(OutputHandler &OH) const
Definition: vehj.cc:1348
virtual void AssMatM(FullSubMatrixHandler &WMA, doublereal dCoef)
Definition: vehj.cc:906
void AssMatMDE(FullSubMatrixHandler &WMA, doublereal dCoef)
Definition: vehj.cc:113
ViscousHingeJointInv(unsigned int uL, const DofOwner *pDO, const ConstitutiveLaw3D *pCL, const StructNode *pN1, const StructNode *pN2, const Mat3x3 &tilde_R1h, const Mat3x3 &tilde_R2h, const OrientationDescription &od, flag fOut)
Definition: vehj.cc:1262
ElasticHingeJoint(unsigned int uL, const DofOwner *pDO, const ConstitutiveLaw3D *pCL, const StructNode *pN1, const StructNode *pN2, const Mat3x3 &tilde_R1h, const Mat3x3 &tilde_R2h, const OrientationDescription &od, flag fOut)
Definition: vehj.cc:541
virtual void AssVec(SubVectorHandler &WorkVec)
Definition: vehj.cc:1769
doublereal dGetPrivDataInv(unsigned int i) const
Definition: vehj.cc:511
Vec3 MatR2EulerAngles313(const Mat3x3 &R)
Definition: matvec3.cc:927
ViscousHingeJoint(unsigned int uL, const DofOwner *pDO, const ConstitutiveLaw3D *pCL, const StructNode *pN1, const StructNode *pN2, const Mat3x3 &tilde_R1h, const Mat3x3 &tilde_R2h, const OrientationDescription &od, flag fOut)
Definition: vehj.cc:953
ConstLawType::Type GetConstLawType(void) const
Definition: vehj.cc:1850
virtual ConstLawType::Type GetConstLawType(void) const =0
Matrix< T, 2, 2 > Inv(const Matrix< T, 2, 2 > &A)
Definition: matvec.h:3282
virtual void AfterConvergence(const VectorHandler &X, const VectorHandler &XP)
Definition: vehj.cc:975
virtual SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: vehj.cc:1511
void SetNullMatrix(void)
Definition: submat.h:1159
Definition: mbdyn.h:76
OrientationDescription od
Definition: vehj.h:53
Mat3x3 hat_IT
Definition: vehj.h:71
virtual ConstitutiveLaw< T, Tder > * pCopy(void) const =0
virtual void AfterPredict(void)
Definition: vehj.cc:1719
virtual void AssVec(SubVectorHandler &WorkVec)
Definition: vehj.cc:912
long GetCurrentStep(void) const
Definition: output.h:116
#define DEBUGCOUT(msg)
Definition: myassert.h:232
virtual VariableSubMatrixHandler & InitialAssJac(VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
Definition: vehj.cc:799
Vec3 MatR2EulerAngles123(const Mat3x3 &R)
Definition: matvec3.cc:893
Mat3x3 Rot(const Vec3 &phi)
Definition: Rot.cc:62
virtual integer iGetFirstMomentumIndex(void) const =0
virtual integer iGetFirstPositionIndex(void) const
Definition: strnode.h:452
virtual const Vec3 & GetWCurr(void) const
Definition: strnode.h:1030
const doublereal dRaDegr
Definition: matvec3.cc:884
virtual std::ostream & Restart(std::ostream &out) const
Definition: joint.h:195
std::ostream & Joints(void) const
Definition: output.h:443
~ViscoElasticHingeJoint(void)
Definition: vehj.cc:1381
void AfterConvergence(const T &Eps, const T &EpsPrime=mb_zero< T >())
Definition: constltp.h:288
#define ASSERT(expression)
Definition: colamd.c:977
virtual void Output(OutputHandler &OH) const
Definition: vehj.cc:937
virtual void AssVec(SubVectorHandler &WorkVec)
Definition: vehj.cc:1572
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: vehj.h:615
virtual void AssMat(FullSubMatrixHandler &WM, doublereal dCoef)
Definition: vehj.cc:666
virtual void OutputPrepare_int(const std::string &type, OutputHandler &OH, std::string &name)
Definition: joint.cc:107
virtual void AfterPredict(void)
Definition: vehj.cc:642
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
DeformableHingeJoint(unsigned int uL, const DofOwner *pDO, const ConstitutiveLaw3D *pCL, const StructNode *pN1, const StructNode *pN2, const Mat3x3 &tilde_R1h, const Mat3x3 &tilde_R2h, const OrientationDescription &od, flag fOut)
Definition: vehj.cc:45
virtual void Add(integer iRow, const Vec3 &v)
Definition: vh.cc:63
void AssMatMDEPrimeInv(FullSubMatrixHandler &WMA, FullSubMatrixHandler &WMB, doublereal dCoef)
Definition: vehj.cc:143
virtual void ResizeReset(integer, integer)
Definition: submat.cc:182
virtual SubVectorHandler & InitialAssRes(SubVectorHandler &WorkVec, const VectorHandler &XCurr)
Definition: vehj.cc:831
virtual ~ViscousHingeJoint(void)
Definition: vehj.cc:969
virtual void AfterConvergence(const VectorHandler &X, const VectorHandler &XP)
Definition: vehj.cc:564
virtual void AfterPredict(void)=0
virtual ~ViscousHingeJointInv(void)
Definition: vehj.cc:1277
virtual doublereal dGetPrivData(unsigned int i) const
Definition: constltp.h:369
Mat3x3 Transpose(void) const
Definition: matvec3.h:816
void OutputInv(OutputHandler &OH) const
Definition: vehj.cc:289
const doublereal * pGetMat(void) const
Definition: matvec3.h:743
#define STRLENOF(s)
Definition: mbdyn.h:166
virtual void AssVec(SubVectorHandler &WorkVec)
Definition: vehj.cc:1145
virtual void AssMatMDEPrime(FullSubMatrixHandler &WMA, FullSubMatrixHandler &WMB, doublereal dCoef)
Definition: vehj.cc:1315
virtual ~InvAngularConstitutiveLaw(void)
Definition: vehj.cc:1842
Definition: elem.h:75
ViscoElasticHingeJointInv(unsigned int uL, const DofOwner *pDO, const ConstitutiveLaw3D *pCL, const StructNode *pN1, const StructNode *pN2, const Mat3x3 &tilde_R1h, const Mat3x3 &tilde_R2h, const OrientationDescription &od, flag fOut)
Definition: vehj.cc:1698
virtual std::ostream & Restart(std::ostream &out) const
Definition: vehj.cc:163
void PutRowIndex(integer iSubRow, integer iRow)
Definition: submat.h:311
const T & GetF(void) const
Definition: constltp.h:293
virtual void Update(const Vec3 &Eps, const Vec3 &=Zero3)
Definition: vehj.cc:1873
void OutputPrepare(OutputHandler &OH)
Definition: vehj.cc:177
const doublereal * pGetVec(void) const
Definition: matvec3.h:192
virtual bool bInverseDynamics(void) const
Definition: vehj.cc:374
virtual ~DeformableHingeJoint(void)
Definition: vehj.cc:75
Vec3 MatR2EulerAngles321(const Mat3x3 &R)
Definition: matvec3.cc:941
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const =0
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: vehj.h:264
virtual ConstitutiveLaw< Vec3, Mat3x3 > * Read(const DataManager *pDM, MBDynParser &HP, ConstLawType::Type &CLType)
Definition: vehj.cc:1921
virtual void AssMats(VariableSubMatrixHandler &WorkMatA, VariableSubMatrixHandler &WorkMatB, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: vehj.cc:608
Mat3x3 tilde_R1h
Definition: vehj.h:50
void Sub(integer iRow, integer iCol, const Vec3 &v)
Definition: submat.cc:215
virtual const Tder & GetFDEPrime(void) const
Definition: constltp.h:133
Vec3 ThetaCurr
Definition: vehj.h:181
virtual void AfterPredict(void)
Definition: vehj.cc:1283
virtual SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: vehj.cc:1084
Definition: joint.h:50
virtual void AfterPredict(void)
Definition: vehj.cc:982
virtual unsigned int iGetPrivDataIdx(const char *s) const
Definition: vehj.cc:414
Mat3x3 MulMT(const Mat3x3 &m) const
Definition: matvec3.cc:444
virtual void Update(const T &Eps, const T &EpsPrime=mb_zero< T >())=0
virtual VariableSubMatrixHandler & InitialAssJac(VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
Definition: vehj.cc:1166
virtual ConstitutiveLaw< Vec3, Mat3x3 > * pCopy(void) const
Definition: vehj.cc:1856
virtual void SetValue(DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *h=0)
Definition: simentity.cc:63
double doublereal
Definition: colamd.c:52
const Tder & GetFDEPrime(void) const
Definition: constltp.h:303
virtual void Output(OutputHandler &OH) const
Definition: vehj.cc:195
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
ConstitutiveLaw3D * GetConstLaw3D(ConstLawType::Type &clt)
Definition: mbpar.cc:1968
long int integer
Definition: colamd.c:51
virtual doublereal dGetPrivData(unsigned int i) const
Definition: vehj.cc:1354
void Update(const T &Eps, const T &EpsPrime=mb_zero< T >())
Definition: constltp.h:283
virtual void Output(OutputHandler &OH) const
Definition: vehj.cc:1799
unsigned int GetLabel(void) const
Definition: withlab.cc:62
virtual void AfterPredict(void)
Definition: vehj.cc:1394
ConstitutiveLaw< Vec3, Mat3x3 > * pCL
Definition: vehj.cc:1819
Mat3x3 DRot_I(const Vec3 &phi)
Definition: Rot.cc:111
Mat3x3 R
Mat3x3 MDEPrime
Definition: vehj.h:67
Mat3x3 tilde_R2h
Definition: vehj.h:51
virtual ConstLawType::Type GetConstLawType(void) const =0
bool UseText(int out) const
Definition: output.cc:446
virtual VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: vehj.cc:1427
virtual VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: vehj.cc:572
void AssMatMInv(FullSubMatrixHandler &WMA, doublereal dCoef)
Definition: vehj.cc:95
const StructNode * pNode2
Definition: vehj.h:49
virtual void AssMatMDEPrime(FullSubMatrixHandler &WMA, FullSubMatrixHandler &WMB, doublereal dCoef)
Definition: vehj.cc:126
virtual doublereal GetReal(const doublereal &dDefval=0.0)
Definition: parser.cc:1056