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

#include <planej.h>

Inheritance diagram for PlaneRotationJoint:
Collaboration diagram for PlaneRotationJoint:

Public Member Functions

 PlaneRotationJoint (unsigned int uL, const DofOwner *pDO, const StructNode *pN1, const StructNode *pN2, const Mat3x3 &R1hTmp, const Mat3x3 &R2hTmp, const OrientationDescription &od, flag fOut)
 
 ~PlaneRotationJoint (void)
 
virtual std::ostream & Restart (std::ostream &out) const
 
virtual Joint::Type GetJointType (void) const
 
virtual unsigned int iGetNumDof (void) const
 
virtual std::ostream & DescribeDof (std::ostream &out, const char *prefix="", bool bInitial=false) const
 
virtual void DescribeDof (std::vector< std::string > &desc, bool bInitial=false, int i=-1) const
 
virtual std::ostream & DescribeEq (std::ostream &out, const char *prefix="", bool bInitial=false) const
 
virtual void DescribeEq (std::vector< std::string > &desc, bool bInitial=false, int i=-1) const
 
DofOrder::Order GetDofType (unsigned int i) const
 
virtual void SetValue (DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *ph=0)
 
virtual HintParseHint (DataManager *pDM, const char *s) const
 
virtual void AfterConvergence (const VectorHandler &X, const VectorHandler &XP)
 
void WorkSpaceDim (integer *piNumRows, integer *piNumCols) const
 
