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

#include <rtai_out_elem.h>

Inheritance diagram for RTMBDynOutElem:
Collaboration diagram for RTMBDynOutElem:

Public Member Functions

 RTMBDynOutElem (unsigned int uL, const std::string &m, const std::string &host, unsigned long n, bool c, StreamContent *pSC, bool bNonBlocking)
 
virtual ~RTMBDynOutElem (void)
 
virtual std::ostream & Restart (std::ostream &out) const
 
virtual void AfterConvergence (const VectorHandler &X, const VectorHandler &XP)
 
virtual void AfterConvergence (const VectorHandler &X, const VectorHandler &XP, const VectorHandler &XPP)
 
- Public Member Functions inherited from StreamOutElem
 StreamOutElem (unsigned int uL, const std::string &name, unsigned int oe)
 
virtual ~StreamOutElem (void)
 
virtual Elem::Type GetElemType (void) const
 
virtual void WorkSpaceDim (integer *piRows, integer *piCols) const
 
virtual SubVectorHandlerAssRes (SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &X, const VectorHandler &XP)
 
virtual VariableSubMatrixHandlerAssJac (VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &X, const VectorHandler &XP)
 
- 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
 
virtual void GetConnectedNodes (std::vector< const Node * > &connectedNodes) 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 void SetValue (DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *h=0)
 
virtual HintParseHint (DataManager *pDM, const char *s) 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 Update (const VectorHandler &XCurr, InverseDynamics::Order iOrder)
 
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
 
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))
 

Protected Attributes

std::string host
 
unsigned long node
 
bool create
 
int port
 
bool bNonBlocking
 
StreamContentpSC
 
void * mbx
 
int(* f_send )(unsigned long node, int port, void *v_mbx, void *msg, int msg_size)
 
- Protected Attributes inherited from StreamOutElem
std::string name
 
unsigned int OutputEvery
 
unsigned int OutputCounter
 
- Protected Attributes inherited from WithLabel
unsigned int uLabel
 
std::string sName
 
- Protected Attributes inherited from ToBeOutput
flag fOutput
 

Additional Inherited Members

- Public Types inherited from StreamOutElem
enum  Type { UNDEFINED = -1, RTAI, SOCKETSTREAM, BUFFERSTREAM }
 
- 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 }
 

Detailed Description

Definition at line 43 of file rtai_out_elem.h.

Constructor & Destructor Documentation

RTMBDynOutElem::RTMBDynOutElem ( unsigned int  uL,
const std::string &  m,
const std::string &  host,
unsigned long  n,
bool  c,
StreamContent pSC,
bool  bNonBlocking 
)

Definition at line 49 of file rtai_out_elem.cc.

References ASSERT, create, f_send, StreamContent::GetOutSize(), MBDYN_EXCEPT_ARGS, mbx, StreamOutElem::name, node, and port.

52 : Elem(uL, flag(0)),
53 StreamOutElem(uL, m, 1),
54 host(host), node(n), create(c), port(-1),
56 pSC(pSC),
57 mbx(0),
58 f_send(0)
59 {
60  /* RATIONALE:
61  *
62  * if host/node is present, the mailbox is "remote";
63  * if it not, we may need to create it
64  */
65 
66  if (create) {
67  ASSERT(node == 0);
68 
69  if (rtmbdyn_rt_mbx_init(name.c_str(), pSC->GetOutSize(), &mbx)) {
70  silent_cerr("RTMBDyn mailbox(" << name << ") "
71  "init failed" << std::endl);
73  }
74 
75  } else {
76  if (node) {
77  /* get port ... */
78  port = rtmbdyn_rt_request_port(node);
79  /* FIXME: what in case of failure? */
80  }
81 
82  if (rtmbdyn_RT_get_adr(node, port, name.c_str(), &mbx)) {
83  silent_cerr("RTMBDyn mailbox(" << name << ") "
84  "get_adr failed" << std::endl);
86  }
87  }
88 
89  if (bNonBlocking) {
90  f_send = rtmbdyn_RT_mbx_send_if;
91 
92  } else {
93  f_send = rtmbdyn_RT_mbx_send;
94  }
95 }
long int flag
Definition: mbdyn.h:43
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
StreamOutElem(unsigned int uL, const std::string &name, unsigned int oe)
int(* f_send)(unsigned long node, int port, void *v_mbx, void *msg, int msg_size)
Definition: rtai_out_elem.h:55
std::string name
Definition: streamoutelem.h:56
std::string host
Definition: rtai_out_elem.h:46
#define ASSERT(expression)
Definition: colamd.c:977
static std::stack< cleanup * > c
Definition: cleanup.cc:59
StreamContent * pSC
Definition: rtai_out_elem.h:52
unsigned long node
Definition: rtai_out_elem.h:47
Elem(unsigned int uL, flag fOut)
Definition: elem.cc:41
int GetOutSize(void) const

