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

#include <strmappingext.h>

Inheritance diagram for StructMembraneMappingExtForce:
Collaboration diagram for StructMembraneMappingExtForce:

Classes

struct  NodeConnData
 

Public Member Functions

 StructMembraneMappingExtForce (unsigned int uL, DataManager *pDM, const StructNode *pRefNode, bool bUseReferenceNodeForces, bool bRotateReferenceNodeForces, std::vector< const StructDispNode * > &Nodes, std::vector< Vec3 > &Offsets, std::vector< unsigned > &Labels, std::vector< NodeConnData > &NodesConn, SpMapMatrixHandler *pH, std::vector< uint32_t > &MappedLabels, bool bLabels, bool bOutputAccelerations, unsigned uRRot, ExtFileHandlerBase *pEFH, bool bSendAfterPredict, int iCoupling, flag fOut)
 
virtual ~StructMembraneMappingExtForce (void)
 
- Public Member Functions inherited from Elem
 Elem (unsigned int uL, flag fOut)
 
virtual ~Elem (void)
 
virtual unsigned int iGetNumDof (void) const
 
virtual std::ostream & DescribeDof (std::ostream &out, const char *prefix="", bool bInitial=false) const
 
virtual void DescribeDof (std::vector< std::string > &desc, bool bInitial=false, int i=-1) const
 
virtual std::ostream & DescribeEq (std::ostream &out, const char *prefix="", bool bInitial=false) const
 
virtual void DescribeEq (std::vector< std::string > &desc, bool bInitial=false, int i=-1) const
 
virtual DofOrder::Order GetDofType (unsigned int) const
 
