MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
force.h File Reference
#include "elem.h"
#include "drive.h"
#include "strnode.h"
Include dependency graph for force.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Force
 
class  AbstractForce
 
class  AbstractInternalForce
 

Functions

ElemReadForce (DataManager *pDM, MBDynParser &HP, unsigned int uLabel, bool)
 

Variables

const char * psForceNames []
 

Function Documentation

Elem* ReadForce ( DataManager pDM,
MBDynParser HP,
unsigned int  uLabel,
bool   
)

Definition at line 246 of file force.cc.

References DEBUGCOUT, Eye3, Elem::FORCE, DataManager::fReadOutput(), MBDynParser::GetDriveCaller(), IncludeParser::GetLineData(), MBDynParser::GetPosRel(), MBDynParser::GetRotRel(), HighParser::GetWord(), HighParser::IsArg(), HighParser::IsKeyWord(), LASTKEYWORD, MBDYN_EXCEPT_ARGS, ScalarDof::pNode, psReadNodesNodes, ReadDC3D(), ReadModalExtForce(), ReadModalForce(), ReadModalMappingExtForce(), DataManager::ReadNode(), ReadScalarDof(), ReadStructExtForce(), ReadStructMappingExtForce(), ReadStructuralForce(), SAFENEW, SAFENEWWITHCONSTRUCTOR, Node::STRUCTURAL, and Zero3.

Referenced by DataManager::ReadOneElem().

