MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
modalext.cc File Reference
#include "mbconfig.h"
#include "dataman.h"
#include "extedge.h"
#include "modalext.h"
#include "modaledge.h"
#include <fstream>
#include <cerrno>
Include dependency graph for modalext.cc:

Go to the source code of this file.

Functions

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

Function Documentation

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

Definition at line 589 of file modalext.cc.

References ASSERT, ExtModalForceBase::EMF_ALL, ExtModalForceBase::EMF_MODAL, ExtModalForceBase::EMF_RIGID, Elem::FORCE, DataManager::fReadOutput(), IncludeParser::GetLineData(), HighParser::IsArg(), HighParser::IsKeyWord(), Elem::JOINT, MBDYN_EXCEPT_ARGS, Modal::pGetModalNode(), DataManager::ReadElem(), ReadExtForce(), DataManager::ReadNode(), SAFENEW, SAFENEWWITHCONSTRUCTOR, and Node::STRUCTURAL.

Referenced by ReadForce().

592 {
593  ExtFileHandlerBase *pEFH;
594  int iCoupling;
595 
596  bool bSendAfterPredict;
597  ReadExtForce(pDM, HP, uLabel, pEFH, bSendAfterPredict, iCoupling);
598 
599  const StructNode *pNode = 0;
600  const Modal *pModal = 0;
601  if (HP.IsKeyWord("reference" "node")) {
602  pNode = pDM->ReadNode<const StructNode, Node::STRUCTURAL>(HP);
603 
604  } else {
605  pModal = pDM->ReadElem<const Modal, Elem::JOINT>(HP);
606  pNode = pModal->pGetModalNode();
607  }
608 
609  bool bOutputAccelerations(false);
610  if (HP.IsKeyWord("accelerations")) {
611  bOutputAccelerations = true;
612  }
613 
614  // safe default: both rigid and modal, if possible
616  if (pNode == 0) {
618 
619  } else if (pModal == 0) {
621  }
622 
623  if (HP.IsKeyWord("type")) {
624  if (HP.IsKeyWord("rigid")) {
626  } else if (HP.IsKeyWord("modal")) {
628  } else if (HP.IsKeyWord("all")) {
630  } else {
631  silent_cerr("ModalExt(" << uLabel << "): unknown ModalExt type "
632  " at line " << HP.GetLineData() << std::endl);
634  }
635  }
636 
637  if ((bm & ExtModalForceBase::EMF_RIGID) && pNode == 0) {
638  silent_cerr("ModalExt(" << uLabel << "): \"rigid\" needs rigid body motion "
639  "at line " << HP.GetLineData() << std::endl);
641  }
642 
643  if ((bm & ExtModalForceBase::EMF_MODAL) && pModal == 0) {
644  silent_cerr("ModalExt(" << uLabel << "): \"modal\" needs modal joint "
645  "at line " << HP.GetLineData() << std::endl);
647  }
648 
649  ExtModalForceBase *pEMF = 0;
650  if (dynamic_cast<ExtFileHandlerEDGE *>(pEFH) != 0) {
651  // EDGE needs two separate ModalExt elements,
652  // one for the rigid part and one for the modal part
653 
654  switch (bm & ExtModalForceBase::EMF_ALL) {
655  case ExtModalForceBase::EMF_RIGID:
657  ExtRigidForceEDGE(pDM));
658  break;
659 
660  case ExtModalForceBase::EMF_MODAL:
662  ExtModalForceEDGE(pDM));
663  break;
664 
665  case ExtModalForceBase::EMF_ALL:
666  silent_cerr("ModalExt(" << uLabel << "): "
667  "EDGE ExtFileHandler can only be used "
668  "when ModalExt is either \"rigid\" "
669  "or \"modal\" but not when it is \"all\" "
670  " at line " << HP.GetLineData() << std::endl);
672 
673  default:
674  ASSERT(0);
676  }
677 
678  // add more types if specific behavior is needed
679 
680  } else {
681  // ExtFileHandler
682  // ExtSocketHandler
683 
684  // wild guess: the default is fine
685  SAFENEW(pEMF, ExtModalForce);
686  }
687 
688  flag fOut = pDM->fReadOutput(HP, Elem::FORCE);
689 
690  if (HP.IsArg()) {
691  silent_cerr("ModalExt(" << uLabel << "): "
692  "semicolon expected at line "
693  << HP.GetLineData() << std::endl);
695  }
696 
697  Elem *pEl = 0;
699  ModalExt(uLabel, pDM, pModal, pNode, bOutputAccelerations,
700  pEFH, pEMF, bSendAfterPredict, iCoupling, bm, fOut));
701 
702  return pEl;
703 }
flag fReadOutput(MBDynParser &HP, const T &t) const
Definition: dataman.h:1064
const ModalNode * pGetModalNode(void) const
Definition: modal.h:395
long int flag
Definition: mbdyn.h:43
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Elem * ReadElem(MBDynParser &HP, Elem::Type type) const
Definition: dataman3.cc:2334
Definition: modal.h:74
#define SAFENEW(pnt, item)
Definition: mynewmem.h:695
virtual bool IsKeyWord(const char *sKeyWord)
Definition: parser.cc:910
#define ASSERT(expression)
Definition: colamd.c:977
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
virtual bool IsArg(void)
Definition: parser.cc:807
Definition: elem.h:75
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697
Node * ReadNode(MBDynParser &HP, Node::Type type) const
Definition: dataman3.cc:2309
void ReadExtForce(DataManager *pDM, MBDynParser &HP, unsigned int uLabel, ExtFileHandlerBase *&pEFH, bool &bSendAfterPredict, int &iCoupling)
Definition: extforce.cc:1141

Here is the call graph for this function: