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

#include <stredge.h>

Inheritance diagram for StructExtEDGEForce:
Collaboration diagram for StructExtEDGEForce:

Public Member Functions

 StructExtEDGEForce (unsigned int uL, DataManager *pDM, const StructNode *pRefNode, bool bUseReferenceNodeForces, bool bRotateReferenceNodeForces, std::vector< unsigned > &Labels, std::vector< const StructNode * > &Nodes, std::vector< Vec3 > &Offsets, bool bSorted, bool bLabels, bool bOutputAccelerations, unsigned bRot, ExtFileHandlerBase *pEFH, bool bSendAfterPredict, int iCoupling, unsigned uOutputFlags, flag fOut)
 
virtual ~StructExtEDGEForce (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 StructExtForce
 StructExtForce (unsigned int uL, DataManager *pDM, const StructNode *pRefNode, bool bUseReferenceNodeForces, bool bRotateReferenceNodeForces, std::vector< unsigned > &Labels, std::vector< const StructNode * > &Nodes, std::vector< Vec3 > &Offsets, bool bSorted, bool bLabels, bool bOutputAccelerations, unsigned bRot, ExtFileHandlerBase *pEFH, bool bSendAfterPredict, int iCoupling, unsigned uOutputFlags, flag fOut)
 
virtual ~StructExtForce (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 StructExtForce
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< Vec3m_x
 
std::vector< Vec3m_v
 
- Protected Attributes inherited from WithLabel
unsigned int uLabel
 
std::string sName
 
- Protected Attributes inherited from ToBeOutput
flag fOutput
 
- Protected Attributes inherited from StructExtForce
const StructNodepRefNode
 
bool bUseReferenceNodeForces
 
bool bRotateReferenceNodeForces
 
Vec3 F0
 
Vec3 M0
 
Vec3 F1
 
Vec3 M1
 
Vec3 F2
 
Vec3 M2
 
unsigned uOutputFlags
 
std::vector< PointDatam_Points
 
bool bLabels
 
bool bSorted
 
std::vector< booldone
 
unsigned uRot
 
bool bOutputAccelerations
 
unsigned dynamics_size
 
std::vector< char > iobuf
 
uint32_t * iobuf_labels
 
doublerealiobuf_x
 
doublerealiobuf_R
 
doublerealiobuf_theta
 
doublerealiobuf_euler_123
 
doublerealiobuf_xp
 
doublerealiobuf_omega
 
doublerealiobuf_xpp
 
doublerealiobuf_omegap
 
doublerealiobuf_f
 
doublerealiobuf_m
 
- 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 41 of file stredge.h.

Constructor & Destructor Documentation

StructExtEDGEForce::StructExtEDGEForce ( unsigned int  uL,
DataManager pDM,
const StructNode pRefNode,
bool  bUseReferenceNodeForces,
bool  bRotateReferenceNodeForces,
std::vector< unsigned > &  Labels,
std::vector< const StructNode * > &  Nodes,
std::vector< Vec3 > &  Offsets,
bool  bSorted,
bool  bLabels,
bool  bOutputAccelerations,
unsigned  bRot,
ExtFileHandlerBase pEFH,
bool  bSendAfterPredict,
int  iCoupling,
unsigned  uOutputFlags,
flag  fOut 
)

Definition at line 46 of file stredge.cc.

References ASSERT.

63 : Elem(uL, fOut),
66  pEFH, bSendAfterPredict, iCoupling, uOutputFlags, fOut),
67 m_x(nodes.size()),
68 m_v(nodes.size())
69 {
70  ASSERT(dynamic_cast<ExtFileHandlerEDGE *>(pEFH) != 0);
71  ASSERT(bLabels);
72  ASSERT(!bSorted);
73 }
bool bSendAfterPredict
Definition: extforce.h:196
StructExtForce(unsigned int uL, DataManager *pDM, const StructNode *pRefNode, bool bUseReferenceNodeForces, bool bRotateReferenceNodeForces, std::vector< unsigned > &Labels, std::vector< const StructNode * > &Nodes, std::vector< Vec3 > &Offsets, bool bSorted, bool bLabels, bool bOutputAccelerations, unsigned bRot, ExtFileHandlerBase *pEFH, bool bSendAfterPredict, int iCoupling, unsigned uOutputFlags, flag fOut)
Definition: strext.cc:47
bool bLabels
Definition: strext.h:69
std::vector< Vec3 > m_x
Definition: stredge.h:44
bool bOutputAccelerations
Definition: strext.h:74
static int labels
bool bSorted
Definition: strext.h:70
bool bUseReferenceNodeForces
Definition: strext.h:50
#define ASSERT(expression)
Definition: colamd.c:977
std::vector< Vec3 > m_v
Definition: stredge.h:45
static int nodes
unsigned uRot
Definition: strext.h:73
Elem(unsigned int uL, flag fOut)
Definition: elem.cc:41
bool bRotateReferenceNodeForces
Definition: strext.h:51
unsigned uOutputFlags
Definition: strext.h:55
StructExtEDGEForce::~StructExtEDGEForce ( void  )
virtual

Definition at line 75 of file stredge.cc.

References NO_OP.

76 {
77  NO_OP;
78 }
#define NO_OP
Definition: myassert.h:74

Member Function Documentation

void StructExtEDGEForce::RecvFromFileDes ( int  infd)
protectedvirtual

Reimplemented from StructExtForce.

Definition at line 591 of file stredge.cc.

References MBDYN_EXCEPT_ARGS.

592 {
594 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
void StructExtEDGEForce::RecvFromStream ( std::istream &  inf)
protectedvirtual

Reimplemented from StructExtForce.

Definition at line 233 of file stredge.cc.

References ASSERT, StructExtForce::bLabels, StructExtForce::bSorted, buf, WithLabel::GetLabel(), labels, StructExtForce::m_Points, MBDYN_EXCEPT_ARGS, mbedge_eat_field(), mbedge_eat_sep(), mbedge_goto_eol(), and STRLENOF.

234 {
235  ASSERT(!bSorted);
236  ASSERT(bLabels);
237 
238  /* header:
239 ext_model, N, 0, 0, 2
240 *
241 grid_idents, IF, 1, 121, 0
242 1 2 3 4 5 6
243 ...
244 115 116 117 118 119 120
245 121
246 force, RF, 3, 121, 0
247 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
248 ...
249 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
250 0.000000
251 
252 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
253 ...
254 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
255 0.000000
256 
257 -0.000062 -0.000023 0.000000 0.000000 0.000000 0.000000
258 ...
259 0.035062 0.036876 0.037783 0.039294 0.040654 0.042014
260 0.043526
261  */
262 
263  std::vector<unsigned> labels(m_Points.size());
264  typedef std::vector<std::vector<PointData>::iterator> RIndexType;
265  RIndexType points(m_Points.size());
266 
267  // cycle
268  unsigned lineno = 0;
269  while (true) {
270  char buf[BUFSIZ], *p;
271  if (mbedge_goto_eol(inf, buf, sizeof(buf))) {
272  if (!inf) {
273  break;
274  }
275  }
276 
277  lineno++;
278 
279  if (buf[0] == '*') {
280  continue;
281  }
282 
283  /*
284 ext_model, N, 0, 0, 2
285  */
286 
287  if (strncasecmp(buf, "ext_model", STRLENOF("ext_model")) == 0) {
288  p = buf + STRLENOF("ext_model");
289 
290  size_t buflen = sizeof(buf) - STRLENOF("ext_model");
291  p = &buf[0] + STRLENOF("ext_model");
292 
293  p = mbedge_eat_sep(p, buflen);
294  if (p == 0) {
295  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): unable to skip separator "
296  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
298  }
299 
300  p = mbedge_eat_field(p, buflen, "N");
301  if (p == 0) {
302  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): unable to skip field \"N\" "
303  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
305  }
306 
307  p = mbedge_eat_sep(p, buflen);
308  if (p == 0) {
309  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): unable to skip separator "
310  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
312  }
313 
314  p = mbedge_eat_field(p, buflen, "0");
315  if (p == 0) {
316  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): unable to skip field \"0\" "
317  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
319  }
320 
321  p = mbedge_eat_sep(p, buflen);
322  if (p == 0) {
323  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): unable to skip separator "
324  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
326  }
327 
328  p = mbedge_eat_field(p, buflen, "0");
329  if (p == 0) {
330  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): unable to skip field \"0\" "
331  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
333  }
334 
335  p = mbedge_eat_sep(p, buflen);
336  if (p == 0) {
337  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): unable to skip separator "
338  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
340  }
341 
342  p = mbedge_eat_field(p, buflen, "2");
343  if (p == 0) {
344  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): unable to skip field \"2\" "
345  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
347  }
348 
349  continue;
350  }
351 
352  /*
353 grid_idents, IF, 1, 121, 0
354  */
355 
356  if (strncasecmp(buf, "grid_idents", STRLENOF("grid_idents")) == 0) {
357  p = buf + STRLENOF("grid_idents");
358 
359  size_t buflen = sizeof(buf) - STRLENOF("grid_idents");
360  p = &buf[0] + STRLENOF("grid_idents");
361 
362  p = mbedge_eat_sep(p, buflen);
363  if (p == 0) {
364  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): unable to skip separator "
365  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
367  }
368 
369  p = mbedge_eat_field(p, buflen, "IF");
370  if (p == 0) {
371  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): unable to skip field \"IF\" "
372  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
374  }
375 
376  p = mbedge_eat_sep(p, buflen);
377  if (p == 0) {
378  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): unable to skip separator "
379  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
381  }
382 
383  p = mbedge_eat_field(p, buflen, "1");
384  if (p == 0) {
385  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): unable to skip field \"1\" "
386  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
388  }
389 
390  p = mbedge_eat_sep(p, buflen);
391  if (p == 0) {
392  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): unable to skip separator "
393  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
395  }
396 
397  char *next;
398  errno = 0;
399  long nids = strtol(p, &next, 10);
400  int save_errno = errno;
401  if (next == p) {
402  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): unable to read IDs number field "
403  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
405 
406  } else if (save_errno == ERANGE) {
407  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): IDs number field overflows "
408  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
410  }
411 
412  if (unsigned(nids) != m_Points.size()) {
413  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): IDs number " << nids << " does not match "
414  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
416  }
417 
418  p = next;
419 
420  p = mbedge_eat_sep(p, buflen);
421  if (p == 0) {
422  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): unable to skip separator "
423  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
425  }
426 
427  p = mbedge_eat_field(p, buflen, "0");
428  if (p == 0) {
429  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): unable to skip field \"0\" "
430  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
432  }
433 
434  for (std::vector<unsigned>::iterator id = labels.begin(); id != labels.end(); ++id) {
435  long idx;
436 
437  inf >> idx;
438 
439  if (idx < 0) {
440  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): invalid ID #" << id - labels.begin() << std::endl);
442  }
443 
444  if (std::find(labels.begin(), id, unsigned(idx)) < id) {
445  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): "
446  "duplicate ID #" << id - labels.begin() << " \"" << idx << "\"" << std::endl);
448  }
449 
450  *id = idx;
451  }
452 
453 
454  mbedge_goto_eol(inf, buf, sizeof(buf));
455 
456  for (std::vector<PointData>::iterator point = m_Points.begin(); point != m_Points.end(); ++point) {
457  std::vector<unsigned>::iterator id = std::find(labels.begin(), labels.end(), point->uLabel);
458  if (id == labels.end()) {
459  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): "
460  "ID \"" << point->uLabel << "\" missing" << std::endl);
462  }
463 
464  points[id - labels.begin()] = point;
465  }
466 
467  continue;
468  }
469 
470  /*
471 force, RF, 3, 121, 0
472  */
473 
474  if (strncasecmp(buf, "force", STRLENOF("force")) == 0) {
475  p = buf + STRLENOF("force");
476 
477  size_t buflen = sizeof(buf) - STRLENOF("force");
478  p = &buf[0] + STRLENOF("force");
479 
480  p = mbedge_eat_sep(p, buflen);
481  if (p == 0) {
482  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): unable to skip separator "
483  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
485  }
486 
487  p = mbedge_eat_field(p, buflen, "RF");
488  if (p == 0) {
489  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): unable to skip field \"RF\" "
490  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
492  }
493 
494  p = mbedge_eat_sep(p, buflen);
495  if (p == 0) {
496  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): unable to skip separator "
497  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
499  }
500 
501  p = mbedge_eat_field(p, buflen, "3");
502  if (p == 0) {
503  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): unable to skip field \"3\" "
504  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
506  }
507 
508  p = mbedge_eat_sep(p, buflen);
509  if (p == 0) {
510  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): unable to skip separator "
511  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
513  }
514 
515  char *next;
516  errno = 0;
517  long nids = strtol(p, &next, 10);
518  int save_errno = errno;
519  if (next == p) {
520  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): unable to read IDs number field "
521  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
523 
524  } else if (save_errno == ERANGE) {
525  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): IDs number field overflows "
526  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
528  }
529  if (unsigned(nids) != m_Points.size()) {
530  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): IDs number " << nids << " does not match "
531  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
533  }
534 
535  p = next;
536 
537  p = mbedge_eat_sep(p, buflen);
538  if (p == 0) {
539  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): unable to skip separator "
540  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
542  }
543 
544  p = mbedge_eat_field(p, buflen, "0");
545  if (p == 0) {
546  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): unable to skip field \"0\" "
547  "at line=" << lineno << ", \"" << buf[sizeof(buf) - buflen] << "\"" << std::endl);
549  }
550 
551  for (RIndexType::iterator p = points.begin(); p != points.end(); p++) {
552  double d;
553 
554  inf >> d;
555 
556  (*p)->F(1) = d;
557  }
558 
559  mbedge_goto_eol(inf, buf, sizeof(buf));
560 
561  for (RIndexType::const_iterator p = points.begin(); p != points.end(); p++) {
562  double d;
563 
564  inf >> d;
565 
566  (*p)->F(2) = d;
567  }
568 
569  mbedge_goto_eol(inf, buf, sizeof(buf));
570 
571  for (RIndexType::const_iterator p = points.begin(); p != points.end(); p++) {
572  double d;
573 
574  inf >> d;
575 
576  (*p)->F(3) = d;
577  }
578 
579  mbedge_goto_eol(inf, buf, sizeof(buf));
580 
581  continue;
582  }
583 
584  silent_cerr("StructExtEDGEForce(" << GetLabel() << "): unexpected line=" << lineno << ", "
585  "\"" << buf << "\"" << std::endl);
587  }
588 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
char * mbedge_eat_sep(char *buf, size_t &buflen)
Definition: extedge.cc:74
bool bLabels
Definition: strext.h:69
static int labels
bool bSorted
Definition: strext.h:70
std::vector< PointData > m_Points
Definition: strext.h:67
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
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

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