250 {
251  const char* sKeyWords[] = {
252  "conservative", // deprecated
253  "absolute",
254  "absolute" "displacement",
255  "follower",
256 
257  "conservative" "internal", // deprecated
258  "absolute" "internal",
259  "absolute" "internal" "displacement",
260  "follower" "internal",
261 
262  "total", // not implented
263  "total" "internal",
264 
265  "external" "structural",
266  "external" "structural" "mapping",
267 
268  "modal",
269  "external" "modal",
270  "external" "modal" "mapping",
271 
272  "abstract",
273  "abstract" "internal",
274 
275  NULL
276  };
277 
278  /* enum delle parole chiave */
279  enum KeyWords {
280  UNKNOWN = -1,
281 
282  CONSERVATIVE, // deprecated
283  MB_ABSOLUTE, // NOTE: "ABSOLUTE" conflicts with gcc 4.6.1 on MinGW
284  ABSOLUTEDISPLACEMENT,
285  FOLLOWER,
286 
287  CONSERVATIVEINTERNAL, // deprecated
288  ABSOLUTEINTERNAL,
289  ABSOLUTEINTERNALDISPLACEMENT,
290  FOLLOWERINTERNAL,
291 
292  TOTAL,
293  TOTALINTERNAL,
294 
295  EXTERNALSTRUCTURAL,
296  EXTERNALSTRUCTURALMAPPING,
297 
298  MODALFORCE,
299  EXTERNALMODAL,
300  EXTERNALMODALMAPPING,
301 
302  ABSTRACT,
303  ABSTRACTINTERNAL,
304 
306  };
307 
308  /* tabella delle parole chiave */
309  KeyTable K(HP, sKeyWords);
310 
311  /* tipo di forza */
312  KeyWords CurrType = KeyWords(HP.GetWord());
313  if (CurrType == UNKNOWN) {
314  silent_cerr("Force(" << uLabel << "): unknown force type "
315  "at line " << HP.GetLineData() << std::endl);
317  }
318 
319  switch (CurrType) {
320  case CONSERVATIVE:
321  case MB_ABSOLUTE:
322  case FOLLOWER:
323  case CONSERVATIVEINTERNAL:
324  case ABSOLUTEINTERNAL:
325  case FOLLOWERINTERNAL:
326 #if 0 /* not implemented yet */
327  case TOTAL:
328 #endif
329  case TOTALINTERNAL:
330  break;
331 
332  default:
333  if (bCouple) {
334  silent_cerr("Force(" << uLabel << "): must be a \"force\"" << std::endl);
336  }
337  }
338 
339  switch (CurrType) {
340  case CONSERVATIVE:
341  silent_cout("Force(" << uLabel << "): "
342  "deprecated \"conservative\" "
343  "at line " << HP.GetLineData() << "; "
344  "use \"absolute\" instead" << std::endl);
345  break;
346 
347  case CONSERVATIVEINTERNAL:
348  silent_cout("Force(" << uLabel << "): "
349  "deprecated \"conservative internal\" "
350  "at line " << HP.GetLineData() << "; "
351  "use \"absolute internal\" instead" << std::endl);
352  break;
353 
354  default:
355  break;
356  }
357 
358  Elem* pEl = 0;
359 
360  switch (CurrType) {
361  case ABSTRACT: {
362  /* tabella delle parole chiave */
363  KeyTable KDof(HP, psReadNodesNodes);
364  ScalarDof SD = ReadScalarDof(pDM, HP, true, false);
365  DriveCaller* pDC = HP.GetDriveCaller();
366  flag fOut = pDM->fReadOutput(HP, Elem::FORCE);
367 
370  AbstractForce(uLabel, SD.pNode, pDC, fOut));
371  } break;
372 
373  case ABSTRACTINTERNAL: {
374  /* tabella delle parole chiave */
375  KeyTable KDof(HP, psReadNodesNodes);
376  ScalarDof SD1 = ReadScalarDof(pDM, HP, true, false);
377  ScalarDof SD2 = ReadScalarDof(pDM, HP, true, false);
378  DriveCaller* pDC = HP.GetDriveCaller();
379  flag fOut = pDM->fReadOutput(HP, Elem::FORCE);
380 
383  AbstractInternalForce(uLabel, SD1.pNode, SD2.pNode, pDC, fOut));
384  } break;
385 
386  case EXTERNALSTRUCTURAL:
387  pEl = ReadStructExtForce(pDM, HP, uLabel);
388  break;
389 
390  case EXTERNALSTRUCTURALMAPPING:
391  pEl = ReadStructMappingExtForce(pDM, HP, uLabel);
392  break;
393 
394  case MODALFORCE:
395  pEl = ReadModalForce(pDM, HP, uLabel);
396  break;
397 
398  case EXTERNALMODAL:
399  pEl = ReadModalExtForce(pDM, HP, uLabel);
400  break;
401 
402  case EXTERNALMODALMAPPING:
403  pEl = ReadModalMappingExtForce(pDM, HP, uLabel);
404  break;
405 
406  case ABSOLUTEDISPLACEMENT:
407  pEl = ReadStructuralForce(pDM, HP, uLabel, true, bCouple, false, false);
408  break;
409 
410  case CONSERVATIVE:
411  case MB_ABSOLUTE:
412  pEl = ReadStructuralForce(pDM, HP, uLabel, false, bCouple, false, false);
413  break;
414 
415  case FOLLOWER:
416  pEl = ReadStructuralForce(pDM, HP, uLabel, false, bCouple, true, false);
417  break;
418 
419  case ABSOLUTEINTERNALDISPLACEMENT:
420  pEl = ReadStructuralForce(pDM, HP, uLabel, true, bCouple, false, true);
421  break;
422 
423  case CONSERVATIVEINTERNAL:
424  case ABSOLUTEINTERNAL:
425  pEl = ReadStructuralForce(pDM, HP, uLabel, false, bCouple, false, true);
426  break;
427 
428  case FOLLOWERINTERNAL:
429  pEl = ReadStructuralForce(pDM, HP, uLabel, false, bCouple, true, true);
430  break;
431 
432  case TOTAL:
433  case TOTALINTERNAL: {
434  /* nodo collegato 1 */
435  const StructNode* pNode1 = pDM->ReadNode<const StructNode, Node::STRUCTURAL>(HP);
436 
437  Vec3 f1(Zero3);
438  Mat3x3 R1h(Eye3);
439  Mat3x3 R1hr(Eye3);
440 
441  ReferenceFrame RF(pNode1);
442 
443  if (HP.IsKeyWord("position")) {
444  f1 = HP.GetPosRel(ReferenceFrame(pNode1));
445  }
446 
447  if (HP.IsKeyWord("force" "orientation")) {
448  DEBUGCOUT("Force orientation matrix is supplied" << std::endl);
449  R1h = HP.GetRotRel(RF);
450  }
451 
452  if (HP.IsKeyWord("moment" "orientation")) {
453  DEBUGCOUT("Moment orientation matrix is supplied" << std::endl);
454  R1hr = HP.GetRotRel(RF);
455  }
456 
457  const StructNode* pNode2 = 0;
458  Vec3 f2(Zero3);
459  Mat3x3 R2h(Eye3);
460  Mat3x3 R2hr(Eye3);
461 
462  if (CurrType == TOTALINTERNAL) {
463  /* nodo collegato 2 */
464  pNode2 = pDM->ReadNode<const StructNode, Node::STRUCTURAL>(HP);
465 
466  RF = ReferenceFrame(pNode2);
467 
468  if (HP.IsKeyWord("position")) {
469  f2 = HP.GetPosRel(ReferenceFrame(pNode2));
470  }
471 
472  if (HP.IsKeyWord("force" "orientation")) {
473  DEBUGCOUT("Force orientation matrix is supplied" << std::endl);
474  R2h = HP.GetRotRel(RF);
475  }
476 
477  if (HP.IsKeyWord("moment" "orientation")) {
478  DEBUGCOUT("Moment orientation matrix is supplied" << std::endl);
479  R2hr = HP.GetRotRel(RF);
480  }
481  }
482 
483  TplDriveCaller<Vec3>* pFDC = 0;
484  if (HP.IsKeyWord("force")) {
485  if (!HP.IsKeyWord("null")) {
486  pFDC = ReadDC3D(pDM, HP);
487  }
488  }
489 
490  if (pFDC == 0) {
492  }
493 
494  TplDriveCaller<Vec3>* pMDC = 0;
495  if (HP.IsKeyWord("moment")) {
496  if (!HP.IsKeyWord("null")) {
497  pMDC = ReadDC3D(pDM, HP);
498  }
499  }
500 
501  if (pMDC == 0) {
503  }
504 
505  flag fOut = pDM->fReadOutput(HP, Elem::FORCE);
506 
507  switch (CurrType) {
508  case TOTALINTERNAL:
510  TotalForce,
511  TotalForce(uLabel,
512  pFDC,
513  pMDC,
514  pNode1, f1, R1h, R1hr,
515  pNode2, f2, R2h, R2hr,
516  fOut));
517  break;
518 
519  default:
520  silent_cerr("total force not implemented yet at line " << HP.GetLineData() << "; use a \"force\" and a \"couple\" element instead" << std::endl);
522  }
523  } break;
524 
525  default:
527  }
528 
529  /* Se non c'e' il punto e virgola finale */
530  if (HP.IsArg()) {
531  silent_cerr("Force(" << uLabel << "): "
532  "semicolon expected at line " << HP.GetLineData()
533  << std::endl);
535  }
536 
537  return pEl;
538 } /* End of ReadForce() */
flag fReadOutput(MBDynParser &HP, const T &t) const
Definition: dataman.h:1064
ScalarNode * pNode
Definition: node.h:708
Mat3x3 GetRotRel(const ReferenceFrame &rf)
Definition: mbpar.cc:1795
const Vec3 Zero3(0., 0., 0.)
long int flag
Definition: mbdyn.h:43
const char * psReadNodesNodes[]
Definition: enums.cc:398
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Definition: matvec3.h:98
Elem * ReadModalExtForce(DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
Definition: modalext.cc:589
const Mat3x3 Eye3(1., 0., 0., 0., 1., 0., 0., 0., 1.)
Elem * ReadModalMappingExtForce(DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
Elem * ReadStructExtForce(DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
Definition: strext.cc:1352
Elem * ReadModalForce(DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
Definition: modalforce.cc:145
TplDriveCaller< Vec3 > * ReadDC3D(const DataManager *pDM, MBDynParser &HP)
#define SAFENEW(pnt, item)
Definition: mynewmem.h:695
Vec3 GetPosRel(const ReferenceFrame &rf)
Definition: mbpar.cc:1331
virtual bool IsKeyWord(const char *sKeyWord)
Definition: parser.cc:910
#define DEBUGCOUT(msg)
Definition: myassert.h:232
KeyWords
Definition: dataman4.cc:94
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
virtual bool IsArg(void)
Definition: parser.cc:807
Definition: elem.h:75
virtual int GetWord(void)
Definition: parser.cc:1083
DriveCaller * GetDriveCaller(bool bDeferred=false)
Definition: mbpar.cc:2033
Elem * ReadStructMappingExtForce(DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
Elem * ReadStructuralForce(DataManager *pDM, MBDynParser &HP, unsigned int uLabel, bool bDisp, bool bCouple, bool bFollower, bool bInternal)
Definition: strforce.cc:2713
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697
Node * ReadNode(MBDynParser &HP, Node::Type type) const
Definition: dataman3.cc:2309
ScalarDof ReadScalarDof(const DataManager *pDM, MBDynParser &HP, bool bDof, bool bOrder)
Definition: dataman3.cc:2423

Here is the call graph for this function:

Variable Documentation

const char* psForceNames[]

Definition at line 256 of file enums.cc.