VariableSubMatrixHandlerAssJac (VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
SubVectorHandlerAssRes (SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
DofOrder::Order GetEqType (unsigned int i) const
 
void OutputPrepare (OutputHandler &OH)
 
void Output (OutputHandler &OH) const
 
virtual unsigned int iGetInitialNumDof (void) const
 
virtual void InitialWorkSpaceDim (integer *piNumRows, integer *piNumCols) const
 
VariableSubMatrixHandlerInitialAssJac (VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
 
SubVectorHandlerInitialAssRes (SubVectorHandler &WorkVec, const VectorHandler &XCurr)
 
virtual unsigned int iGetNumPrivData (void) const
 
virtual unsigned int iGetPrivDataIdx (const char *s) const
 
virtual doublereal dGetPrivData (unsigned int i) const
 
virtual void GetConnectedNodes (std::vector< const Node * > &connectedNodes) const
 
- Public Member Functions inherited from Elem
 Elem (unsigned int uL, flag fOut)
 
virtual ~Elem (void)
 
virtual void AssMats (VariableSubMatrixHandler &WorkMatA, VariableSubMatrixHandler &WorkMatB, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual bool bInverseDynamics (void) const
 
void SetInverseDynamicsFlags (unsigned uIDF)
 
unsigned GetInverseDynamicsFlags (void) const
 
bool bIsErgonomy (void) const
 
bool bIsRightHandSide (void) const
 
virtual VariableSubMatrixHandlerAssJac (VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
 
virtual SubVectorHandlerAssRes (SubVectorHandler &WorkVec, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr, const VectorHandler &XPrimePrimeCurr, InverseDynamics::Order iOrder=InverseDynamics::INVERSE_DYNAMICS)
 
virtual int GetNumConnectedNodes (void) const
 
- Public Member Functions inherited from WithLabel
 WithLabel (unsigned int uL=0, const std::string &sN="")
 
virtual ~WithLabel (void)
 
void PutLabel (unsigned int uL)
 
void PutName (const std::string &sN)
 
unsigned int GetLabel (void) const
 
const std::string & GetName (void) const
 
- Public Member Functions inherited from SimulationEntity
 SimulationEntity (void)
 
virtual ~SimulationEntity (void)
 
virtual bool bIsValidIndex (unsigned int i) const
 
virtual void BeforePredict (VectorHandler &, VectorHandler &, VectorHandler &, VectorHandler &) const
 
virtual void AfterPredict (VectorHandler &X, VectorHandler &XP)
 
virtual void Update (const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual void DerivativesUpdate (const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual void AfterConvergence (const VectorHandler &X, const VectorHandler &XP, 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 Output (OutputHandler &OH, const VectorHandler &X, const VectorHandler &XP) const
 
virtual flag fToBeOutput (void) const
 
virtual bool bToBeOutput (void) const
 
virtual void SetOutputFlag (flag f=flag(1))
 
- Public Member Functions inherited from Joint
 Joint (unsigned int uL, const DofOwner *pD, flag fOut)
 
virtual ~Joint (void)
 
virtual Elem::Type GetElemType (void) const
 
std::ostream & Output (std::ostream &out, const char *sJointName, unsigned int uLabel, const Vec3 &FLocal, const Vec3 &MLocal, const Vec3 &FGlobal, const Vec3 &MGlobal) const
 
virtual void SetInitialValue (VectorHandler &)
 
virtual void Update (const VectorHandler &XCurr, InverseDynamics::Order iOrder=InverseDynamics::INVERSE_DYNAMICS)
 
bool bIsPrescribedMotion (void) const
 
bool bIsTorque (void) const
 
- Public Member Functions inherited from ElemGravityOwner
 ElemGravityOwner (unsigned int uL, flag fOut)
 
virtual ~ElemGravityOwner (void)
 
virtual doublereal dGetM (void) const
 
Vec3 GetS (void) const
 
Mat3x3 GetJ (void) const
 
Vec3 GetB (void) const
 
Vec3 GetG (void) const
 
- Public Member Functions inherited from GravityOwner
 GravityOwner (void)
 
virtual ~GravityOwner (void)
 
void PutGravity (const Gravity *pG)
 
virtual bool bGetGravity (const Vec3 &X, Vec3 &Acc) const
 
- Public Member Functions inherited from ElemWithDofs
 ElemWithDofs (unsigned int uL, const DofOwner *pDO, flag fOut)
 
virtual ~ElemWithDofs (void)
 
- Public Member Functions inherited from DofOwnerOwner
 DofOwnerOwner (const DofOwner *pDO)
 
virtual ~DofOwnerOwner ()
 
virtual const DofOwnerpGetDofOwner (void) const
 
virtual integer iGetFirstIndex (void) const
 
- Public Member Functions inherited from InitialAssemblyElem
 InitialAssemblyElem (unsigned int uL, flag fOut)
 
virtual ~InitialAssemblyElem (void)
 
- Public Member Functions inherited from SubjectToInitialAssembly
 SubjectToInitialAssembly (void)
 
virtual ~SubjectToInitialAssembly (void)
 

Protected Attributes

OrientationDescription od
 
- Protected Attributes inherited from WithLabel
unsigned int uLabel
 
std::string sName
 
- Protected Attributes inherited from ToBeOutput
flag fOutput
 
- Protected Attributes inherited from GravityOwner
GravitypGravity
 

Private Attributes

const StructNodepNode1
 
const StructNodepNode2
 
Mat3x3 R1h
 
Mat3x3 R2h
 
Vec3 M
 
int NTheta
 
doublereal dTheta
 
doublereal dThetaWrapped
 

Additional Inherited Members

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

Detailed Description

Definition at line 206 of file planej.h.

Constructor & Destructor Documentation

PlaneRotationJoint::PlaneRotationJoint ( unsigned int  uL,
const DofOwner pDO,
const StructNode pN1,
const StructNode pN2,
const Mat3x3 R1hTmp,
const Mat3x3 R2hTmp,
const OrientationDescription od,
flag  fOut 
)

Definition at line 1533 of file planej.cc.

References NO_OP.

1538 : Elem(uL, fOut),
1539 Joint(uL, pDO, fOut),
1540 pNode1(pN1), pNode2(pN2),
1541 R1h(R1hTmp), R2h(R2hTmp), M(Zero3),
1542 NTheta(0), dTheta(0.),
1543 dThetaWrapped(0.),
1544 #ifdef USE_NETCDF
1545 Var_Phi(0),
1546 Var_Omega(0),
1547 //Var_MFR(0),
1548 //Var_MU(0),
1549 #endif // USE_NETCDF
1550 od(od)
1551 {
1552  NO_OP;
1553 }
const Vec3 Zero3(0., 0., 0.)
OrientationDescription od
Definition: planej.h:229
Joint(unsigned int uL, const DofOwner *pD, flag fOut)
Definition: joint.cc:83
#define NO_OP
Definition: myassert.h:74
doublereal dThetaWrapped
Definition: planej.h:222
doublereal dTheta
Definition: planej.h:222
const StructNode * pNode2
Definition: planej.h:217
Elem(unsigned int uL, flag fOut)
Definition: elem.cc:41
const StructNode * pNode1
Definition: planej.h:216
PlaneRotationJoint::~PlaneRotationJoint ( void  )

Definition at line 1557 of file planej.cc.

References NO_OP.

1558 {
1559  NO_OP;
1560 };
#define NO_OP
Definition: myassert.h:74

Member Function Documentation

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

Reimplemented from SimulationEntity.

Definition at line 1772 of file planej.cc.

References dTheta, dThetaWrapped, StructNode::GetRCurr(), M_PI, NTheta, pNode1, pNode2, R1h, R2h, and RotManip::VecRot().

1774 {
1776  doublereal dThetaTmp(v(3));
1777 
1778  // unwrap
1779  if (dThetaTmp - dThetaWrapped < -M_PI) {
1780  NTheta++;
1781  }
1782 
1783  if (dThetaTmp - dThetaWrapped > M_PI) {
1784  NTheta--;
1785  }
1786 
1787  // save new wrapped angle
1788  dThetaWrapped = dThetaTmp;
1789 
1790  // compute new unwrapped angle
1792 }
#define M_PI
Definition: gradienttest.cc:67
Definition: matvec3.h:98
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
Vec3 VecRot(const Mat3x3 &Phi)
Definition: Rot.cc:136
doublereal dThetaWrapped
Definition: planej.h:222
doublereal dTheta
Definition: planej.h:222
const StructNode * pNode2
Definition: planej.h:217
double doublereal
Definition: colamd.c:52
const StructNode * pNode1
Definition: planej.h:216

Here is the call graph for this function:

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

Implements Elem.

Definition at line 1812 of file planej.cc.

References FullSubMatrixHandler::Add(), DEBUGCOUT, Vec3::dGet(), StructNode::GetRRef(), Mat3x3::GetVec(), DofOwnerOwner::iGetFirstIndex(), StructDispNode::iGetFirstMomentumIndex(), StructDispNode::iGetFirstPositionIndex(), M, MatCrossCross, pNode1, pNode2, FullSubMatrixHandler::PutCoef(), FullSubMatrixHandler::PutColIndex(), FullSubMatrixHandler::PutRowIndex(), R1h, R2h, FullSubMatrixHandler::ResizeReset(), VariableSubMatrixHandler::SetFull(), FullSubMatrixHandler::Sub(), and WorkSpaceDim().

1816 {
1817  DEBUGCOUT("Entering PlaneRotationJoint::AssJac()" << std::endl);
1818 
1819  /* Setta la sottomatrice come piena (e' un po' dispersivo, ma lo jacobiano
1820  * e' complicato */
1821  FullSubMatrixHandler& WM = WorkMat.SetFull();
1822 
1823  /* Ridimensiona la sottomatrice in base alle esigenze */
1824  integer iNumRows = 0;
1825  integer iNumCols = 0;
1826  WorkSpaceDim(&iNumRows, &iNumCols);
1827  WM.ResizeReset(iNumRows, iNumCols);
1828 
1829  /* Recupera gli indici delle varie incognite */
1830  integer iNode1FirstPosIndex = pNode1->iGetFirstPositionIndex()+3;
1831  integer iNode1FirstMomIndex = pNode1->iGetFirstMomentumIndex()+3;
1832  integer iNode2FirstPosIndex = pNode2->iGetFirstPositionIndex()+3;
1833  integer iNode2FirstMomIndex = pNode2->iGetFirstMomentumIndex()+3;
1834  integer iFirstReactionIndex = iGetFirstIndex();
1835 
1836  /* Setta gli indici delle equazioni */
1837  for (int iCnt = 1; iCnt <= 3; iCnt++) {
1838  WM.PutRowIndex(iCnt, iNode1FirstMomIndex+iCnt);
1839  WM.PutColIndex(iCnt, iNode1FirstPosIndex+iCnt);
1840  WM.PutRowIndex(3+iCnt, iNode2FirstMomIndex+iCnt);
1841  WM.PutColIndex(3+iCnt, iNode2FirstPosIndex+iCnt);
1842  }
1843 
1844  for (int iCnt = 1; iCnt <= 2; iCnt++) {
1845  WM.PutRowIndex(6+iCnt, iFirstReactionIndex+iCnt);
1846  WM.PutColIndex(6+iCnt, iFirstReactionIndex+iCnt);
1847  }
1848 
1849  /* Recupera i dati che servono */
1850  const Mat3x3& R1(pNode1->GetRRef());
1851  const Mat3x3& R2(pNode2->GetRRef());
1852  Mat3x3 R1hTmp(R1*R1h);
1853  Mat3x3 R2hTmp(R2*R2h);
1854 
1855  /* Suppongo che le reazioni F, M siano gia' state aggiornate da AssRes;
1856  * ricordo che la forza F e' nel sistema globale, mentre la coppia M
1857  * e' nel sistema locale ed il terzo termine, M(3), e' nullo in quanto
1858  * diretto come l'asse attorno al quale la rotazione e' consentita */
1859 
1860 
1861  /*
1862  * La cerniera piana ha le prime 3 equazioni uguali alla cerniera sferica;
1863  * inoltre ha due equazioni che affermano la coincidenza dell'asse 3 del
1864  * riferimento solidale con la cerniera visto dai due nodi.
1865  *
1866  * (R1 * R1h * e1)^T * (R2 * R2h * e3) = 0
1867  * (R1 * R1h * e2)^T * (R2 * R2h * e3) = 0
1868  *
1869  * A queste equazioni corrisponde una reazione di coppia agente attorno
1870  * agli assi 1 e 2 del riferimento della cerniera. La coppia attorno
1871  * all'asse 3 e' nulla per definizione. Quindi la coppia nel sistema
1872  * globale e':
1873  * -R1 * R1h * M per il nodo 1,
1874  * R2 * R2h * M per il nodo 2
1875  *
1876  *
1877  * xa ga xb gb F M
1878  * Qa | 0 0 0 0 I 0 | | xa | | -F |
1879  * Ga | 0 c*(F/\da/\-(Sa*M)/\) 0 0 da/\ Sa | | ga | | -da/\F-Sa*M |
1880  * Qb | 0 0 0 0 -I 0 | | xb | = | F |
1881  * Gb | 0 0 0 -c*(F/\db/\-(Sb*M)/\) -db/\ -Sb | | gb | | db/\F+Sb*M |
1882  * F | -c*I c*da/\ c*I -c*db/\ 0 0 | | F | | xa+da-xb-db |
1883  * M1 | 0 c*Tb1^T*Ta3/\ 0 c*Ta3^T*Tb1/\ 0 0 | | M | | Sb^T*Ta3 |
1884  * M2 | 0 c*Tb2^T*Ta3/\ 0 c*Ta3^T*Tb2/\ 0 0 |
1885  *
1886  * con da = R1*d01, db = R2*d02, c = dCoef,
1887  * Sa = R1*R1h*[e1,e2], Sb = R2*R2h*[e1, e2],
1888  * Ta3 = R1*R1h*e3, Tb1 = R2*R2h*e1, Tb2 = R2*R2h*e2
1889  */
1890 
1891  /* Moltiplica il momento per il coefficiente del metodo */
1892  Vec3 MTmp = M*dCoef;
1893 
1894  Vec3 e3a(R1hTmp.GetVec(3));
1895  Vec3 e1b(R2hTmp.GetVec(1));
1896  Vec3 e2b(R2hTmp.GetVec(2));
1897  MTmp = e2b*MTmp.dGet(1)-e1b*MTmp.dGet(2);
1898 
1899  Mat3x3 MWedgee3aWedge(MatCrossCross, MTmp, e3a);
1900  Mat3x3 e3aWedgeMWedge(MatCrossCross, e3a, MTmp);
1901 
1902  WM.Sub(1, 1, MWedgee3aWedge);
1903  WM.Add(1, 4, e3aWedgeMWedge);
1904 
1905  WM.Add(4, 1, MWedgee3aWedge);
1906  WM.Sub(4, 4, e3aWedgeMWedge);
1907 
1908  /* Contributo del momento alle equazioni di equilibrio dei nodi */
1909  Vec3 Tmp1(e2b.Cross(e3a));
1910  Vec3 Tmp2(e3a.Cross(e1b));
1911 
1912  for (int iCnt = 1; iCnt <= 3; iCnt++) {
1913  doublereal d = Tmp1(iCnt);
1914  WM.PutCoef(iCnt, 7, d);
1915  WM.PutCoef(3+iCnt, 7, -d);
1916  d = Tmp2.dGet(iCnt);
1917  WM.PutCoef(iCnt, 8, d);
1918  WM.PutCoef(3+iCnt, 8, -d);
1919  }
1920 
1921  /* Modifica: divido le equazioni di vincolo per dCoef */
1922 
1923  /* Equazione di vincolo del momento
1924  *
1925  * Attenzione: bisogna scrivere il vettore trasposto
1926  * (Sb[1]^T*(Sa[3]/\))*dCoef
1927  * Questo pero' e' uguale a:
1928  * (-Sa[3]/\*Sb[1])^T*dCoef,
1929  * che puo' essere ulteriormente semplificato:
1930  * (Sa[3].Cross(Sb[1])*(-dCoef))^T;
1931  */
1932 
1933  for (int iCnt = 1; iCnt <= 3; iCnt++) {
1934  doublereal d = Tmp1.dGet(iCnt);
1935  WM.PutCoef(7, iCnt, d);
1936  WM.PutCoef(7, 3+iCnt, -d);
1937  d = Tmp2.dGet(iCnt);
1938  WM.PutCoef(8, iCnt, -d);
1939  WM.PutCoef(8, 3+iCnt, d);
1940  }
1941 
1942  return WorkMat;
1943 }
void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: planej.h:283
void PutColIndex(integer iSubCol, integer iCol)
Definition: submat.h:325
virtual const Mat3x3 & GetRRef(void) const
Definition: strnode.h:1006
Definition: matvec3.h:98
FullSubMatrixHandler & SetFull(void)
Definition: submat.h:1168
void Add(integer iRow, integer iCol, const Vec3 &v)
Definition: submat.cc:209
void PutCoef(integer iRow, integer iCol, const doublereal &dCoef)
Definition: submat.h:672
const doublereal & dGet(unsigned short int iRow) const
Definition: matvec3.h:285
#define DEBUGCOUT(msg)
Definition: myassert.h:232
virtual integer iGetFirstMomentumIndex(void) const =0
virtual integer iGetFirstPositionIndex(void) const
Definition: strnode.h:452
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
void Sub(integer iRow, integer iCol, const Vec3 &v)
Definition: submat.cc:215
const StructNode * pNode2
Definition: planej.h:217
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
double doublereal
Definition: colamd.c:52
const StructNode * pNode1
Definition: planej.h:216
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

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

Implements Elem.

Definition at line 1947 of file planej.cc.

References VectorHandler::Add(), ASSERT, DEBUGCOUT, Vec3::dGet(), Vec3::Dot(), StructNode::GetRCurr(), Mat3x3::GetVec(), DofOwnerOwner::iGetFirstIndex(), StructDispNode::iGetFirstMomentumIndex(), M, pNode1, pNode2, VectorHandler::PutCoef(), SubVectorHandler::PutRowIndex(), R1h, R2h, VectorHandler::ResizeReset(), VectorHandler::Sub(), and WorkSpaceDim().

1951 {
1952  DEBUGCOUT("Entering PlaneRotationJoint::AssRes()" << std::endl);
1953 
1954  /* Dimensiona e resetta la matrice di lavoro */
1955  integer iNumRows = 0;
1956  integer iNumCols = 0;
1957  WorkSpaceDim(&iNumRows, &iNumCols);
1958  WorkVec.ResizeReset(iNumRows);
1959 
1960  /* Indici */
1961  integer iNode1FirstMomIndex = pNode1->iGetFirstMomentumIndex()+3;
1962  integer iNode2FirstMomIndex = pNode2->iGetFirstMomentumIndex()+3;
1963  integer iFirstReactionIndex = iGetFirstIndex();
1964 
1965  /* Indici dei nodi */
1966  for (int iCnt = 1; iCnt <= 3; iCnt++) {
1967  WorkVec.PutRowIndex(iCnt, iNode1FirstMomIndex+iCnt);
1968  WorkVec.PutRowIndex(3+iCnt, iNode2FirstMomIndex+iCnt);
1969  }
1970 
1971  /* Indici del vincolo */
1972  for (int iCnt = 1; iCnt <= 2; iCnt++) {
1973  WorkVec.PutRowIndex(6+iCnt, iFirstReactionIndex+iCnt);
1974  }
1975 
1976  /* Aggiorna i dati propri */
1977  M = Vec3(XCurr(iFirstReactionIndex+1),
1978  XCurr(iFirstReactionIndex+2),
1979  0.);
1980 
1981  /*
1982  * FIXME: provare a mettere "modificatori" di forza/momento sui gdl
1983  * residui: attrito, rigidezze e smorzamenti, ecc.
1984  */
1985 
1986  /* Recupera i dati */
1987  const Mat3x3& R1(pNode1->GetRCurr());
1988  const Mat3x3& R2(pNode2->GetRCurr());
1989 
1990  /* Costruisce i dati propri nella configurazione corrente */
1991  Mat3x3 R1hTmp(R1*R1h);
1992  Mat3x3 R2hTmp(R2*R2h);
1993 
1994  Vec3 e3a(R1hTmp.GetVec(3));
1995  Vec3 e1b(R2hTmp.GetVec(1));
1996  Vec3 e2b(R2hTmp.GetVec(2));
1997 
1998  Vec3 MTmp(e2b.Cross(e3a)*M.dGet(1)+e3a.Cross(e1b)*M.dGet(2));
1999 
2000  /* Equazioni di equilibrio, nodo 1 */
2001  WorkVec.Sub(1, MTmp); /* Sfrutto F/\d = -d/\F */
2002 
2003  /* Equazioni di equilibrio, nodo 2 */
2004  WorkVec.Add(4, MTmp);
2005 
2006  /* Modifica: divido le equazioni di vincolo per dCoef */
2007  ASSERT(dCoef != 0.);
2008 
2009  /* Equazioni di vincolo di rotazione */
2010  Vec3 Tmp = R1hTmp.GetVec(3);
2011  WorkVec.PutCoef(7, Tmp.Dot(R2hTmp.GetVec(2))/dCoef);
2012  WorkVec.PutCoef(8, Tmp.Dot(R2hTmp.GetVec(1))/dCoef);
2013 
2014  return WorkVec;
2015 }
void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: planej.h:283
Definition: matvec3.h:98
virtual void ResizeReset(integer)
Definition: vh.cc:55
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
doublereal Dot(const Vec3 &v) const
Definition: matvec3.h:243
virtual void Sub(integer iRow, const Vec3 &v)
Definition: vh.cc:78
virtual void PutRowIndex(integer iSubRow, integer iRow)=0
const doublereal & dGet(unsigned short int iRow) const
Definition: matvec3.h:285
#define DEBUGCOUT(msg)
Definition: myassert.h:232
virtual integer iGetFirstMomentumIndex(void) const =0
#define ASSERT(expression)
Definition: colamd.c:977
virtual void PutCoef(integer iRow, const doublereal &dCoef)=0
virtual void Add(integer iRow, const Vec3 &v)
Definition: vh.cc:63
const StructNode * pNode2
Definition: planej.h:217
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
const StructNode * pNode1
Definition: planej.h:216
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

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

Reimplemented from Elem.

Definition at line 1564 of file planej.cc.

References DofOwnerOwner::iGetFirstIndex().

1565 {
1566  integer iIndex = iGetFirstIndex();
1567 
1568  out
1569  << prefix << iIndex + 1 << "->" << iIndex + 2 << ": "
1570  "reaction couples [mx,my]" << std::endl;
1571 
1572  if (bInitial) {
1573  iIndex += 2;
1574  out
1575  << prefix << iIndex + 1 << "->" << iIndex + 2 << ": "
1576  "reaction couple derivatives [mPx,mPy]" << std::endl;
1577  }
1578 
1579  return out;
1580 }
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

void PlaneRotationJoint::DescribeDof ( std::vector< std::string > &  desc,
bool  bInitial = false,
int  i = -1 
) const
virtual

Reimplemented from Elem.

Definition at line 1583 of file planej.cc.

References WithLabel::GetLabel(), MBDYN_EXCEPT_ARGS, and xyz.

1584 {
1585  std::ostringstream os;
1586  os << "PlaneRotationJoint(" << GetLabel() << ")";
1587 
1588  unsigned short nself = 2;
1589  if (bInitial) {
1590  nself *= 2;
1591  }
1592 
1593  if (i == -1) {
1594  desc.resize(nself);
1595  std::string name = os.str();
1596 
1597  for (unsigned i = 0; i < 2; i++) {
1598  os.str(name);
1599  os.seekp(0, std::ios_base::end);
1600  os << ": reaction couple m" << xyz[i];
1601  desc[i] = os.str();
1602  }
1603 
1604  if (bInitial) {
1605  for (unsigned i = 0; i < 2; i++) {
1606  os.str(name);
1607  os.seekp(0, std::ios_base::end);
1608  os << ": reaction couple derivative mP" << xyz[i];
1609  desc[2 + i] = os.str();
1610  }
1611  }
1612 
1613  } else {
1614  if (i < -1) {
1615  // error
1617  }
1618 
1619  if (i >= nself) {
1620  // error
1622  }
1623 
1624  desc.resize(1);
1625 
1626  switch (i) {
1627  case 0:
1628  case 1:
1629  os << ": reaction couple m" << xyz[i];
1630  break;
1631 
1632  case 2:
1633  case 3:
1634  os << ": reaction couple derivative mP" << xyz[i - 2];
1635  break;
1636  }
1637  desc[0] = os.str();
1638  }
1639 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
static const char xyz[]
Definition: planej.cc:133
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

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

Reimplemented from Elem.

Definition at line 1642 of file planej.cc.

References DofOwnerOwner::iGetFirstIndex().

1643 {
1644  integer iIndex = iGetFirstIndex();
1645 
1646  out
1647  << prefix << iIndex + 1 << "->" << iIndex + 2 << ": "
1648  "orientation constraints [gx1=gx2,gy1=gy2]" << std::endl;
1649 
1650  if (bInitial) {
1651  iIndex += 2;
1652  out
1653  << prefix << iIndex + 1 << "->" << iIndex + 2 << ": "
1654  "angular velocity constraints [wx1=wx2,wy1=wy2]" << std::endl;
1655  }
1656 
1657  return out;
1658 }
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

void PlaneRotationJoint::DescribeEq ( std::vector< std::string > &  desc,
bool  bInitial = false,
int  i = -1 
) const
virtual

Reimplemented from Elem.

Definition at line 1661 of file planej.cc.

References WithLabel::GetLabel(), MBDYN_EXCEPT_ARGS, and xyz.

1662 {
1663  std::ostringstream os;
1664  os << "PlaneRotationJoint(" << GetLabel() << ")";
1665 
1666  unsigned short nself = 2;
1667  if (bInitial) {
1668  nself *= 2;
1669  }
1670 
1671  if (i == -1) {
1672  desc.resize(nself);
1673  std::string name = os.str();
1674 
1675  for (unsigned i = 0; i < 2; i++) {
1676  os.str(name);
1677  os.seekp(0, std::ios_base::end);
1678  os << ": orientation constraint g" << xyz[i];
1679  desc[i] = os.str();
1680  }
1681 
1682  if (bInitial) {
1683  for (unsigned i = 0; i < 2; i++) {
1684  os.str(name);
1685  os.seekp(0, std::ios_base::end);
1686  os << ": orientation constraint derivative w" << xyz[i];
1687  desc[2 + i] = os.str();
1688  }
1689  }
1690 
1691  } else {
1692  if (i < -1) {
1693  // error
1695  }
1696 
1697  if (i >= nself) {
1698  // error
1700  }
1701 
1702  desc.resize(1);
1703 
1704  switch (i) {
1705  case 0:
1706  case 1:
1707  os << ": orientation constraint g" << xyz[i];
1708  break;
1709 
1710  case 2:
1711  case 3:
1712  os << ": orientation constraint derivative w" << xyz[i - 2];
1713  break;
1714  }
1715  desc[0] = os.str();
1716  }
1717 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
static const char xyz[]
Definition: planej.cc:133
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

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

Reimplemented from SimulationEntity.

Definition at line 2472 of file planej.cc.

References ASSERT, dThetaWrapped, WithLabel::GetLabel(), StructNode::GetRCurr(), StructNode::GetWCurr(), iGetNumPrivData(), M, M_PI, MBDYN_EXCEPT_ARGS, Mat3x3::MulTV(), NTheta, pNode1, pNode2, R1h, R2h, and RotManip::VecRot().

2473 {
2474  ASSERT(i >= 1 && i <= iGetNumPrivData());
2475 
2476  switch (i) {
2477  case 1: {
2479  doublereal dThetaTmp(v(3));
2480 
2481  int n = 0;
2482 
2483  if (dThetaTmp - dThetaWrapped < -M_PI) {
2484  n++;
2485  }
2486 
2487  if (dThetaTmp - dThetaWrapped > M_PI) {
2488  n--;
2489  }
2490 
2491  return 2*M_PI*(NTheta + n) + dThetaTmp;
2492  }
2493 
2494  case 2: {
2495  Mat3x3 R2Tmp((pNode2->GetRCurr()*R2h));
2496  Vec3 v(R2Tmp.MulTV(pNode2->GetWCurr()-pNode1->GetWCurr()));
2497 
2498  return v(3);
2499  }
2500 
2501  case 3:
2502  case 4:
2503  case 5:
2504  return M(i - 2);
2505  }
2506 
2507  silent_cerr("PlaneRotationJoint(" << GetLabel() << "): "
2508  "illegal private data " << i << std::endl);
2510 }
#define M_PI
Definition: gradienttest.cc:67
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Definition: matvec3.h:98
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
Vec3 VecRot(const Mat3x3 &Phi)
Definition: Rot.cc:136
doublereal dThetaWrapped
Definition: planej.h:222
virtual unsigned int iGetNumPrivData(void) const
Definition: planej.cc:2432
virtual const Vec3 & GetWCurr(void) const
Definition: strnode.h:1030
#define ASSERT(expression)
Definition: colamd.c:977
const StructNode * pNode2
Definition: planej.h:217
double doublereal
Definition: colamd.c:52
const StructNode * pNode1
Definition: planej.h:216
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

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

Reimplemented from Elem.

Definition at line 331 of file planej.h.

References pNode1, and pNode2.

331  {
332  connectedNodes.resize(2);
333  connectedNodes[0] = pNode1;
334  connectedNodes[1] = pNode2;
335  };
const StructNode * pNode2
Definition: planej.h:217
const StructNode * pNode1
Definition: planej.h:216
DofOrder::Order PlaneRotationJoint::GetDofType ( unsigned int  i) const
inlinevirtual

Reimplemented from Elem.

Definition at line 268 of file planej.h.

References DofOrder::ALGEBRAIC, and ASSERT.

268  {
269  ASSERT(i >= 0 && i < 2);
270  return DofOrder::ALGEBRAIC;
271  };
#define ASSERT(expression)
Definition: colamd.c:977
DofOrder::Order PlaneRotationJoint::GetEqType ( unsigned int  i) const
virtual

Reimplemented from SimulationEntity.

Definition at line 2018 of file planej.cc.

References DofOrder::ALGEBRAIC, ASSERTMSGBREAK, and iGetNumDof().

2019 {
2020  ASSERTMSGBREAK(i < iGetNumDof(),
2021  "INDEX ERROR in PlaneRotationJoint::GetEqType");
2022  return DofOrder::ALGEBRAIC;
2023 }
virtual unsigned int iGetNumDof(void) const
Definition: planej.h:250
#define ASSERTMSGBREAK(expr, msg)
Definition: myassert.h:222

Here is the call graph for this function:

virtual Joint::Type PlaneRotationJoint::GetJointType ( void  ) const
inlinevirtual

Implements Joint.

Definition at line 246 of file planej.h.

References Joint::PLANEROTATION.

246  {
247  return Joint::PLANEROTATION;
248  };
virtual unsigned int PlaneRotationJoint::iGetInitialNumDof ( void  ) const
inlinevirtual

Implements SubjectToInitialAssembly.

Definition at line 306 of file planej.h.

306  {
307  return 2+2;
308  };
virtual unsigned int PlaneRotationJoint::iGetNumDof ( void  ) const
inlinevirtual

Reimplemented from Elem.

Definition at line 250 of file planej.h.

Referenced by GetEqType().

250  {
251  return 2;
252  };
unsigned int PlaneRotationJoint::iGetNumPrivData ( void  ) const
virtual

Reimplemented from SimulationEntity.

Definition at line 2432 of file planej.cc.

Referenced by dGetPrivData().

2433 {
2434  return 5;
2435 }
unsigned int PlaneRotationJoint::iGetPrivDataIdx ( const char *  s) const
virtual

Reimplemented from SimulationEntity.

Definition at line 2438 of file planej.cc.

References ASSERT.

2439 {
2440  ASSERT(s != NULL);
2441 
2442  unsigned int idx = 0;
2443 
2444  switch (s[0]) {
2445  case 'w':
2446  idx++;
2447  case 'r':
2448  idx++;
2449  if (s[1] == 'z') {
2450  return idx;
2451  }
2452  break;
2453 
2454  case 'M':
2455  idx += 2;
2456 
2457  switch (s[1]) {
2458  case 'x':
2459  return idx + 1;
2460 
2461  case 'y':
2462  return idx + 2;
2463 
2464  case 'z':
2465  return idx + 3;
2466  }
2467  }
2468 
2469  return 0;
2470 }
#define ASSERT(expression)
Definition: colamd.c:977
VariableSubMatrixHandler & PlaneRotationJoint::InitialAssJac ( VariableSubMatrixHandler WorkMat,
const VectorHandler XCurr 
)
virtual

Implements SubjectToInitialAssembly.

Definition at line 2133 of file planej.cc.

References FullSubMatrixHandler::Add(), Vec3::Cross(), Vec3::dGet(), WithLabel::GetLabel(), StructNode::GetRRef(), Mat3x3::GetVec(), StructNode::GetWRef(), DofOwnerOwner::iGetFirstIndex(), StructDispNode::iGetFirstPositionIndex(), InitialWorkSpaceDim(), M, MatCross, MatCrossCross, MBDYN_EXCEPT_ARGS, pNode1, pNode2, FullSubMatrixHandler::PutCoef(), FullSubMatrixHandler::PutColIndex(), FullSubMatrixHandler::PutRowIndex(), R1h, R2h, FullSubMatrixHandler::ResizeReset(), VariableSubMatrixHandler::SetFull(), and FullSubMatrixHandler::Sub().

2135 {
2136  /* Per ora usa la matrice piena; eventualmente si puo'
2137  * passare a quella sparsa quando si ottimizza */
2138  FullSubMatrixHandler& WM = WorkMat.SetFull();
2139 
2140  /* Dimensiona e resetta la matrice di lavoro */
2141  integer iNumRows = 0;
2142  integer iNumCols = 0;
2143  InitialWorkSpaceDim(&iNumRows, &iNumCols);
2144  WM.ResizeReset(iNumRows, iNumCols);
2145 
2146  /* Equazioni: vedi joints.dvi */
2147 
2148  /* equazioni ed incognite
2149  * F1 Delta_x1 0+1 = 1
2150  * M1 Delta_g1 3+1 = 4
2151  * FP1 Delta_xP1 6+1 = 7
2152  * MP1 Delta_w1 9+1 = 10
2153  * F2 Delta_x2 12+1 = 13
2154  * M2 Delta_g2 15+1 = 16
2155  * FP2 Delta_xP2 18+1 = 19
2156  * MP2 Delta_w2 21+1 = 22
2157  * vincolo spostamento Delta_F 24+1 = 25
2158  * vincolo rotazione Delta_M 27+1 = 28
2159  * derivata vincolo spostamento Delta_FP 29+1 = 30
2160  * derivata vincolo rotazione Delta_MP 32+1 = 33
2161  */
2162 
2163 
2164  /* Indici */
2165  integer iNode1FirstPosIndex = pNode1->iGetFirstPositionIndex()+3;
2166  integer iNode1FirstVelIndex = iNode1FirstPosIndex+6+3;
2167  integer iNode2FirstPosIndex = pNode2->iGetFirstPositionIndex()+3;
2168  integer iNode2FirstVelIndex = iNode2FirstPosIndex+6+3;
2169  integer iFirstReactionIndex = iGetFirstIndex();
2170  integer iReactionPrimeIndex = iFirstReactionIndex+2;
2171 
2172  /* Nota: le reazioni vincolari sono:
2173  * Forza, 3 incognite, riferimento globale,
2174  * Momento, 2 incognite, riferimento locale
2175  */
2176 
2177  /* Setta gli indici dei nodi */
2178  for (int iCnt = 1; iCnt <= 3; iCnt++) {
2179  WM.PutRowIndex(iCnt, iNode1FirstPosIndex+iCnt);
2180  WM.PutColIndex(iCnt, iNode1FirstPosIndex+iCnt);
2181  WM.PutRowIndex(3+iCnt, iNode1FirstVelIndex+iCnt);
2182  WM.PutColIndex(3+iCnt, iNode1FirstVelIndex+iCnt);
2183  WM.PutRowIndex(6+iCnt, iNode2FirstPosIndex+iCnt);
2184  WM.PutColIndex(6+iCnt, iNode2FirstPosIndex+iCnt);
2185  WM.PutRowIndex(9+iCnt, iNode2FirstVelIndex+iCnt);
2186  WM.PutColIndex(9+iCnt, iNode2FirstVelIndex+iCnt);
2187  }
2188 
2189  /* Setta gli indici delle reazioni */
2190  for (int iCnt = 1; iCnt <= 4; iCnt++) {
2191  WM.PutRowIndex(12+iCnt, iFirstReactionIndex+iCnt);
2192  WM.PutColIndex(12+iCnt, iFirstReactionIndex+iCnt);
2193  }
2194 
2195 
2196  /* Recupera i dati */
2197  const Mat3x3& R1(pNode1->GetRRef());
2198  const Mat3x3& R2(pNode2->GetRRef());
2199  const Vec3& Omega1(pNode1->GetWRef());
2200  const Vec3& Omega2(pNode2->GetWRef());
2201 
2202  /* F ed M sono gia' state aggiornate da InitialAssRes */
2203  Vec3 MPrime(XCurr(iReactionPrimeIndex+1),
2204  XCurr(iReactionPrimeIndex+2),
2205  0.);
2206 
2207  /* Matrici identita' */
2208  for (int iCnt = 1; iCnt <= 3; iCnt++) {
2209  /* Contributo di forza all'equazione della forza, nodo 1 */
2210  WM.PutCoef(iCnt, 12+iCnt, 1.);
2211 
2212  /* Contrib. di der. di forza all'eq. della der. della forza, nodo 1 */
2213  WM.PutCoef(3+iCnt, 14+iCnt, 1.);
2214 
2215  /* Contributo di forza all'equazione della forza, nodo 2 */
2216  WM.PutCoef(6+iCnt, 12+iCnt, -1.);
2217 
2218  /* Contrib. di der. di forza all'eq. della der. della forza, nodo 2 */
2219  WM.PutCoef(9+iCnt, 14+iCnt, -1.);
2220  }
2221 
2222  /* Matrici di rotazione dai nodi alla cerniera nel sistema globale */
2223  Mat3x3 R1hTmp(R1*R1h);
2224  Mat3x3 R2hTmp(R2*R2h);
2225 
2226  Vec3 e3a(R1hTmp.GetVec(3));
2227  Vec3 e1b(R2hTmp.GetVec(1));
2228  Vec3 e2b(R2hTmp.GetVec(2));
2229 
2230  /* Ruota il momento e la sua derivata con le matrici della cerniera
2231  * rispetto ai nodi */
2232  Vec3 MTmp(e2b*M.dGet(1)-e1b*M.dGet(2));
2233  Vec3 MPrimeTmp(e2b*MPrime.dGet(1)-e1b*MPrime.dGet(2));
2234 
2235  Mat3x3 MDeltag1((Mat3x3(MatCross, Omega2.Cross(MTmp) + MPrimeTmp)
2236  + Mat3x3(MatCrossCross, MTmp, Omega1))*Mat3x3(MatCross, e3a));
2237  Mat3x3 MDeltag2(Mat3x3(MatCrossCross, Omega1.Cross(e3a), MTmp)
2238  + Mat3x3(MatCrossCross, e3a, MPrimeTmp)
2239  + e3a.Cross(Mat3x3(MatCrossCross, Omega2, MTmp)));
2240 
2241  /* Vettori temporanei */
2242  Vec3 Tmp1(e2b.Cross(e3a));
2243  Vec3 Tmp2(e3a.Cross(e1b));
2244 
2245  /* Prodotto vettore tra il versore 3 della cerniera secondo il nodo 1
2246  * ed il versore 1 della cerniera secondo il nodo 2. A convergenza
2247  * devono essere ortogonali, quindi il loro prodotto vettore deve essere
2248  * unitario */
2249 
2250  /* Error handling: il programma si ferma, pero' segnala dov'e' l'errore */
2251  if (Tmp1.Dot() <= std::numeric_limits<doublereal>::epsilon() || Tmp2.Dot() <= std::numeric_limits<doublereal>::epsilon()) {
2252  silent_cerr("PlaneRotationJoint(" << GetLabel() << "): "
2253  "first and second node hinge axes are (nearly) orthogonal"
2254  << std::endl);
2256  }
2257 
2258  Vec3 TmpPrime1(e2b.Cross(Omega1.Cross(e3a))-e3a.Cross(Omega2.Cross(e2b)));
2259  Vec3 TmpPrime2(e3a.Cross(Omega2.Cross(e1b))-e1b.Cross(Omega1.Cross(e3a)));
2260 
2261  /* Equazione di momento, nodo 1 */
2262  WM.Sub(4, 4, Mat3x3(MatCrossCross, MTmp, e3a));
2263  WM.Add(4, 16, Mat3x3(MatCrossCross, e3a, MTmp));
2264  for (int iCnt = 1; iCnt <= 3; iCnt++) {
2265  WM.PutCoef(iCnt, 13, Tmp1.dGet(iCnt));
2266  WM.PutCoef(iCnt, 14, Tmp2.dGet(iCnt));
2267  }
2268 
2269  /* Equazione di momento, nodo 2 */
2270  WM.Add(7, 1, Mat3x3(MatCrossCross, MTmp, e3a));
2271  WM.Sub(7, 7, Mat3x3(MatCrossCross, e3a, MTmp));
2272  for (int iCnt = 1; iCnt <= 3; iCnt++) {
2273  WM.PutCoef(6+iCnt, 13, -Tmp1(iCnt));
2274  WM.PutCoef(6+iCnt, 14, -Tmp2(iCnt));
2275  }
2276 
2277  /* Derivata dell'equazione di momento, nodo 1 */
2278  WM.Sub(4, 1, MDeltag1);
2279  WM.Sub(4, 4, Mat3x3(MatCrossCross, MTmp, e3a));
2280  WM.Add(4, 7, MDeltag2);
2281  WM.Add(4, 10, Mat3x3(MatCrossCross, e3a, MTmp));
2282 
2283  for (int iCnt = 1; iCnt <= 3; iCnt++) {
2284  WM.PutCoef(3+iCnt, 13, TmpPrime1(iCnt));
2285  WM.PutCoef(3+iCnt, 14, TmpPrime2(iCnt));
2286  WM.PutCoef(3+iCnt, 15, Tmp1(iCnt));
2287  WM.PutCoef(3+iCnt, 16, Tmp2(iCnt));
2288  }
2289 
2290  /* Derivata dell'equazione di momento, nodo 2 */
2291  WM.Add(10, 1, MDeltag1);
2292  WM.Add(10, 4, Mat3x3(MatCrossCross, MTmp, e3a));
2293  WM.Sub(10, 7, MDeltag2);
2294  WM.Sub(10, 10, Mat3x3(MatCrossCross, e3a, MTmp));
2295 
2296  for (int iCnt = 1; iCnt <= 3; iCnt++) {
2297  WM.PutCoef(9+iCnt, 13, -TmpPrime1(iCnt));
2298  WM.PutCoef(9+iCnt, 14, -TmpPrime2(iCnt));
2299  WM.PutCoef(9+iCnt, 15, -Tmp1(iCnt));
2300  WM.PutCoef(9+iCnt, 16, -Tmp2(iCnt));
2301  }
2302 
2303  /* Equazioni di vincolo di rotazione: e1b~e3a, e2b~e3a */
2304 
2305  for (int iCnt = 1; iCnt <= 3; iCnt++) {
2306  doublereal d = Tmp1(iCnt);
2307  WM.PutCoef(13, iCnt, d);
2308  WM.PutCoef(13, 6+iCnt, -d);
2309 
2310  /* Queste sono per la derivata dell'equazione, sono qui solo per
2311  * ottimizzazione */
2312  WM.PutCoef(15, 3+iCnt, d);
2313  WM.PutCoef(15, 9+iCnt, -d);
2314 
2315  d = Tmp2(iCnt);
2316  WM.PutCoef(14, iCnt, -d);
2317  WM.PutCoef(14, 6+iCnt, d);
2318 
2319  /* Queste sono per la derivata dell'equazione, sono qui solo per
2320  * ottimizzazione */
2321  WM.PutCoef(16, 3+iCnt, -d);
2322  WM.PutCoef(16, 9+iCnt, d);
2323  }
2324 
2325  /* Derivate delle equazioni di vincolo di rotazione: e1b~e3a, e2b~e3a */
2326  Vec3 O1mO2(Omega1 - Omega2);
2327  TmpPrime1 = e3a.Cross(O1mO2.Cross(e2b));
2328  TmpPrime2 = e2b.Cross(e3a.Cross(O1mO2));
2329  for (int iCnt = 1; iCnt <= 3; iCnt++) {
2330  WM.PutCoef(15, iCnt, TmpPrime1(iCnt));
2331  WM.PutCoef(15, 6+iCnt, TmpPrime2(iCnt));
2332  }
2333 
2334  TmpPrime1 = e3a.Cross(O1mO2.Cross(e1b));
2335  TmpPrime2 = e1b.Cross(e3a.Cross(O1mO2));
2336  for (int iCnt = 1; iCnt <= 3; iCnt++) {
2337  WM.PutCoef(16, iCnt, TmpPrime1(iCnt));
2338  WM.PutCoef(16, 6+iCnt, TmpPrime2(iCnt));
2339  }
2340 
2341  return WorkMat;
2342 }
void PutColIndex(integer iSubCol, integer iCol)
Definition: submat.h:325
virtual const Mat3x3 & GetRRef(void) const
Definition: strnode.h:1006
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Definition: matvec3.h:98
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
void PutCoef(integer iRow, integer iCol, const doublereal &dCoef)
Definition: submat.h:672
virtual const Vec3 & GetWRef(void) const
Definition: strnode.h:1024
const doublereal & dGet(unsigned short int iRow) const
Definition: matvec3.h:285
virtual integer iGetFirstPositionIndex(void) const
Definition: strnode.h:452
virtual void ResizeReset(integer, integer)
Definition: submat.cc:182
const MatCrossCross_Manip MatCrossCross
Definition: matvec3.cc:640
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: planej.h:309
void PutRowIndex(integer iSubRow, integer iRow)
Definition: submat.h:311
void Sub(integer iRow, integer iCol, const Vec3 &v)
Definition: submat.cc:215
const StructNode * pNode2
Definition: planej.h:217
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
double doublereal
Definition: colamd.c:52
const StructNode * pNode1
Definition: planej.h:216
long int integer
Definition: colamd.c:51
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

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

Implements SubjectToInitialAssembly.

Definition at line 2347 of file planej.cc.

References VectorHandler::Add(), grad::Cross(), DEBUGCOUT, Vec3::dGet(), StructNode::GetRCurr(), Mat3x3::GetVec(), StructNode::GetWCurr(), DofOwnerOwner::iGetFirstIndex(), StructDispNode::iGetFirstPositionIndex(), InitialWorkSpaceDim(), M, pNode1, pNode2, VectorHandler::PutCoef(), SubVectorHandler::PutRowIndex(), R1h, R2h, VectorHandler::ResizeReset(), and VectorHandler::Sub().

2349 {
2350  DEBUGCOUT("Entering PlaneRotationJoint::InitialAssRes()" << std::endl);
2351 
2352  /* Dimensiona e resetta la matrice di lavoro */
2353  integer iNumRows = 0;
2354  integer iNumCols = 0;
2355  InitialWorkSpaceDim(&iNumRows, &iNumCols);
2356  WorkVec.ResizeReset(iNumRows);
2357 
2358  /* Indici */
2359  integer iNode1FirstPosIndex = pNode1->iGetFirstPositionIndex()+3;
2360  integer iNode1FirstVelIndex = iNode1FirstPosIndex+6+3;
2361  integer iNode2FirstPosIndex = pNode2->iGetFirstPositionIndex()+3;
2362  integer iNode2FirstVelIndex = iNode2FirstPosIndex+6+3;
2363  integer iFirstReactionIndex = iGetFirstIndex();
2364  integer iReactionPrimeIndex = iFirstReactionIndex+2;
2365 
2366  /* Setta gli indici */
2367  for (int iCnt = 1; iCnt <= 3; iCnt++) {
2368  WorkVec.PutRowIndex(iCnt, iNode1FirstPosIndex+iCnt);
2369  WorkVec.PutRowIndex(3+iCnt, iNode1FirstVelIndex+iCnt);
2370  WorkVec.PutRowIndex(6+iCnt, iNode2FirstPosIndex+iCnt);
2371  WorkVec.PutRowIndex(9+iCnt, iNode2FirstVelIndex+iCnt);
2372  }
2373 
2374  for (int iCnt = 1; iCnt <= 4; iCnt++) {
2375  WorkVec.PutRowIndex(12+iCnt, iFirstReactionIndex+iCnt);
2376  }
2377 
2378  /* Recupera i dati */
2379  const Mat3x3& R1(pNode1->GetRCurr());
2380  const Mat3x3& R2(pNode2->GetRCurr());
2381  const Vec3& Omega1(pNode1->GetWCurr());
2382  const Vec3& Omega2(pNode2->GetWCurr());
2383 
2384  /* Aggiorna F ed M, che restano anche per InitialAssJac */
2385  M = Vec3(XCurr(iFirstReactionIndex+1),
2386  XCurr(iFirstReactionIndex+2),
2387  0.);
2388  Vec3 MPrime(XCurr(iReactionPrimeIndex+1),
2389  XCurr(iReactionPrimeIndex+2),
2390  0.);
2391 
2392  /* Distanza nel sistema globale */
2393  Mat3x3 R1hTmp(R1*R1h);
2394  Mat3x3 R2hTmp(R2*R2h);
2395 
2396  Vec3 e3a(R1hTmp.GetVec(3));
2397  Vec3 e1b(R2hTmp.GetVec(1));
2398  Vec3 e2b(R2hTmp.GetVec(2));
2399 
2400  /* Ruota il momento e la sua derivata con le matrici della cerniera
2401  * rispetto ai nodi */
2402  Vec3 MTmp(e2b*M.dGet(1)-e1b*M.dGet(2));
2403  Vec3 MPrimeTmp(e3a.Cross(MTmp.Cross(Omega2))+MTmp.Cross(Omega1.Cross(e3a))+
2404  e2b.Cross(e3a)*MPrime.dGet(1)+e3a.Cross(e1b)*MPrime.dGet(2));
2405 
2406  /* Equazioni di equilibrio, nodo 1 */
2407  WorkVec.Sub(1, MTmp.Cross(e3a));
2408 
2409  /* Derivate delle equazioni di equilibrio, nodo 1 */
2410  WorkVec.Sub(4, MPrimeTmp);
2411 
2412  /* Equazioni di equilibrio, nodo 2 */
2413  WorkVec.Add(7, MTmp.Cross(e3a));
2414 
2415  /* Derivate delle equazioni di equilibrio, nodo 2 */
2416  WorkVec.Add(10, MPrimeTmp);
2417 
2418  /* Equazioni di vincolo di rotazione */
2419  WorkVec.PutCoef(13, e2b.Dot(e3a));
2420  WorkVec.PutCoef(14, e1b.Dot(e3a));
2421 
2422  /* Derivate delle equazioni di vincolo di rotazione: e1b~e3a, e2b~e3a */
2423  Vec3 Tmp((Omega1-Omega2).Cross(e3a));
2424  WorkVec.PutCoef(15, e2b.Dot(Tmp));
2425  WorkVec.PutCoef(16, e1b.Dot(Tmp));
2426 
2427  return WorkVec;
2428 }
Definition: matvec3.h:98
virtual void ResizeReset(integer)
Definition: vh.cc:55
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
virtual void Sub(integer iRow, const Vec3 &v)
Definition: vh.cc:78
virtual void PutRowIndex(integer iSubRow, integer iRow)=0
#define DEBUGCOUT(msg)
Definition: myassert.h:232
virtual integer iGetFirstPositionIndex(void) const
Definition: strnode.h:452
virtual const Vec3 & GetWCurr(void) const
Definition: strnode.h:1030
virtual void PutCoef(integer iRow, const doublereal &dCoef)=0
VectorExpression< VectorCrossExpr< VectorLhsExpr, VectorRhsExpr >, 3 > Cross(const VectorExpression< VectorLhsExpr, 3 > &u, const VectorExpression< VectorRhsExpr, 3 > &v)
Definition: matvec.h:3248
virtual void Add(integer iRow, const Vec3 &v)
Definition: vh.cc:63
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: planej.h:309
const StructNode * pNode2
Definition: planej.h:217
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
const StructNode * pNode1
Definition: planej.h:216
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

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

Implements SubjectToInitialAssembly.

Definition at line 309 of file planej.h.

Referenced by InitialAssJac(), and InitialAssRes().

310  {
311  *piNumRows = 3+3+3+3+2+2;
312  *piNumCols = 3+3+3+3+2+2;
313  };
void PlaneRotationJoint::Output ( OutputHandler OH) const
virtual

Reimplemented from ToBeOutput.

Definition at line 2045 of file planej.cc.

References ToBeOutput::bToBeOutput(), dRaDegr, EULER_123, EULER_313, EULER_321, OutputHandler::GetCurrentStep(), WithLabel::GetLabel(), StructNode::GetRCurr(), StructNode::GetWCurr(), OutputHandler::JOINTS, OutputHandler::Joints(), M, MatR2EulerAngles123(), MatR2EulerAngles313(), MatR2EulerAngles321(), od, ORIENTATION_MATRIX, ORIENTATION_VECTOR, Joint::Output(), Vec3::pGetVec(), pNode1, pNode2, R1h, R2h, OutputHandler::UseNetCDF(), OutputHandler::UseText(), RotManip::VecRot(), and Zero3.

2046 {
2047  if (bToBeOutput()) {
2048  Mat3x3 R2Tmp(pNode2->GetRCurr()*R2h);
2049  Mat3x3 RTmp((pNode1->GetRCurr()*R1h).MulTM(R2Tmp));
2050  Vec3 E;
2051  switch (od) {
2052  case EULER_123:
2053  E = MatR2EulerAngles123(RTmp)*dRaDegr;
2054  break;
2055 
2056  case EULER_313:
2057  E = MatR2EulerAngles313(RTmp)*dRaDegr;
2058  break;
2059 
2060  case EULER_321:
2061  E = MatR2EulerAngles321(RTmp)*dRaDegr;
2062  break;
2063 
2064  case ORIENTATION_VECTOR:
2065  E = RotManip::VecRot(RTmp);
2066  break;
2067 
2068  case ORIENTATION_MATRIX:
2069  break;
2070 
2071  default:
2072  /* impossible */
2073  break;
2074  }
2075  Vec3 OmegaTmp(R2Tmp.MulTV(pNode2->GetWCurr()-pNode1->GetWCurr()));
2076 
2077 #ifdef USE_NETCDF
2078  if (OH.UseNetCDF(OutputHandler::JOINTS)) {
2079  Var_F_local->put_rec(Zero3.pGetVec(), OH.GetCurrentStep());
2080  Var_M_local->put_rec(M.pGetVec(), OH.GetCurrentStep());
2081  Var_F_global->put_rec(Zero3.pGetVec(), OH.GetCurrentStep());
2082  Var_M_global->put_rec((R2Tmp*M).pGetVec(), OH.GetCurrentStep());
2083  switch (od) {
2084  case EULER_123:
2085  case EULER_313:
2086  case EULER_321:
2087  case ORIENTATION_VECTOR:
2088  Var_Phi->put_rec(E.pGetVec(), OH.GetCurrentStep());
2089  break;
2090 
2091  case ORIENTATION_MATRIX:
2092  Var_Phi->put_rec(RTmp.pGetMat(), OH.GetCurrentStep());
2093  break;
2094 
2095  default:
2096  /* impossible */
2097  break;
2098  }
2099 
2100  Var_Omega->put_rec(OmegaTmp.pGetVec(), OH.GetCurrentStep());
2101  }
2102 #endif // USE_NETCDF
2103  if (OH.UseText(OutputHandler::JOINTS)) {
2104  Joint::Output(OH.Joints(), "PlaneRotation", GetLabel(),
2105  Zero3, M, Zero3, R2Tmp*M)
2106  << " ";
2107 
2108  switch (od) {
2109  case EULER_123:
2110  case EULER_313:
2111  case EULER_321:
2112  case ORIENTATION_VECTOR:
2113  OH.Joints() << E;
2114  break;
2115 
2116  case ORIENTATION_MATRIX:
2117  OH.Joints() << RTmp;
2118  break;
2119 
2120  default:
2121  /* impossible */
2122  break;
2123  }
2124 
2125  OH.Joints() << " " << OmegaTmp << std::endl;
2126  }
2127  }
2128 }
const Vec3 Zero3(0., 0., 0.)
virtual bool bToBeOutput(void) const
Definition: output.cc:890
OrientationDescription od
Definition: planej.h:229
Definition: matvec3.h:98
bool UseNetCDF(int out) const
Definition: output.cc:491
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
Vec3 VecRot(const Mat3x3 &Phi)
Definition: Rot.cc:136
Vec3 MatR2EulerAngles313(const Mat3x3 &R)
Definition: matvec3.cc:927
long GetCurrentStep(void) const
Definition: output.h:116
Vec3 MatR2EulerAngles123(const Mat3x3 &R)
Definition: matvec3.cc:893
virtual const Vec3 & GetWCurr(void) const
Definition: strnode.h:1030
const doublereal dRaDegr
Definition: matvec3.cc:884
std::ostream & Joints(void) const
Definition: output.h:443
const doublereal * pGetVec(void) const
Definition: matvec3.h:192
Vec3 MatR2EulerAngles321(const Mat3x3 &R)
Definition: matvec3.cc:941
const StructNode * pNode2
Definition: planej.h:217
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
const StructNode * pNode1
Definition: planej.h:216
unsigned int GetLabel(void) const
Definition: withlab.cc:62
bool UseText(int out) const
Definition: output.cc:446

Here is the call graph for this function:

void PlaneRotationJoint::OutputPrepare ( OutputHandler OH)
virtual

Reimplemented from ToBeOutput.

Definition at line 2027 of file planej.cc.

References ToBeOutput::bToBeOutput(), OutputHandler::JOINTS, od, Joint::OutputPrepare_int(), and OutputHandler::UseNetCDF().

2028 {
2029  if (bToBeOutput()) {
2030 #ifdef USE_NETCDF
2031  if (OH.UseNetCDF(OutputHandler::JOINTS)) {
2032  std::string name;
2033  OutputPrepare_int("revolute rotation", OH, name);
2034 
2035  Var_Phi = OH.CreateRotationVar(name, "", od, "global");
2036 
2037  Var_Omega = OH.CreateVar<Vec3>(name + "Omega", "radian/s",
2038  "local relative angular velocity (x, y, z)");
2039  }
2040 #endif // USE_NETCDF
2041  }
2042 }
virtual bool bToBeOutput(void) const
Definition: output.cc:890
OrientationDescription od
Definition: planej.h:229
Definition: matvec3.h:98
bool UseNetCDF(int out) const
Definition: output.cc:491
virtual void OutputPrepare_int(const std::string &type, OutputHandler &OH, std::string &name)
Definition: joint.cc:107

Here is the call graph for this function:

Hint * PlaneRotationJoint::ParseHint ( DataManager pDM,
const char *  s 
) const
virtual

Reimplemented from SimulationEntity.

Definition at line 1750 of file planej.cc.

References STRLENOF.

1751 {
1752  if (strncasecmp(s, "hinge{" /*}*/, STRLENOF("hinge{" /*}*/)) == 0) {
1753  s += STRLENOF("hinge{" /*}*/);
1754 
1755  if (strcmp(&s[1], /*{*/ "}") != 0) {
1756  return 0;
1757  }
1758 
1759  switch (s[0]) {
1760  case '1':
1761  return new Joint::HingeHint<1>;
1762 
1763  case '2':
1764  return new Joint::HingeHint<2>;
1765  }
1766  }
1767 
1768  return 0;
1769 }
#define STRLENOF(s)
Definition: mbdyn.h:166
std::ostream & PlaneRotationJoint::Restart ( std::ostream &  out) const
virtual

Implements Elem.

Definition at line 1796 of file planej.cc.

References WithLabel::GetLabel(), Mat3x3::GetVec(), pNode1, pNode2, R1h, R2h, Joint::Restart(), and Write().

1797 {
1798  Joint::Restart(out) << ", revolute hinge, "
1799  << pNode1->GetLabel()
1800  << ", hinge, reference, node, 1, ", (R1h.GetVec(1)).Write(out, ", ")
1801  << ", 2, ", (R1h.GetVec(2)).Write(out, ", ") << ", "
1802  << pNode2->GetLabel()
1803  << ", hinge, reference, node, 1, ", (R2h.GetVec(1)).Write(out, ", ")
1804  << ", 2, ", (R2h.GetVec(2)).Write(out, ", ") << ';' << std::endl;
1805 
1806  return out;
1807 }
std::ostream & Write(std::ostream &out, const FullMatrixHandler &m, const char *s, const char *s2)
Definition: fullmh.cc:376
Vec3 GetVec(unsigned short int i) const
Definition: matvec3.h:893
virtual std::ostream & Restart(std::ostream &out) const
Definition: joint.h:195
const StructNode * pNode2
Definition: planej.h:217
const StructNode * pNode1
Definition: planej.h:216
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

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

Reimplemented from Joint.

Definition at line 1720 of file planej.cc.

References dTheta, dThetaWrapped, StructNode::GetRCurr(), Mat3x3::MulTM(), pNode1, pNode2, R1h, R2h, and RotManip::VecRot().

1723 {
1724  if (ph) {
1725  for (unsigned i = 0; i < ph->size(); i++) {
1726  Joint::JointHint *pjh = dynamic_cast<Joint::JointHint *>((*ph)[i]);
1727 
1728  if (pjh == 0) {
1729  continue;
1730  }
1731 
1732  if (dynamic_cast<Joint::HingeHint<1> *>(pjh)) {
1734 
1735  } else if (dynamic_cast<Joint::HingeHint<2> *>(pjh)) {
1737 
1738  } else if (dynamic_cast<Joint::ReactionsHint *>(pjh)) {
1739  /* TODO */
1740  }
1741  }
1742  }
1743 
1745 
1746  dThetaWrapped = dTheta = v.dGet(3);
1747 }
Definition: matvec3.h:98
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
Vec3 VecRot(const Mat3x3 &Phi)
Definition: Rot.cc:136
doublereal dThetaWrapped
Definition: planej.h:222
doublereal dTheta
Definition: planej.h:222
Mat3x3 MulTM(const Mat3x3 &m) const
Definition: matvec3.cc:500
const StructNode * pNode2
Definition: planej.h:217
const StructNode * pNode1
Definition: planej.h:216

Here is the call graph for this function:

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

Implements Elem.

Definition at line 283 of file planej.h.

Referenced by AssJac(), and AssRes().

283  {
284  *piNumRows = 3+3+2;
285  *piNumCols = 3+3+2;
286  };

Member Data Documentation

doublereal PlaneRotationJoint::dTheta
mutableprivate

Definition at line 222 of file planej.h.

Referenced by AfterConvergence(), and SetValue().

doublereal PlaneRotationJoint::dThetaWrapped
mutableprivate

Definition at line 222 of file planej.h.

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

Vec3 PlaneRotationJoint::M
private

Definition at line 220 of file planej.h.

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

int PlaneRotationJoint::NTheta
mutableprivate

Definition at line 221 of file planej.h.

Referenced by AfterConvergence(), and dGetPrivData().

OrientationDescription PlaneRotationJoint::od
protected

Definition at line 229 of file planej.h.

Referenced by Output(), and OutputPrepare().

const StructNode* PlaneRotationJoint::pNode1
private
const StructNode* PlaneRotationJoint::pNode2
private
Mat3x3 PlaneRotationJoint::R1h
private
Mat3x3 PlaneRotationJoint::R2h
private

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