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

#include <modaledge.h>

Inheritance diagram for ExtRigidForceEDGE:
Collaboration diagram for ExtRigidForceEDGE:

Public Member Functions

 ExtRigidForceEDGE (DataManager *pDM)
 
unsigned Recv (ExtFileHandlerBase *pEFH, unsigned uFlags, unsigned &uLabel, Vec3 &f, Vec3 &m, std::vector< doublereal > &a)
 
void Send (ExtFileHandlerBase *pEFH, unsigned uFlags, unsigned uLabel, const Vec3 &x, const Mat3x3 &R, const Vec3 &v, const Vec3 &w, const std::vector< doublereal > &q, const std::vector< doublereal > &qP)
 
- Public Member Functions inherited from ExtForceEDGE
 ExtForceEDGE (DataManager *pDM)
 
virtual ~ExtForceEDGE (void)
 
bool Prepare (ExtFileHandlerBase *pEFH, unsigned uLabel, bool bRigid, unsigned uModes)
 
- Public Member Functions inherited from ExtModalForceBase
virtual ~ExtModalForceBase (void)
 

Additional Inherited Members

- Public Types inherited from ExtModalForceBase
enum  BitMask {
  EMF_NONE = 0x0U, EMF_RIGID = 0x1U, EMF_MODAL = 0x2U, EMF_ALL = (EMF_RIGID | EMF_MODAL),
  EMF_RIGID_DETECT = 0x10U, EMF_MODAL_DETECT = 0x20U, EMF_RIGID_DETECT_MASK = (EMF_RIGID_DETECT | EMF_RIGID), EMF_MODAL_DETECT_MASK = (EMF_MODAL_DETECT | EMF_MODAL),
  EMF_DETECT_MASK = (EMF_RIGID_DETECT | EMF_MODAL_DETECT), EMF_ERR = 0x10000000U
}
 
- Protected Attributes inherited from ExtForceEDGE
const AirPropertiespAP
 

Detailed Description

Definition at line 58 of file modaledge.h.

Constructor & Destructor Documentation

ExtRigidForceEDGE::ExtRigidForceEDGE ( DataManager pDM)

Definition at line 71 of file modaledge.cc.

References NO_OP.

72 : ExtForceEDGE(pDM)
73 {
74  NO_OP;
75 }
#define NO_OP
Definition: myassert.h:74
ExtForceEDGE(DataManager *pDM)
Definition: modaledge.cc:43

Member Function Documentation

unsigned ExtRigidForceEDGE::Recv ( ExtFileHandlerBase pEFH,
unsigned  uFlags,
unsigned &  uLabel,
Vec3 f,
Vec3 m,
std::vector< doublereal > &  a 
)
virtual

Implements ExtModalForceBase.

Definition at line 88 of file modaledge.cc.

References ASSERT, buf, ExtModalForceBase::EMF_ALL, ExtModalForceBase::EMF_NONE, ExtModalForceBase::EMF_RIGID, ExtModalForceBase::EMF_RIGID_DETECT_MASK, ExtFileHandlerBase::GetInStream(), MBDYN_EXCEPT_ARGS, mbedge_eat_field(), mbedge_eat_sep(), mbedge_goto_eol(), and STRLENOF.