Here is the call graph for this function:

RTMBDynOutElem::~RTMBDynOutElem ( void  )
virtual

Definition at line 97 of file rtai_out_elem.cc.

References mbx, pSC, and SAFEDELETE.

98 {
99  if (mbx) {
100  rtmbdyn_rt_mbx_delete(&mbx);
101  }
102 
103  if (pSC) {
104  SAFEDELETE(pSC);
105  }
106 }
StreamContent * pSC
Definition: rtai_out_elem.h:52
#define SAFEDELETE(pnt)
Definition: mynewmem.h:710

Member Function Documentation

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

Reimplemented from SimulationEntity.

Definition at line 116 of file rtai_out_elem.cc.

References f_send, StreamContent::GetOutBuf(), StreamContent::GetOutSize(), mbx, node, port, StreamContent::Prepare(), and pSC.

Referenced by AfterConvergence().

118 {
119  pSC->Prepare();
120 
121  int rc = f_send(node, -port, mbx, (void *)pSC->GetOutBuf(), pSC->GetOutSize());
122  if (rc != pSC->GetOutSize()) {
123  /* FIXME: error */
124  }
125 }
int(* f_send)(unsigned long node, int port, void *v_mbx, void *msg, int msg_size)
Definition: rtai_out_elem.h:55
virtual void Prepare(void)=0
const void * GetOutBuf(void) const
StreamContent * pSC
Definition: rtai_out_elem.h:52
unsigned long node
Definition: rtai_out_elem.h:47
int GetOutSize(void) const

Here is the call graph for this function:

void RTMBDynOutElem::AfterConvergence ( const VectorHandler X,
const VectorHandler XP,
const VectorHandler XPP 
)
virtual

Reimplemented from SimulationEntity.

Definition at line 128 of file rtai_out_elem.cc.

References AfterConvergence().

130 {
131  AfterConvergence(X, XP);
132 }
virtual void AfterConvergence(const VectorHandler &X, const VectorHandler &XP)

Here is the call graph for this function:

std::ostream & RTMBDynOutElem::Restart ( std::ostream &  out) const
virtual

Implements Elem.

Definition at line 109 of file rtai_out_elem.cc.

References WithLabel::GetLabel().

110 {
111  return out << "# RTMBDynOutElem(" << GetLabel() << ") "
112  "not implemented yet" << std::endl;
113 }
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

Member Data Documentation

bool RTMBDynOutElem::bNonBlocking
protected

Definition at line 50 of file rtai_out_elem.h.

bool RTMBDynOutElem::create
protected

Definition at line 48 of file rtai_out_elem.h.

Referenced by RTMBDynOutElem().

int(* RTMBDynOutElem::f_send)(unsigned long node, int port, void *v_mbx, void *msg, int msg_size)
protected

Definition at line 55 of file rtai_out_elem.h.

Referenced by AfterConvergence(), and RTMBDynOutElem().

std::string RTMBDynOutElem::host
protected

Definition at line 46 of file rtai_out_elem.h.

void* RTMBDynOutElem::mbx
protected

Definition at line 54 of file rtai_out_elem.h.

Referenced by AfterConvergence(), RTMBDynOutElem(), and ~RTMBDynOutElem().

unsigned long RTMBDynOutElem::node
protected

Definition at line 47 of file rtai_out_elem.h.

Referenced by AfterConvergence(), and RTMBDynOutElem().

int RTMBDynOutElem::port
protected

Definition at line 49 of file rtai_out_elem.h.

Referenced by AfterConvergence(), and RTMBDynOutElem().

StreamContent* RTMBDynOutElem::pSC
protected

Definition at line 52 of file rtai_out_elem.h.

Referenced by AfterConvergence(), and ~RTMBDynOutElem().


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