Reimplemented from StructExtForce.

Definition at line 227 of file stredge.cc.

References MBDYN_EXCEPT_ARGS.

228 {
230 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
void StructExtEDGEForce::SendToStream ( std::ostream &  outf,
ExtFileHandlerBase::SendWhen  when 
)
protectedvirtual

Reimplemented from StructExtForce.

Definition at line 81 of file stredge.cc.

References ExtForce::c, Vec3::Cross(), StructNode::GetRCurr(), StructDispNode::GetVCurr(), StructNode::GetWCurr(), StructDispNode::GetXCurr(), StructExtForce::m_Points, m_v, m_x, Mat3x3::MulTV(), and StructExtForce::pRefNode.

82 {
83  /* header:
84 ext_model, N, 0, 0, 3
85 *
86 grid_idents, IF, 1, 121, 0
87 1 2 3 4 5 6
88 ...
89 115 116 117 118 119 120
90 121
91 str_coordinates, RF, 3, 121, 0
92 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
93 ...
94 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
95 0.000000
96 
97 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
98 ...
99 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
100 0.000000
101 
102 -0.000062 -0.000023 0.000000 0.000000 0.000000 0.000000
103 ...
104 0.035062 0.036876 0.037783 0.039294 0.040654 0.042014
105 0.043526
106 velocity, RF, 3, 121, 0
107 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
108 ...
109 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
110 0.000000
111 
112 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
113 ...
114 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
115 0.000000
116 
117 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
118 ...
119 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
120 0.000000
121  */
122 
123  if (pRefNode) {
124  const Vec3& xRef = pRefNode->GetXCurr();
125  const Mat3x3& RRef = pRefNode->GetRCurr();
126  const Vec3& vRef = pRefNode->GetVCurr();
127  const Vec3& wRef = pRefNode->GetWCurr();
128 
129  /*
130  p = x + f
131  R = R
132  v = xp + w cross f
133  w = w
134  a = xpp + wp cross f + w cross w cross f
135  wp = wp
136  */
137 
138  std::vector<PointData>::const_iterator point;
139  std::vector<Vec3>::iterator ix;
140  std::vector<Vec3>::iterator iv;
141  for (point = m_Points.begin(), ix = m_x.begin(), iv = m_v.begin(); point != m_Points.end(); ++point, ++ix, ++iv) {
142  Vec3 f(point->pNode->GetRCurr()*point->Offset);
143  Vec3 x(point->pNode->GetXCurr() + f);
144  Vec3 v(point->pNode->GetVCurr() + point->pNode->GetWCurr().Cross(f));
145 
146  *ix = RRef.MulTV(x - xRef);
147  *iv = RRef.MulTV(v - vRef - wRef.Cross(x - xRef));
148  }
149 
150  } else {
151  std::vector<PointData>::const_iterator point;
152  std::vector<Vec3>::iterator ix;
153  std::vector<Vec3>::iterator iv;
154  for (point = m_Points.begin(), ix = m_x.begin(), iv = m_v.begin(); point != m_Points.end(); ++point, ++ix, ++iv) {
155  Vec3 f(point->pNode->GetRCurr()*point->Offset);
156 
157  *ix = point->pNode->GetXCurr() + f;
158  *iv = point->pNode->GetVCurr() + point->pNode->GetWCurr().Cross(f);
159  }
160  }
161 
162  outf <<
163  "ext_model, N, 0, 0, 3\n"
164  "*\n";
165 
166  // labels - TODO: check
167  outf <<
168  "grid_idents, IF, 1, " << m_Points.size() << ", 0\n";
169 
170  int cnt = 0;
171  for (std::vector<PointData>::const_iterator point = m_Points.begin(); point != m_Points.end(); ++point, ++cnt) {
172  if (cnt > 0) {
173  if ((cnt%6) == 0) {
174  outf << "\n";
175  } else {
176  outf << " ";
177  }
178  }
179  outf << point->uLabel;
180  }
181  outf << "\n";
182 
183  // position
184  outf <<
185  "str_coordinates, RF, 3, " << m_Points.size() << ", 0\n";
186 
187  for (int c = 1; c <= 3; c++) {
188  int cnt = 0;
189  for (std::vector<Vec3>::const_iterator i = m_x.begin(); i != m_x.end(); ++i, ++cnt) {
190  if (cnt > 0) {
191  if ((cnt%6) == 0) {
192  outf << "\n";
193  } else {
194  outf << " ";
195  }
196  }
197 
198  outf << (*i)(c);
199  }
200  outf << "\n";
201  }
202 
203  // velocity
204  outf <<
205  "velocity, RF, 3, " << m_Points.size() << ", 0\n";
206 
207  for (int c = 1; c <= 3; c++) {
208  int cnt = 0;
209  for (std::vector<Vec3>::const_iterator i = m_v.begin(); i != m_v.end(); ++i, ++cnt) {
210  if (cnt > 0) {
211  if ((cnt%6) == 0) {
212  outf << "\n";
213  } else {
214  outf << " ";
215  }
216  }
217 
218  outf << (*i)(c);
219  }
220  outf << "\n";
221  }
222 
223  // TODO: other stuff?
224 }
Vec3 Cross(const Vec3 &v) const
Definition: matvec3.h:218
Definition: matvec3.h:98
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
Converged c
Definition: extforce.h:192
Vec3 MulTV(const Vec3 &v) const
Definition: matvec3.cc:482
std::vector< Vec3 > m_x
Definition: stredge.h:44
std::vector< PointData > m_Points
Definition: strext.h:67
virtual const Vec3 & GetWCurr(void) const
Definition: strnode.h:1030
std::vector< Vec3 > m_v
Definition: stredge.h:45
virtual const Vec3 & GetXCurr(void) const
Definition: strnode.h:310
virtual const Vec3 & GetVCurr(void) const
Definition: strnode.h:322
const StructNode * pRefNode
Definition: strext.h:49

Here is the call graph for this function:

Member Data Documentation

std::vector<Vec3> StructExtEDGEForce::m_v
protected

Definition at line 45 of file stredge.h.

Referenced by SendToStream().

std::vector<Vec3> StructExtEDGEForce::m_x
protected

Definition at line 44 of file stredge.h.

Referenced by SendToStream().


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