virtual void AssMats (VariableSubMatrixHandler &WorkMatA, VariableSubMatrixHandler &WorkMatB, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual bool bInverseDynamics (void) const
 
void SetInverseDynamicsFlags (unsigned uIDF)
 
unsigned GetInverseDynamicsFlags (void) const
 
bool bIsErgonomy (void) const
 
bool bIsRightHandSide (void) const
 
virtual VariableSubMatrixHandlerAssJac (VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
 
virtual SubVectorHandlerAssRes (SubVectorHandler &WorkVec, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr, const VectorHandler &XPrimePrimeCurr, InverseDynamics::Order iOrder=InverseDynamics::INVERSE_DYNAMICS)
 
virtual int GetNumConnectedNodes (void) const
 
- Public Member Functions inherited from WithLabel
 WithLabel (unsigned int uL=0, const std::string &sN="")
 
virtual ~WithLabel (void)
 
void PutLabel (unsigned int uL)
 
void PutName (const std::string &sN)
 
unsigned int GetLabel (void) const
 
const std::string & GetName (void) const
 
- Public Member Functions inherited from SimulationEntity
 SimulationEntity (void)
 
virtual ~SimulationEntity (void)
 
virtual bool bIsValidIndex (unsigned int i) const
 
virtual DofOrder::Order GetEqType (unsigned int i) const
 
virtual HintParseHint (DataManager *pDM, const char *s) const
 
virtual void BeforePredict (VectorHandler &, VectorHandler &, VectorHandler &, VectorHandler &) const
 
virtual void DerivativesUpdate (const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual void Update (const VectorHandler &XCurr, InverseDynamics::Order iOrder)
 
virtual void AfterConvergence (const VectorHandler &X, const VectorHandler &XP, const VectorHandler &XPP)
 
virtual unsigned int iGetNumPrivData (void) const
 
virtual unsigned int iGetPrivDataIdx (const char *s) const
 
virtual doublereal dGetPrivData (unsigned int i) const
 
virtual std::ostream & OutputAppend (std::ostream &out) const
 
virtual void ReadInitialState (MBDynParser &HP)
 
- Public Member Functions inherited from ToBeOutput
 ToBeOutput (flag fOut=fDefaultOut)
 
virtual ~ToBeOutput (void)
 
virtual void OutputPrepare (OutputHandler &OH)
 
virtual void Output (OutputHandler &OH, const VectorHandler &X, const VectorHandler &XP) const
 
virtual flag fToBeOutput (void) const
 
virtual bool bToBeOutput (void) const
 
virtual void SetOutputFlag (flag f=flag(1))
 
- Public Member Functions inherited from StructMappingExtForce
 StructMappingExtForce (unsigned int uL, DataManager *pDM, const StructNode *pRefNode, bool bUseReferenceNodeForces, bool bRotateReferenceNodeForces, std::vector< const StructDispNode * > &Nodes, std::vector< Vec3 > &Offsets, std::vector< unsigned > &Labels, SpMapMatrixHandler *pH, std::vector< uint32_t > &MappedLabels, bool bLabels, bool bOutputAccelerations, unsigned uRRot, ExtFileHandlerBase *pEFH, bool bSendAfterPredict, int iCoupling, flag fOut)
 
virtual ~StructMappingExtForce (void)
 
virtual Force::Type GetForceType (void) const
 
void WorkSpaceDim (integer *piNumRows, integer *piNumCols) const
 
SubVectorHandlerAssRes (SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual void Output (OutputHandler &OH) const
 
virtual void GetConnectedNodes (std::vector< const Node * > &connectedNodes) const
 
- Public Member Functions inherited from ExtForce
 ExtForce (unsigned int uL, DataManager *pDM, ExtFileHandlerBase *pEFH, bool bSendAfterPredict, int iCoupling, flag fOut)
 
virtual ~ExtForce (void)
 
virtual void SetValue (DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *h=0)
 
virtual void Update (const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual void AfterConvergence (const VectorHandler &X, const VectorHandler &XP)
 
virtual void AfterPredict (VectorHandler &X, VectorHandler &XP)
 
virtual void InitialWorkSpaceDim (integer *piNumRows, integer *piNumCols) const
 
virtual VariableSubMatrixHandlerInitialAssJac (VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
 
virtual SubVectorHandlerInitialAssRes (SubVectorHandler &WorkVec, const VectorHandler &XCurr)
 
- Public Member Functions inherited from Force
 Force (unsigned int uL, flag fOut)
 
virtual ~Force (void)
 
virtual Elem::Type GetElemType (void) const
 
virtual VariableSubMatrixHandlerAssJac (VariableSubMatrixHandler &WorkMat, doublereal, const VectorHandler &, const VectorHandler &)
 
virtual std::ostream & Restart (std::ostream &out) const
 
virtual unsigned int iGetInitialNumDof (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 Member Functions

virtual void SendToStream (std::ostream &outf, ExtFileHandlerBase::SendWhen when)
 
virtual void SendToFileDes (int outfd, ExtFileHandlerBase::SendWhen when)
 
virtual void RecvFromStream (std::istream &inf)
 
virtual void RecvFromFileDes (int infd)
 
- Protected Member Functions inherited from StructMappingExtForce
bool Prepare (ExtFileHandlerBase *pEFH)
 
void Send (ExtFileHandlerBase *pEFH, ExtFileHandlerBase::SendWhen when)
 
void Recv (ExtFileHandlerBase *pEFH)
 
- Protected Member Functions inherited from ExtForce
void Send (ExtFileHandlerBase::SendWhen when)
 
void Recv (void)
 

Protected Attributes

std::vector< NodeConnDataNodesConn
 
- Protected Attributes inherited from WithLabel
unsigned int uLabel
 
std::string sName
 
- Protected Attributes inherited from ToBeOutput
flag fOutput
 
- Protected Attributes inherited from StructMappingExtForce
const StructNodepRefNode
 
bool bUseReferenceNodeForces
 
bool bRotateReferenceNodeForces
 
Vec3 F0
 
Vec3 M0
 
Vec3 F1
 
Vec3 M1
 
Vec3 F2
 
Vec3 M2
 
SpMapMatrixHandlerpH
 
unsigned m_uResSize
 
std::vector< NodeDataNodes
 
unsigned uPoints
 
unsigned uMappedPoints
 
bool bLabels
 
bool bOutputAccelerations
 
unsigned uRRot
 
std::vector< uint32_t > m_qlabels
 
STLVectorHandler m_x
 
STLVectorHandler m_xP
 
STLVectorHandler m_xPP
 
STLVectorHandler m_q
 
STLVectorHandler m_qP
 
STLVectorHandler m_qPP
 
STLVectorHandler m_f
 
STLVectorHandler m_p
 
- Protected Attributes inherited from ExtForce
Converged c
 
ExtFileHandlerBasepEFH
 
bool bSendAfterPredict
 
int iCoupling
 
int iCouplingCounter
 
bool bFirstSend
 
bool bFirstRecv
 

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 ExtForce
enum  { COUPLING_NONE = -2, COUPLING_STAGGERED = -1, COUPLING_LOOSE = 0, COUPLING_TIGHT = 1 }
 
- Public Types inherited from Force
enum  Type {
  UNKNOWN = -1, ABSTRACTFORCE = 0, ABSTRACTINTERNALFORCE, ABSOLUTEDISPFORCE,
  ABSOLUTEINTERNALDISPFORCE, ABSOLUTEFORCE, FOLLOWERFORCE, ABSOLUTECOUPLE,
  FOLLOWERCOUPLE, ABSOLUTEINTERNALFORCE, FOLLOWERINTERNALFORCE, ABSOLUTEINTERNALCOUPLE,
  FOLLOWERINTERNALCOUPLE, TOTALFORCE, TOTALINTERNALFORCE, EXTERNALSTRUCTURAL,
  MODALFORCE, EXTERNALMODAL, LASTFORCETYPE
}
 

Detailed Description

Definition at line 151 of file strmappingext.h.

Constructor & Destructor Documentation

StructMembraneMappingExtForce::StructMembraneMappingExtForce ( unsigned int  uL,
DataManager pDM,
const StructNode pRefNode,
bool  bUseReferenceNodeForces,
bool  bRotateReferenceNodeForces,
std::vector< const StructDispNode * > &  Nodes,
std::vector< Vec3 > &  Offsets,
std::vector< unsigned > &  Labels,
std::vector< NodeConnData > &  NodesConn,
SpMapMatrixHandler pH,
std::vector< uint32_t > &  MappedLabels,
bool  bLabels,
bool  bOutputAccelerations,
unsigned  uRRot,
ExtFileHandlerBase pEFH,
bool  bSendAfterPredict,
int  iCoupling,
flag  fOut 
)

Definition at line 1149 of file strmappingext.cc.

References StructMappingExtForce::Nodes, and NodesConn.

1167 : Elem(uL, fOut),
1168 StructMappingExtForce(uL, pDM,
1170  nodes, offsets, labels, pH, mappedlabels,
1172  pEFH, bSendAfterPredict, iCoupling,
1173  fOut)
1174 {
1175  NodesConn.resize(Nodes.size());
1176  for (unsigned n = 0; n < NodesConn.size(); n++) {
1177  NodesConn[n] = nodesConn[n];
1178  }
1179 }
bool bSendAfterPredict
Definition: extforce.h:196
StructMappingExtForce(unsigned int uL, DataManager *pDM, const StructNode *pRefNode, bool bUseReferenceNodeForces, bool bRotateReferenceNodeForces, std::vector< const StructDispNode * > &Nodes, std::vector< Vec3 > &Offsets, std::vector< unsigned > &Labels, SpMapMatrixHandler *pH, std::vector< uint32_t > &MappedLabels, bool bLabels, bool bOutputAccelerations, unsigned uRRot, ExtFileHandlerBase *pEFH, bool bSendAfterPredict, int iCoupling, flag fOut)
std::vector< NodeData > Nodes
Definition: strmappingext.h:73
static int labels
std::vector< NodeConnData > NodesConn
static int nodes
Elem(unsigned int uL, flag fOut)
Definition: elem.cc:41
StructMembraneMappingExtForce::~StructMembraneMappingExtForce ( void  )
virtual

Definition at line 1181 of file strmappingext.cc.

References NO_OP.

1182 {
1183  NO_OP;
1184 }
#define NO_OP
Definition: myassert.h:74

Member Function Documentation

void StructMembraneMappingExtForce::RecvFromFileDes ( int  infd)
protectedvirtual

Reimplemented from StructMappingExtForce.

Definition at line 1628 of file strmappingext.cc.

References StructMappingExtForce::bLabels, buf, StructMappingExtForce::F0, WithLabel::GetLabel(), StructNode::GetRCurr(), ExtFileHandlerBase::GetRecvFlags(), labels, StructMappingExtForce::M0, StructMappingExtForce::m_f, StructMappingExtForce::m_p, StructMappingExtForce::m_qlabels, MatrixHandler::MatTVecMul(), MBDYN_EXCEPT_ARGS, StructMappingExtForce::Nodes, NodesConn, ExtForce::pEFH, StructMappingExtForce::pH, StructMappingExtForce::pRefNode, and Zero3.

1629 {
1630 #ifdef USE_SOCKET
1631  if (pRefNode) {
1632  size_t ulen = 0;
1633  char buf[sizeof(uint32_t) + 6*sizeof(doublereal)];
1634  doublereal *f;
1635  ssize_t len;
1636 
1637  if (bLabels) {
1638  ulen = sizeof(uint32_t);
1639  }
1640 
1641  ulen += 6*sizeof(doublereal);
1642 
1643  len = recv(infd, (void *)buf, ulen, pEFH->GetRecvFlags());
1644  if (len == -1) {
1645  int save_errno = errno;
1646  char *err_msg = strerror(save_errno);
1647  silent_cerr("StructMembraneMappingExtForce(" << GetLabel() << "): "
1648  "recv() failed (" << save_errno << ": "
1649  << err_msg << ")" << std::endl);
1651 
1652  } else if (unsigned(len) != ulen) {
1653  silent_cerr("StructMembraneMappingExtForce(" << GetLabel() << "): "
1654  "recv() failed " "(got " << len << " of "
1655  << ulen << " bytes)" << std::endl);
1657  }
1658 
1659  if (bLabels) {
1660  uint32_t *uint32_ptr = (uint32_t *)buf;
1661  unsigned l = uint32_ptr[0];
1662  if (l != pRefNode->GetLabel()) {
1663  silent_cerr("StructMembraneMappingExtForce(" << GetLabel() << "): "
1664  "invalid reference node label "
1665  "(wanted " << pRefNode->GetLabel() << ", got " << l << ")"
1666  << std::endl);
1668  }
1669  f = (doublereal *)&uint32_ptr[1];
1670 
1671  } else {
1672  f = (doublereal *)buf;
1673  }
1674 
1675  F0 = Vec3(&f[0]);
1676  M0 = Vec3(&f[3]);
1677  }
1678 
1679  if (bLabels) {
1680  // Hack!
1681  ssize_t len = recv(infd, (void *)&m_p[0], sizeof(uint32_t)*m_p.size(),
1682  pEFH->GetRecvFlags());
1683  if (len == -1) {
1684  int save_errno = errno;
1685  char *err_msg = strerror(save_errno);
1686  silent_cerr("StructMembraneMappingExtForce(" << GetLabel() << "): "
1687  "recv() failed (" << save_errno << ": "
1688  << err_msg << ")" << std::endl);
1690 
1691  } else if (unsigned(len) != sizeof(double)*m_p.size()) {
1692  silent_cerr("StructMembraneMappingExtForce(" << GetLabel() << "): "
1693  "recv() failed " "(got " << len << " of "
1694  << sizeof(uint32_t)*m_p.size() << " bytes)" << std::endl);
1696  }
1697 
1698  uint32_t *labels = (uint32_t *)&m_p[0];
1699  for (unsigned l = 0; l < m_qlabels.size(); l++) {
1700  if (labels[l] != m_qlabels[l]) {
1701  silent_cerr("StructMembraneMappingExtForce(" << GetLabel() << "): "
1702  "label mismatch for point #" << l << "/" << m_qlabels.size()
1703  << " local=" << m_qlabels[l] << " remote=" << labels[l] << std::endl);
1705  }
1706  }
1707  }
1708 
1709  size_t fsize;
1710  double *fp;
1711 
1712  if (pH) {
1713  fp = &m_p[0];
1714  fsize = sizeof(double)*m_p.size();
1715 
1716  } else {
1717  fp = &m_f[0];
1718  fsize = sizeof(double)*m_f.size();
1719  }
1720 
1721  ssize_t len = recv(infd, (void *)fp, fsize, pEFH->GetRecvFlags());
1722  if (len == -1) {
1723  int save_errno = errno;
1724  char *err_msg = strerror(save_errno);
1725  silent_cerr("StructMembraneMappingExtForce(" << GetLabel() << "): "
1726  "recv() failed (" << save_errno << ": "
1727  << err_msg << ")" << std::endl);
1729 
1730  } else if (unsigned(len) != fsize) {
1731  silent_cerr("StructMembraneMappingExtForce(" << GetLabel() << "): "
1732  "recv() failed " "(got " << len << " of "
1733  << fsize << " bytes)" << std::endl);
1735  }
1736 
1737  if (pH) {
1738  pH->MatTVecMul(m_f, m_p);
1739  }
1740 
1741  if (pRefNode) {
1742  for (unsigned p3 = 0, n = 0; n < Nodes.size(); n++) {
1743  Nodes[n].F = Zero3;
1744  Nodes[n].M = Zero3;
1745  const StructNode *pNode(dynamic_cast<const StructNode *>(Nodes[n].pNode));
1746  if (pNode != 0) {
1747  for (unsigned o = 0; o < Nodes[n].Offsets.size(); o++, p3 += 3) {
1748  Nodes[n].Offsets[o].F = pRefNode->GetRCurr()*Vec3(&m_f[p3]);
1749  Nodes[n].F += Nodes[n].Offsets[o].F;
1750  Vec3 f(pNode->GetRCurr()*Nodes[n].Offsets[o].Offset);
1751  Nodes[n].M += f.Cross(Nodes[n].Offsets[o].F);
1752  }
1753 
1754  } else {
1755  if (NodesConn[n].pNode[0] != 0) {
1756  for (unsigned o = 0; o < 2; o++, p3 += 3) {
1757  Nodes[n].Offsets[o].F = pRefNode->GetRCurr()*Vec3(&m_f[p3]);
1758  Nodes[n].F += Nodes[n].Offsets[o].F;
1759  }
1760 
1761  } else {
1762  Nodes[n].Offsets[0].F = pRefNode->GetRCurr()*Vec3(&m_f[p3]);
1763  Nodes[n].F += Nodes[n].Offsets[0].F;
1764  }
1765  }
1766  }
1767 
1768  } else {
1769  for (unsigned p3 = 0, n = 0; n < Nodes.size(); n++) {
1770  Nodes[n].F = Zero3;
1771  Nodes[n].M = Zero3;
1772  const StructNode *pNode(dynamic_cast<const StructNode *>(Nodes[n].pNode));
1773  if (pNode != 0) {
1774  for (unsigned o = 0; o < Nodes[n].Offsets.size(); o++, p3 += 3) {
1775  Nodes[n].Offsets[o].F = Vec3(&m_f[p3]);
1776  Nodes[n].F += Nodes[n].Offsets[o].F;
1777  Vec3 f(pNode->GetRCurr()*Nodes[n].Offsets[o].Offset);
1778  Nodes[n].M += f.Cross(Nodes[n].Offsets[o].F);
1779  }
1780 
1781  } else {
1782  if (NodesConn[n].pNode[0] != 0) {
1783  for (unsigned o = 0; o < 2; o++, p3 += 3) {
1784  Nodes[n].Offsets[o].F = Vec3(&m_f[p3]);
1785  Nodes[n].F += Nodes[n].Offsets[o].F;
1786  }
1787 
1788  } else {
1789  Nodes[n].Offsets[0].F = Vec3(&m_f[p3]);
1790  Nodes[n].F += Nodes[n].Offsets[0].F;
1791  }
1792  }
1793  }
1794  }
1795 #else // ! USE_SOCKET
1797 #endif // ! USE_SOCKET
1798 }
const Vec3 Zero3(0., 0., 0.)
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Definition: matvec3.h:98
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
std::vector< uint32_t > m_qlabels
Definition: strmappingext.h:82
std::vector< NodeData > Nodes
Definition: strmappingext.h:73
static int labels
virtual int GetRecvFlags(void) const
Definition: extforce.cc:106
ExtFileHandlerBase * pEFH
Definition: extforce.h:193
std::vector< NodeConnData > NodesConn
STLVectorHandler m_p
Definition: strmappingext.h:92
SpMapMatrixHandler * pH
Definition: strmappingext.h:56
static doublereal buf[BUFSIZE]
Definition: discctrl.cc:333
virtual VectorHandler & MatTVecMul(VectorHandler &out, const VectorHandler &in) const
Definition: mh.cc:341
double doublereal
Definition: colamd.c:52
unsigned int GetLabel(void) const
Definition: withlab.cc:62
const StructNode * pRefNode
Definition: strmappingext.h:48
STLVectorHandler m_f
Definition: strmappingext.h:91

Here is the call graph for this function:

void StructMembraneMappingExtForce::RecvFromStream ( std::istream &  inf)
protectedvirtual

Reimplemented from StructMappingExtForce.

Definition at line 1575 of file strmappingext.cc.

References StructMappingExtForce::bLabels, StructMappingExtForce::F0, WithLabel::GetLabel(), StructMappingExtForce::M0, MBC_ROT_NONE, MBDYN_EXCEPT_ARGS, StructMappingExtForce::Nodes, Vec3::pGetVec(), StructMappingExtForce::pRefNode, and StructMappingExtForce::uRRot.

1576 {
1577 #if 0
1578  if (pRefNode) {
1579  unsigned l;
1580  doublereal *f = F0.pGetVec(), *m = M0.pGetVec();
1581 
1582  if (bLabels) {
1583  inf >> l;
1584  }
1585 
1586  inf >> f[0] >> f[1] >> f[2];
1587  if (uRRot != MBC_ROT_NONE) {
1588  inf >> m[0] >> m[1] >> m[2];
1589  }
1590  }
1591 
1592  for (unsigned i = 0; i < Nodes.size(); i++) {
1593  /* assume unsigned int label */
1594  unsigned l;
1595  doublereal f[3], m[3];
1596 
1597  if (bLabels) {
1598  inf >> l;
1599 
1600  if (Nodes[i]->GetLabel() != l) {
1601  silent_cerr("StructMembraneMappingExtForce"
1602  "(" << GetLabel() << "): "
1603  "invalid " << i << "-th label " << l
1604  << std::endl);
1606  }
1607  }
1608 
1609  inf
1610  >> f[0] >> f[1] >> f[2];
1611  if (uRot != MBC_ROT_NONE) {
1612  inf >> m[0] >> m[1] >> m[2];
1613  }
1614 
1615  if (!inf) {
1616  break;
1617  }
1618 
1619  F[i] = Vec3(f);
1620  if (uRot != MBC_ROT_NONE) {
1621  M[i] = Vec3(m);
1622  }
1623  }
1624 #endif
1625 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Definition: matvec3.h:98
std::vector< NodeData > Nodes
Definition: strmappingext.h:73
const doublereal * pGetVec(void) const
Definition: matvec3.h:192
double doublereal
Definition: colamd.c:52
unsigned int GetLabel(void) const
Definition: withlab.cc:62
const StructNode * pRefNode
Definition: strmappingext.h:48

Here is the call graph for this function:

void StructMembraneMappingExtForce::SendToFileDes ( int  outfd,
ExtFileHandlerBase::SendWhen  when 
)
protectedvirtual

Reimplemented from StructMappingExtForce.

Definition at line 1361 of file strmappingext.cc.

References StructMappingExtForce::bLabels, StructMappingExtForce::bOutputAccelerations, Vec3::Cross(), dRaDegr, WithLabel::GetLabel(), StructNode::GetRCurr(), StructDispNode::GetVCurr(), StructNode::GetWCurr(), StructNode::GetWPCurr(), StructDispNode::GetXCurr(), StructDispNode::GetXPPCurr(), StructMappingExtForce::m_q, StructMappingExtForce::m_qlabels, StructMappingExtForce::m_qP, StructMappingExtForce::m_qPP, StructMappingExtForce::m_x, StructMappingExtForce::m_xP, StructMappingExtForce::m_xPP, MatR2EulerAngles123(), MatrixHandler::MatVecMul(), MBC_ROT_EULER_123, MBC_ROT_MAT, MBC_ROT_THETA, MBDYN_EXCEPT_ARGS, Mat3x3::MulTV(), StructMappingExtForce::Nodes, NodesConn, Vec3::Norm(), Mat3x3::pGetMat(), Vec3::pGetVec(), StructMappingExtForce::pH, StructMappingExtForce::pRefNode, STLVectorHandler::Put(), R, StructMappingExtForce::uRRot, and RotManip::VecRot().

1362 {
1363 #ifdef USE_SOCKET
1364  if (pRefNode) {
1365  const Vec3& xRef = pRefNode->GetXCurr();
1366  const Mat3x3& RRef = pRefNode->GetRCurr();
1367  const Vec3& xpRef = pRefNode->GetVCurr();
1368  const Vec3& wRef = pRefNode->GetWCurr();
1369  const Vec3& xppRef = pRefNode->GetXPPCurr();
1370  const Vec3& wpRef = pRefNode->GetWPCurr();
1371 
1372  if (bLabels) {
1373  uint32_t l = pRefNode->GetLabel();
1374  send(outfd, (void *)&l, sizeof(l), 0);
1375  }
1376 
1377  send(outfd, (void *)xRef.pGetVec(), 3*sizeof(doublereal), 0);
1378  switch (uRRot) {
1379  case MBC_ROT_MAT:
1380  send(outfd, (void *)RRef.pGetMat(), 9*sizeof(doublereal), 0);
1381  break;
1382 
1383  case MBC_ROT_THETA: {
1384  Vec3 Theta(RotManip::VecRot(RRef));
1385  send(outfd, (void *)Theta.pGetVec(), 3*sizeof(doublereal), 0);
1386  } break;
1387 
1388  case MBC_ROT_EULER_123: {
1389  Vec3 E(MatR2EulerAngles123(RRef)*dRaDegr);
1390  send(outfd, (void *)E.pGetVec(), 3*sizeof(doublereal), 0);
1391  } break;
1392  }
1393  send(outfd, (void *)xpRef.pGetVec(), 3*sizeof(doublereal), 0);
1394  send(outfd, (void *)wRef.pGetVec(), 3*sizeof(doublereal), 0);
1395  if (bOutputAccelerations) {
1396  send(outfd, (void *)xppRef.pGetVec(), 3*sizeof(doublereal), 0);
1397  send(outfd, (void *)wpRef.pGetVec(), 3*sizeof(doublereal), 0);
1398  }
1399 
1400  for (unsigned p3 = 0, n = 0; n < Nodes.size(); n++) {
1401  const StructNode *pNode(dynamic_cast<const StructNode *>(Nodes[n].pNode));
1402  if (pNode != 0) {
1403  for (unsigned o = 0; o < Nodes[n].Offsets.size(); o++, p3 += 3) {
1404  Vec3 f(pNode->GetRCurr()*Nodes[n].Offsets[o].Offset);
1405  Vec3 x(pNode->GetXCurr() + f);
1406  Vec3 Dx(x - xRef);
1407  Vec3 v(pNode->GetVCurr() + pNode->GetWCurr().Cross(f));
1408  Vec3 Dv(v - xpRef - wRef.Cross(Dx));
1409  const Vec3& w(pNode->GetWCurr());
1410 
1411  Vec3 xTilde(RRef.MulTV(Dx));
1412  m_x.Put(p3 + 1, xTilde);
1413 
1414  Vec3 vTilde(RRef.MulTV(Dv));
1415  m_xP.Put(p3 + 1, vTilde);
1416 
1417  if (bOutputAccelerations) {
1418  const Vec3& xpp = pNode->GetXPPCurr();
1419  const Vec3& wp = pNode->GetWPCurr();
1420 
1421  Vec3 xppTilde(RRef.MulTV(xpp - xppRef - wpRef.Cross(Dx)
1422  - wRef.Cross(wRef.Cross(Dx) + Dv*2)
1423  + wp.Cross(f) + w.Cross(w.Cross(f))));
1424  m_xPP.Put(p3 + 1, xppTilde);
1425  }
1426  }
1427 
1428  } else {
1429  if (NodesConn[n].pNode[0] != 0) {
1430  Vec3 e1(NodesConn[n].pNode[1]->GetXCurr() - NodesConn[n].pNode[0]->GetXCurr());
1431  Vec3 e2(NodesConn[n].pNode[3]->GetXCurr() - NodesConn[n].pNode[2]->GetXCurr());
1432  Vec3 e3(e1.Cross(e2));
1433  e3 /= e3.Norm();
1434 
1435  Nodes[n].Offsets[0].Offset = e3*NodesConn[n].h1;
1436  Nodes[n].Offsets[1].Offset = e3*NodesConn[n].h2;
1437 
1438  for (unsigned o = 0; o < 2; o++, p3 += 3) {
1439  Vec3 Dx(Nodes[n].pNode->GetXCurr() + Nodes[n].Offsets[o].Offset - xRef);
1440  Vec3 Dv(Nodes[n].pNode->GetVCurr() - xpRef - wRef.Cross(Dx));
1441 
1442  Vec3 xTilde(RRef.MulTV(Dx));
1443  m_x.Put(p3 + 1, xTilde);
1444 
1445  Vec3 vTilde(RRef.MulTV(Dv));
1446  m_xP.Put(p3 + 1, vTilde);
1447 
1448  if (bOutputAccelerations) {
1449  Vec3 xppTilde(RRef.MulTV(Nodes[n].pNode->GetXPPCurr()
1450  - xppRef - wpRef.Cross(Dx)
1451  - wRef.Cross(wRef.Cross(Dx) + Dv*2)));
1452  m_xPP.Put(p3 + 1, xppTilde);
1453  }
1454  }
1455 
1456  } else {
1457  Vec3 Dx(Nodes[n].pNode->GetXCurr() - xRef);
1458  Vec3 Dv(Nodes[n].pNode->GetVCurr() - xpRef - wRef.Cross(Dx));
1459 
1460  Vec3 xTilde(RRef.MulTV(Dx));
1461  m_x.Put(p3 + 1, xTilde);
1462 
1463  Vec3 vTilde(RRef.MulTV(Dv));
1464  m_xP.Put(p3 + 1, vTilde);
1465 
1466  if (bOutputAccelerations) {
1467  Vec3 xppTilde(RRef.MulTV(Nodes[n].pNode->GetXPPCurr()
1468  - xppRef - wpRef.Cross(Dx)
1469  - wRef.Cross(wRef.Cross(Dx) + Dv*2)));
1470  m_xPP.Put(p3 + 1, xppTilde);
1471  }
1472 
1473  p3 += 3;
1474  }
1475  }
1476  }
1477 
1478  } else {
1479  for (unsigned p3 = 0, n = 0; n < Nodes.size(); n++) {
1480  const StructNode *pNode(dynamic_cast<const StructNode *>(Nodes[n].pNode));
1481  if (pNode != 0) {
1482  for (unsigned o = 0; o < Nodes[n].Offsets.size(); o++, p3 +=3 ) {
1483  /*
1484  p = x + f
1485  R = R
1486  v = xp + w cross f
1487  w = w
1488  a = xpp + wp cross f + w cross w cross f
1489  wp = wp
1490  */
1491 
1492  // Optimization of the above formulas
1493  const Mat3x3& R = pNode->GetRCurr();
1494  Vec3 f = R*Nodes[n].Offsets[o].Offset;
1495  Vec3 x = pNode->GetXCurr() + f;
1496  const Vec3& w = pNode->GetWCurr();
1497  Vec3 wCrossf = w.Cross(f);
1498  Vec3 v = pNode->GetVCurr() + wCrossf;
1499 
1500  m_x.Put(p3 + 1, x);
1501  m_xP.Put(p3 + 1, v);
1502 
1503  if (bOutputAccelerations) {
1504  const Vec3& wp = pNode->GetWPCurr();
1505  Vec3 xpp = pNode->GetXPPCurr() + wp.Cross(f) + w.Cross(wCrossf);
1506 
1507  m_xPP.Put(p3 + 1, xpp);
1508  }
1509  }
1510 
1511  } else {
1512  if (NodesConn[n].pNode[0] != 0) {
1513  Vec3 e1(NodesConn[n].pNode[1]->GetXCurr() - NodesConn[n].pNode[0]->GetXCurr());
1514  Vec3 e2(NodesConn[n].pNode[3]->GetXCurr() - NodesConn[n].pNode[2]->GetXCurr());
1515  Vec3 e3(e1.Cross(e2));
1516  e3 /= e3.Norm();
1517 
1518  Nodes[n].Offsets[0].Offset = e3*NodesConn[n].h1;
1519  Nodes[n].Offsets[1].Offset = e3*NodesConn[n].h2;
1520 
1521  for (unsigned o = 0; o < 2; o++, p3 += 3) {
1522  m_x.Put(p3 + 1, Nodes[n].pNode->GetXCurr() + Nodes[n].Offsets[o].Offset);
1523  m_xP.Put(p3 + 1, Nodes[n].pNode->GetVCurr());
1524 
1525  if (bOutputAccelerations) {
1526  m_xPP.Put(p3 + 1, Nodes[n].pNode->GetXPPCurr());
1527  }
1528  }
1529 
1530  } else {
1531  m_x.Put(p3 + 1, Nodes[n].pNode->GetXCurr());
1532  m_xP.Put(p3 + 1, Nodes[n].pNode->GetVCurr());
1533 
1534  if (bOutputAccelerations) {
1535  m_xPP.Put(p3 + 1, Nodes[n].pNode->GetXPPCurr());
1536  }
1537 
1538  p3 += 3;
1539  }
1540  }
1541  }
1542  }
1543 
1544  if (bLabels) {
1545  send(outfd, &m_qlabels[0], sizeof(uint32_t)*m_qlabels.size(), 0);
1546  }
1547 
1548  if (pH) {
1549  pH->MatVecMul(m_q, m_x);
1550  pH->MatVecMul(m_qP, m_xP);
1551 
1552  send(outfd, &m_q[0], sizeof(double)*m_q.size(), 0);
1553  send(outfd, &m_qP[0], sizeof(double)*m_qP.size(), 0);
1554 
1555  if (bOutputAccelerations) {
1556  pH->MatVecMul(m_qPP, m_xPP);
1557  send(outfd, &m_qPP[0], sizeof(double)*m_qPP.size(), 0);
1558  }
1559 
1560  } else {
1561  send(outfd, &m_x[0], sizeof(double)*m_x.size(), 0);
1562  send(outfd, &m_xP[0], sizeof(double)*m_xP.size(), 0);
1563 
1564  if (bOutputAccelerations) {
1565  send(outfd, &m_xPP[0], sizeof(double)*m_xPP.size(), 0);
1566  }
1567  }
1568 
1569 #else // ! USE_SOCKET
1571 #endif // ! USE_SOCKET
1572 }
Vec3 Cross(const Vec3 &v) const
Definition: matvec3.h:218
STLVectorHandler m_xPP
Definition: strmappingext.h:86
STLVectorHandler m_qPP
Definition: strmappingext.h:89
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Definition: matvec3.h:98
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
doublereal Norm(void) const
Definition: matvec3.h:263
std::vector< uint32_t > m_qlabels
Definition: strmappingext.h:82
STLVectorHandler m_x
Definition: strmappingext.h:84
std::vector< NodeData > Nodes
Definition: strmappingext.h:73
Vec3 VecRot(const Mat3x3 &Phi)
Definition: Rot.cc:136
Vec3 MulTV(const Vec3 &v) const
Definition: matvec3.cc:482
virtual void Put(integer iRow, const Vec3 &v)
Definition: stlvh.cc:181
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
virtual const Vec3 & GetWPCurr(void) const
Definition: strnode.h:1042
virtual const Vec3 & GetXCurr(void) const
Definition: strnode.h:310
std::vector< NodeConnData > NodesConn
const doublereal * pGetMat(void) const
Definition: matvec3.h:743
STLVectorHandler m_q
Definition: strmappingext.h:87
const doublereal * pGetVec(void) const
Definition: matvec3.h:192
virtual const Vec3 & GetVCurr(void) const
Definition: strnode.h:322
SpMapMatrixHandler * pH
Definition: strmappingext.h:56
virtual const Vec3 & GetXPPCurr(void) const
Definition: strnode.h:334
double doublereal
Definition: colamd.c:52
unsigned int GetLabel(void) const
Definition: withlab.cc:62
const StructNode * pRefNode
Definition: strmappingext.h:48
virtual VectorHandler & MatVecMul(VectorHandler &out, const VectorHandler &in) const
Definition: mh.cc:332
STLVectorHandler m_xP
Definition: strmappingext.h:85
Mat3x3 R
STLVectorHandler m_qP
Definition: strmappingext.h:88

Here is the call graph for this function:

void StructMembraneMappingExtForce::SendToStream ( std::ostream &  outf,
ExtFileHandlerBase::SendWhen  when 
)
protectedvirtual

Reimplemented from StructMappingExtForce.

Definition at line 1190 of file strmappingext.cc.

References a, StructMappingExtForce::bLabels, StructMappingExtForce::bOutputAccelerations, Vec3::Cross(), grad::Cross(), dRaDegr, WithLabel::GetLabel(), StructNode::GetRCurr(), StructDispNode::GetVCurr(), StructNode::GetWCurr(), StructNode::GetWPCurr(), StructDispNode::GetXCurr(), StructDispNode::GetXPPCurr(), MatR2EulerAngles123(), MBC_ROT_EULER_123, MBC_ROT_MAT, MBC_ROT_NONE, MBC_ROT_THETA, Mat3x3::MulTM(), Mat3x3::MulTV(), StructMappingExtForce::Nodes, StructMappingExtForce::pRefNode, R, and RotManip::VecRot().

1191 {
1192  if (pRefNode) {
1193  const Vec3& xRef = pRefNode->GetXCurr();
1194  const Mat3x3& RRef = pRefNode->GetRCurr();
1195  const Vec3& xpRef = pRefNode->GetVCurr();
1196  const Vec3& wRef = pRefNode->GetWCurr();
1197  const Vec3& xppRef = pRefNode->GetXPPCurr();
1198  const Vec3& wpRef = pRefNode->GetWPCurr();
1199 
1200  if (bLabels) {
1201  outf
1202  << pRefNode->GetLabel()
1203  << " ";
1204  }
1205 
1206  outf
1207  << xRef
1208  << " " << RRef
1209  << " " << xpRef
1210  << " " << wRef;
1211 
1212  if (bOutputAccelerations) {
1213  outf
1214  << " " << xppRef
1215  << " " << wpRef;
1216  }
1217  outf << std::endl;
1218 
1219  for (unsigned i = 0; i < Nodes.size(); i++) {
1220 #if 0
1221  Vec3 f(Nodes[i]->GetRCurr()*Offsets[i]);
1222  Vec3 x(Nodes[i]->GetXCurr() + f);
1223  Vec3 Dx(x - xRef);
1224  Mat3x3 DR(RRef.MulTM(Nodes[i]->GetRCurr()));
1225  Vec3 v(Nodes[i]->GetVCurr() + Nodes[i]->GetWCurr().Cross(f));
1226  Vec3 Dv(v - xpRef - wRef.Cross(Dx));
1227  const Vec3& w(Nodes[i]->GetWCurr());
1228 
1229  // manipulate
1230 
1231  if (bLabels) {
1232  outf
1233  << Nodes[i]->GetLabel()
1234  << " ";
1235  }
1236 
1237  outf
1238  << RRef.MulTV(Dx);
1239 
1240  switch (uRot) {
1241  case MBC_ROT_NONE:
1242  break;
1243 
1244  case MBC_ROT_MAT:
1245  outf
1246  << " " << DR;
1247  break;
1248 
1249  case MBC_ROT_THETA:
1250  outf
1251  << " " << RotManip::VecRot(DR);
1252  break;
1253 
1254  case MBC_ROT_EULER_123:
1255  outf
1256  << " " << MatR2EulerAngles123(DR)*dRaDegr;
1257  break;
1258  }
1259 
1260  outf
1261  << " " << RRef.MulTV(Dv);
1262 
1263  if (uRot != MBC_ROT_NONE) {
1264  outf
1265  << " " << RRef.MulTV(w - wRef);
1266  }
1267 
1268  if (bOutputAccelerations) {
1269  const Vec3& xpp(Nodes[i]->GetXPPCurr());
1270 
1271  outf
1272  << " " << RRef.MulTV(xpp - xppRef - wpRef.Cross(Dx)
1273  - wRef.Cross(wRef.Cross(Dx) + Dv*2));
1274  if (uRot != MBC_ROT_NONE) {
1275  const Vec3& wp(Nodes[i]->GetWPCurr());
1276 
1277  outf
1278  << " " << RRef.MulTV(wp - wpRef - wRef.Cross(w));
1279  }
1280  }
1281  outf << std::endl;
1282 #endif
1283  }
1284 
1285  } else {
1286  for (unsigned i = 0; i < Nodes.size(); i++) {
1287 #if 0
1288  /*
1289  p = x + f
1290  R = R
1291  v = xp + w cross f
1292  w = w
1293  a = xpp + wp cross f + w cross w cross f
1294  wp = wp
1295  */
1296 
1297  // Optimization of the above formulas
1298  const Mat3x3& R = Nodes[i]->GetRCurr();
1299  Vec3 f = R*Offsets[i];
1300  Vec3 x = Nodes[i]->GetXCurr() + f;
1301  const Vec3& w = Nodes[i]->GetWCurr();
1302  Vec3 wCrossf = w.Cross(f);
1303  Vec3 v = Nodes[i]->GetVCurr() + wCrossf;
1304 
1305  if (bLabels) {
1306  outf
1307  << Nodes[i]->GetLabel()
1308  << " ";
1309  }
1310 
1311  outf
1312  << x;
1313 
1314  switch (uRot) {
1315  case MBC_ROT_NONE:
1316  break;
1317 
1318  case MBC_ROT_MAT:
1319  outf
1320  << " " << R;
1321  break;
1322 
1323  case MBC_ROT_THETA:
1324  outf
1325  << " " << RotManip::VecRot(R);
1326  break;
1327 
1328  case MBC_ROT_EULER_123:
1329  outf
1330  << " " << MatR2EulerAngles123(R)*dRaDegr;
1331  break;
1332  }
1333  outf
1334  << " " << v;
1335 
1336  if (uRot != MBC_ROT_NONE) {
1337  outf
1338  << " " << w;
1339  }
1340 
1341  if (bOutputAccelerations) {
1342  const Vec3& wp = Nodes[i]->GetWPCurr();
1343  Vec3 a = Nodes[i]->GetXPPCurr() + wp.Cross(f) + w.Cross(wCrossf);
1344 
1345  outf
1346  << " " << a;
1347 
1348  if (uRot != MBC_ROT_NONE) {
1349  outf
1350  << " " << wp;
1351  }
1352  }
1353 
1354  outf << std::endl;
1355 #endif
1356  }
1357  }
1358 }
Vec3 Cross(const Vec3 &v) const
Definition: matvec3.h:218
Definition: matvec3.h:98
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
std::vector< NodeData > Nodes
Definition: strmappingext.h:73
Vec3 VecRot(const Mat3x3 &Phi)
Definition: Rot.cc:136
Vec3 MulTV(const Vec3 &v) const
Definition: matvec3.cc:482
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
virtual const Vec3 & GetWPCurr(void) const
Definition: strnode.h:1042
Mat3x3 MulTM(const Mat3x3 &m) const
Definition: matvec3.cc:500
VectorExpression< VectorCrossExpr< VectorLhsExpr, VectorRhsExpr >, 3 > Cross(const VectorExpression< VectorLhsExpr, 3 > &u, const VectorExpression< VectorRhsExpr, 3 > &v)
Definition: matvec.h:3248
virtual const Vec3 & GetXCurr(void) const
Definition: strnode.h:310
virtual const Vec3 & GetVCurr(void) const
Definition: strnode.h:322
static const doublereal a
Definition: hfluid_.h:289
virtual const Vec3 & GetXPPCurr(void) const
Definition: strnode.h:334
unsigned int GetLabel(void) const
Definition: withlab.cc:62
const StructNode * pRefNode
Definition: strmappingext.h:48
Mat3x3 R

Here is the call graph for this function:

Member Data Documentation

std::vector<NodeConnData> StructMembraneMappingExtForce::NodesConn
protected

Definition at line 160 of file strmappingext.h.

Referenced by RecvFromFileDes(), SendToFileDes(), and StructMembraneMappingExtForce().


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