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

Classes

struct  StepRecord
 

Public Member Functions

 MultiStepDrive (const DriveHandler *pDH, const std::vector< StepRecord > &drives)
 
virtual ~MultiStepDrive ()
 
bool bIsDifferentiable (void) const
 
virtual std::ostream & Restart (std::ostream &out) const
 
doublereal dGet (const doublereal &dVar) const
 
virtual doublereal dGetP (const doublereal &dVar) const
 
DriveCallerpCopy (void) const
 
- Public Member Functions inherited from DriveCaller
 DriveCaller (const DriveHandler *pDH)
 
virtual ~DriveCaller (void)
 
virtual doublereal dGet (void) const
 
virtual doublereal dGetP (void) const
 
virtual void SetDrvHdl (const DriveHandler *pDH)
 
virtual const DriveHandlerpGetDrvHdl (void) const
 
virtual void Output (OutputHandler &OH) const
 
virtual void Trace (OutputHandler &OH) 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 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 Traceable
 Traceable (flag fTrace=0)
 
virtual ~Traceable (void)
 
virtual flag fToBeTraced (void) const
 
virtual void SetTraceFlag (flag f=TRACE)
 

Private Types

typedef std::vector
< StepRecord >::const_iterator 
iterator
 

Private Attributes

const std::vector< StepRecordrgSteps
 

Additional Inherited Members

- Public Types inherited from DriveCaller
enum  OutputFlags { OUTPUT_VALUE = OUTPUT_PRIVATE << 0, OUTPUT_DERIVATIVE = OUTPUT_PRIVATE << 1 }
 
enum  TraceFlags { TRACE_VALUE = TRACE_PRIVATE << 0, TRACE_DERIVATIVE = TRACE_PRIVATE << 1 }
 
- Public Types inherited from ToBeOutput
enum  { OUTPUT = 0x1U, OUTPUT_MASK = 0xFU, OUTPUT_PRIVATE = 0x10U, OUTPUT_PRIVATE_MASK = ~OUTPUT_MASK }
 
- Public Types inherited from Traceable
enum  { TRACE = 0x01U, TRACE_PUBLIC_MASK = 0x0FU, TRACE_PRIVATE = 0x10U, TRACE_PRIVATE_MASK = ~TRACE_PUBLIC_MASK }
 
- Protected Attributes inherited from DriveCaller
DriveHandlerpDrvHdl
 
- Protected Attributes inherited from WithLabel
unsigned int uLabel
 
std::string sName
 
- Protected Attributes inherited from ToBeOutput
flag fOutput
 

Detailed Description

Definition at line 55 of file module-multi_step_drive.cc.

Member Typedef Documentation

typedef std::vector<StepRecord>::const_iterator MultiStepDrive::iterator
private

Definition at line 75 of file module-multi_step_drive.cc.

Constructor & Destructor Documentation

MultiStepDrive::MultiStepDrive ( const DriveHandler pDH,
const std::vector< StepRecord > &  drives 
)
explicit

Definition at line 84 of file module-multi_step_drive.cc.

References NO_OP.

Referenced by pCopy().

85 : DriveCaller(pDH),
87 {
88  NO_OP;
89 }
#define NO_OP
Definition: myassert.h:74
DriveCaller(const DriveHandler *pDH)
Definition: drive.cc:475
const std::vector< StepRecord > rgSteps
MultiStepDrive::~MultiStepDrive ( )
virtual

Definition at line 91 of file module-multi_step_drive.cc.

References NO_OP.

92 {
93  NO_OP;
94 }
#define NO_OP
Definition: myassert.h:74

Member Function Documentation

bool MultiStepDrive::bIsDifferentiable ( void  ) const
virtual

Reimplemented from DriveCaller.

Definition at line 119 of file module-multi_step_drive.cc.

120 {
121  return false;
122 }
doublereal MultiStepDrive::dGet ( const doublereal dVar) const
virtual

Implements DriveCaller.

Definition at line 97 of file module-multi_step_drive.cc.

References ASSERT, and rgSteps.

98 {
99  ASSERT(rgSteps.size() >= 1u);
100 
101  if (dVar < rgSteps.front().x) {
102  return rgSteps.front().y;
103  }
104 
105  for (iterator i = rgSteps.begin(); i != rgSteps.end() - 1; ++i) {
106  if (dVar >= i->x && dVar < (i + 1)->x) {
107  return i->y;
108  }
109  }
110 
111  return rgSteps.back().y;
112 }
std::vector< StepRecord >::const_iterator iterator
const std::vector< StepRecord > rgSteps
#define ASSERT(expression)
Definition: colamd.c:977
doublereal MultiStepDrive::dGetP ( const doublereal dVar) const
virtual

Reimplemented from DriveCaller.

Definition at line 114 of file module-multi_step_drive.cc.

115 {
116  return 0.;
117 }
DriveCaller * MultiStepDrive::pCopy ( void  ) const
virtual

Implements DriveCaller.

Definition at line 143 of file module-multi_step_drive.cc.

References MultiStepDrive(), DriveCaller::pGetDrvHdl(), rgSteps, and SAFENEWWITHCONSTRUCTOR.

144 {
145  DriveCaller* pDC = 0;
146 
150 
151  return pDC;
152 }
MultiStepDrive(const DriveHandler *pDH, const std::vector< StepRecord > &drives)
virtual const DriveHandler * pGetDrvHdl(void) const
Definition: drive.cc:493
const std::vector< StepRecord > rgSteps
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698

Here is the call graph for this function:

std::ostream & MultiStepDrive::Restart ( std::ostream &  out) const
virtual

Implements DriveCaller.

Definition at line 126 of file module-multi_step_drive.cc.

References rgSteps.

127 {
128  out << "multi step, " << rgSteps.size() << ", ";
129 
130  for (iterator i = rgSteps.begin(); i != rgSteps.end(); ++i) {
131  out << i->x << ", " << i->y;
132 
133  if (rgSteps.end() - i > 1) {
134  out << ", ";
135  }
136  }
137 
138  return out;
139 }
std::vector< StepRecord >::const_iterator iterator
const std::vector< StepRecord > rgSteps

Member Data Documentation

const std::vector<StepRecord> MultiStepDrive::rgSteps
private

Definition at line 76 of file module-multi_step_drive.cc.

Referenced by dGet(), pCopy(), and Restart().


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