93 {
94  std::istream& fin = *pEFH->GetInStream();
95  unsigned uOutFlags = ExtModalForceBase::EMF_NONE;
96 
97  ASSERT((uFlags & ExtModalForceBase::EMF_RIGID) != 0);
98  ASSERT((uFlags & ~ExtModalForceBase::EMF_ALL) == 0);
99 
100  // fake
101  uLabel = 0;
102 
103  // cycle
104  unsigned lineno = 0;
105  while (true) {
106  char buf[BUFSIZ], *p;
107  if (mbedge_goto_eol(fin, buf, sizeof(buf))) {
108  if (!fin) {
109  break;
110  }
111  }
112 
113  lineno++;
114 
115  if (buf[0] == '*') {
116  continue;
117  }
118 
119  if (strncasecmp(buf, "body_forces", STRLENOF("body_forces")) == 0) {
120  size_t buflen = sizeof(buf) - STRLENOF("body_forces");
121  p = &buf[0] + STRLENOF("body_forces");
122 
123  p = mbedge_eat_sep(p, buflen);
124  if (p == 0) {
125  silent_cerr("ExtRigidForceEDGE: unable to skip separator "
126  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
128  }
129 
130  p = mbedge_eat_field(p, buflen, "R");
131  if (p == 0) {
132  silent_cerr("ExtRigidForceEDGE: unable to skip field \"R\" "
133  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
135  }
136 
137  p = mbedge_eat_sep(p, buflen);
138  if (p == 0) {
139  silent_cerr("ExtRigidForceEDGE: unable to skip separator "
140  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
142  }
143 
144  p = mbedge_eat_field(p, buflen, "1");
145  if (p == 0) {
146  silent_cerr("ExtRigidForceEDGE: unable to skip field \"1\" "
147  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
149  }
150 
151  p = mbedge_eat_sep(p, buflen);
152  if (p == 0) {
153  silent_cerr("ExtRigidForceEDGE: unable to skip separator "
154  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
156  }
157 
158  p = mbedge_eat_field(p, buflen, "6");
159  if (p == 0) {
160  silent_cerr("ExtRigidForceEDGE: unable to skip field \"6\" "
161  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
163  }
164 
165  p = mbedge_eat_sep(p, buflen);
166  if (p == 0) {
167  silent_cerr("ExtRigidForceEDGE: unable to skip separator "
168  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
170  }
171 
172  p = mbedge_eat_field(p, buflen, "0");
173  if (p == 0) {
174  silent_cerr("ExtRigidForceEDGE: unable to skip field \"0\" "
175  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
177  }
178 
179  p = mbedge_eat_sep(p, buflen);
180  if (p == 0) {
181  silent_cerr("ExtRigidForceEDGE: unable to skip separator "
182  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
184  }
185 
186  if (p[0] != '\0' && p[0] != '\n') {
187  silent_cerr("ExtRigidForceEDGE: no line terminator "
188  "at line=" << lineno << ", \"" << p << "\"" << std::endl);
190  }
191 
193  doublereal b[6];
194  for (int i = 0; i < 6; i++) {
195  fin >> b[i];
196  }
197  f = Vec3(&b[0]);
198  m = Vec3(&b[3]);
199 
200  uOutFlags |= (uFlags & ExtModalForceBase::EMF_RIGID_DETECT_MASK);
201  }
202 
203  // skip to eol
204  if (mbedge_goto_eol(fin, buf, sizeof(buf))) {
205  silent_cerr("ExtRigidForceEDGE: unable to skip to end of line "
206  "at line=" << lineno << std::endl);
208  }
209  continue;
210  }
211 
212  silent_cerr("ExtRigidForceEDGE: unexpected line=" << lineno << ", "
213  "\"" << buf << "\"" << std::endl);
215  }
216 
217  return uOutFlags;
218 }
virtual std::istream * GetInStream(void)
Definition: extforce.cc:78
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Definition: matvec3.h:98
char * mbedge_eat_sep(char *buf, size_t &buflen)
Definition: extedge.cc:74
int mbedge_goto_eol(std::istream &fin, char *buf, size_t bufsiz)
Definition: extedge.cc:49
#define ASSERT(expression)
Definition: colamd.c:977
char * mbedge_eat_field(char *buf, size_t &buflen, const char *val)
Definition: extedge.cc:94
#define STRLENOF(s)
Definition: mbdyn.h:166
static doublereal buf[BUFSIZE]
Definition: discctrl.cc:333
double doublereal
Definition: colamd.c:52

Here is the call graph for this function:

void ExtRigidForceEDGE::Send ( ExtFileHandlerBase pEFH,
unsigned  uFlags,
unsigned  uLabel,
const Vec3 x,
const Mat3x3 R,
const Vec3 v,
const Vec3 w,
const std::vector< doublereal > &  q,
const std::vector< doublereal > &  qP 
)
virtual

Implements ExtModalForceBase.

Definition at line 245 of file modaledge.cc.

References ASSERT, ExtModalForceBase::EMF_ALL, ExtModalForceBase::EMF_RIGID, ExtFileHandlerBase::GetOutStream(), AirProperties::GetVelocity(), Mat3x3::MulTV(), ExtForceEDGE::pAP, and R.

251 {
252  std::ostream& fout = *pEFH->GetOutStream();
253  ASSERT((uFlags & ExtModalForceBase::EMF_RIGID) != 0);
254  ASSERT((uFlags & ~ExtModalForceBase::EMF_ALL) == 0);
255 
256  Vec3 vv = v;
257  Vec3 v_infty;
258 
259  if (pAP && pAP->GetVelocity(x, v_infty)) {
260  vv -= v_infty;
261  }
262 
263  Vec3 vB = R.MulTV(vv);
264  Vec3 wB = R.MulTV(w);
265 
266  fout << "* MBDyn to EDGE rigid body dynamics\n"
267  "body_dynamics,N,0,0,3\n"
268  "* Body linear velocity in body axes\n"
269  "VRELV,R,1,3,0\n"
270  << vB(1) << " " << vB(2) << " " << vB(3) << "\n"
271  "* Body angular velocity in body axes\n"
272  "VRELM,R,1,3,0\n"
273  << wB(1) << " " << wB(2) << " " << wB(3) << "\n"
274  "* Body reference frame cosines (listed by columns)\n"
275  "OMGMAN,R,3,3,0\n"
276  // NOTE: this is the transpose of the node's R
277  << R(1, 1) << " " << R(2, 1) << " " << R(3, 1) << "\n"
278  << R(1, 2) << " " << R(2, 2) << " " << R(3, 2) << "\n"
279  << R(1, 3) << " " << R(2, 3) << " " << R(3, 3) << "\n";
280 }
Definition: matvec3.h:98
virtual Vec3 GetVelocity(const Vec3 &) const
Definition: aerodyn.cc:208
Vec3 MulTV(const Vec3 &v) const
Definition: matvec3.cc:482
#define ASSERT(expression)
Definition: colamd.c:977
virtual std::ostream * GetOutStream(void)
Definition: extforce.cc:72
const AirProperties * pAP
Definition: modaledge.h:44
Mat3x3 R

Here is the call graph for this function:


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