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

#include <fixedstep.h>

Inheritance diagram for FixedStepDR:
Collaboration diagram for FixedStepDR:

Public Member Functions

virtual DriveRead (unsigned uLabel, const DataManager *pDM, MBDynParser &HP)
 
- Public Member Functions inherited from DriveRead
virtual ~DriveRead (void)
 

Detailed Description

Definition at line 71 of file fixedstep.h.

Member Function Documentation

Drive * FixedStepDR::Read ( unsigned  uLabel,
const DataManager pDM,
MBDynParser HP 
)
virtual

Implements DriveRead.

Definition at line 310 of file fixedstep.cc.

References Drive::BO_ANY, Drive::BO_LOWER, Drive::BO_NONE, Drive::BO_UPPER, dFromFile, filename, IncludeParser::GetFileName(), HighParser::GetInt(), IncludeParser::GetLineData(), HighParser::GetReal(), HighParser::GetYesNo(), HighParser::IsKeyWord(), MBDYN_EXCEPT_ARGS, DataManager::pGetDrvHdl(), and SAFENEWWITHCONSTRUCTOR.

311 {
312  integer isteps = -1;
313  if (!HP.IsKeyWord("count")) {
314  isteps = HP.GetInt();
315  if (isteps <= 0) {
316  silent_cerr("FixedStepFileDrive(" << uLabel << "): "
317  "invalid steps number " << isteps
318  << " at line " << HP.GetLineData()
319  << std::endl);
321  }
322  }
323 
324  integer idrives = HP.GetInt();
325  if (idrives <= 0) {
326  silent_cerr("FixedStepFileDrive(" << uLabel << "): "
327  "invalid channels number " << idrives
328  << " at line " << HP.GetLineData()
329  << std::endl);
331  }
332 
333  if (!HP.IsKeyWord("initial" "time")) {
334  silent_cerr("FixedStepFileDrive(" << uLabel << "): "
335  "warning, keyword \"initial time\" expected at line "
336  << HP.GetLineData() << std::endl);
337  }
338  doublereal t0 = dFromFile;
339  if (!HP.IsKeyWord("from" "file")) {
340  t0 = HP.GetReal();
341  }
342 
343  if (!HP.IsKeyWord("time" "step")) {
344  silent_cerr("FixedStepFileDrive(" << uLabel << "): "
345  "warning, keyword \"time step\" expected at line "
346  << HP.GetLineData() << std::endl);
347  }
348  doublereal dt = dFromFile;
349  if (!HP.IsKeyWord("from" "file")) {
350  dt = HP.GetReal();
351  if (dt <= 0.) {
352  silent_cerr("FixedStepFileDrive(" << uLabel << "): "
353  "invalid time step " << dt
354  << " at line " << HP.GetLineData()
355  << std::endl);
357  }
358  }
359 
360  bool bl(true);
361  if (HP.IsKeyWord("interpolation")) {
362  if (HP.IsKeyWord("const")) {
363  bl = false;
364 
365  } else if (!HP.IsKeyWord("linear")) {
366  silent_cerr("FixedStepFileDrive(" << uLabel << "): "
367  "unknown value for \"interpolation\" "
368  "at line " << HP.GetLineData() << std::endl);
370  }
371  }
372 
373  bool pz(true);
375 
376  if (HP.IsKeyWord("pad" "zeros") || HP.IsKeyWord("pad" "zeroes")) {
377  if (!HP.GetYesNo(pz)) {
378  silent_cerr("FixedStepFileDrive(" << uLabel << "): "
379  "unknown value for \"pad zeros\" "
380  "at line " << HP.GetLineData() << std::endl);
382  }
383 
384  } else if (HP.IsKeyWord("bailout")) {
385  if (HP.IsKeyWord("none")) {
386  bo = Drive::BO_NONE;
387 
388  } else if (HP.IsKeyWord("upper")) {
389  bo = Drive::BO_UPPER;
390 
391  } else if (HP.IsKeyWord("lower")) {
392  bo = Drive::BO_LOWER;
393 
394  } else if (HP.IsKeyWord("any")) {
395  bo = Drive::BO_ANY;
396 
397  } else {
398  silent_cerr("FixedStepFileDrive(" << uLabel << "): "
399  "invalid bailout parameter "
400  "at line " << HP.GetLineData()
401  << std::endl);
403  }
404  }
405 
406  const char* filename = HP.GetFileName();
407 
408  Drive* pDr = NULL;
411  FixedStepFileDrive(uLabel, pDM->pGetDrvHdl(),
412  filename, isteps, idrives,
413  t0, dt, bl, pz, bo));
414 
415  return pDr;
416 }
static char * filename
Definition: ann_sf.c:71
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
virtual integer GetInt(integer iDefval=0)
Definition: parser.cc:1050
Definition: drive.h:89
virtual const char * GetFileName(enum Delims Del=DEFAULTDELIM)
Definition: parsinc.cc:673
Bailout
Definition: drive.h:101
const DriveHandler * pGetDrvHdl(void) const
Definition: dataman.h:340
static const doublereal dFromFile
Definition: fixedstep.cc:46
virtual bool IsKeyWord(const char *sKeyWord)
Definition: parser.cc:910
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
virtual bool GetYesNo(bool &bRet)
Definition: parser.cc:1022
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697
virtual doublereal GetReal(const doublereal &dDefval=0.0)
Definition: parser.cc:1056

Here is the call graph for this function:


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