MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
SwitchDriveDCR Struct Reference
Inheritance diagram for SwitchDriveDCR:
Collaboration diagram for SwitchDriveDCR:

Public Member Functions

DriveCallerRead (const DataManager *pDM, MBDynParser &HP, bool bDeferred)
 
- Public Member Functions inherited from DriveCallerRead
virtual ~DriveCallerRead (void)
 

Additional Inherited Members

- Static Public Member Functions inherited from DriveCallerRead
static void ReadOutput (DriveCaller *pDC, const DataManager *pDM, MBDynParser &HP)
 
- Protected Member Functions inherited from DriveCallerRead
void NeedDM (const DataManager *pDM, MBDynParser &HP, bool bDeferred, const char *const name)
 

Detailed Description

Definition at line 85 of file module-switch_drive.cc.

Member Function Documentation

DriveCaller * SwitchDriveDCR::Read ( const DataManager pDM,
MBDynParser HP,
bool  bDeferred 
)
virtual

Implements DriveCallerRead.

Definition at line 200 of file module-switch_drive.cc.

References MBDynParser::GetDriveCaller(), HighParser::GetInt(), IncludeParser::GetLineData(), HighParser::IsKeyWord(), MBDYN_EXCEPT_ARGS, DriveCallerRead::NeedDM(), DataManager::pGetDrvHdl(), SAFENEWWITHCONSTRUCTOR, SwitchDriveCaller::SDC_CEIL, SwitchDriveCaller::SDC_FLOOR, and SwitchDriveCaller::SDC_NEAREST.

201 {
202  NeedDM(pDM, HP, bDeferred, "switch");
203 
204  const DriveHandler* pDrvHdl = 0;
205 
206  if (pDM != 0) {
207  pDrvHdl = pDM->pGetDrvHdl();
208  }
209 
210  /* driver legato ad un grado di liberta' nodale */
211  if (pDM == 0) {
212  silent_cerr("sorry, since the driver is not owned by a DataManager" << std::endl
213  << "no DOF dependent drivers are allowed;" << std::endl
214  << "aborting..." << std::endl);
216  }
217 
218  DriveCaller *pDC = 0;
219 
220  const DriveOwner oSwitch(HP.GetDriveCaller());
221 
223 
224  if (HP.IsKeyWord("floor")) {
226  } else if (HP.IsKeyWord("ceil")) {
228  } else if (HP.IsKeyWord("nearest")) {
230  } else {
231  silent_cerr("Keyword \"floor\" or \"ceil\" expected at line " << HP.GetLineData() << std::endl);
233  }
234 
235  const integer iNumDrives = HP.GetInt();
236 
237  if (iNumDrives < 1) {
238  silent_cerr("At least one drive caller expected at line " << HP.GetLineData() << std::endl);
240  }
241 
242  std::vector<DriveOwner> rgDrives;
243 
244  rgDrives.reserve(iNumDrives);
245 
246  for (int i = 0; i < iNumDrives; ++i) {
247  rgDrives.push_back(HP.GetDriveCaller());
248  }
249 
252  SwitchDriveCaller(pDrvHdl, oSwitch, eType, rgDrives));
253 
254  return pDC;
255 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
virtual integer GetInt(integer iDefval=0)
Definition: parser.cc:1050
const DriveHandler * pGetDrvHdl(void) const
Definition: dataman.h:340
virtual bool IsKeyWord(const char *sKeyWord)
Definition: parser.cc:910
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
DriveCaller * GetDriveCaller(bool bDeferred=false)
Definition: mbpar.cc:2033
void NeedDM(const DataManager *pDM, MBDynParser &HP, bool bDeferred, const char *const name)
Definition: drive_.cc:1354
long int integer
Definition: colamd.c:51
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697

Here is the call graph for this function:


The documentation for this struct was generated from the following file: