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

#include <TimeStepControl.h>

Inheritance diagram for ChangeStep:
Collaboration diagram for ChangeStep:

Public Member Functions

 ChangeStep (Solver *s, DriveCaller *pStrategyChangeDrive)
 
 ~ChangeStep (void)
 
doublereal dGetNewStepTime (StepIntegrator::StepChange currStep, doublereal iPerformedIters)
 
void SetDriveHandler (const DriveHandler *driveHandler)
 
void Init (integer iMaxIterations, doublereal dMinTimeStep, const DriveOwner &MaxTimeStep, doublereal dInitialTimeStep)
 
- Public Member Functions inherited from TimeStepControl
 TimeStepControl (void)
 
virtual ~TimeStepControl (void)
 

Private Attributes

Solvers
 
DriveCallerpStrategyChangeDrive
 
doublereal dMinTimeStep
 
DriveOwner MaxTimeStep
 

Additional Inherited Members

- Protected Attributes inherited from TimeStepControl
doublereal dCurrTimeStep
 

Detailed Description

Definition at line 84 of file TimeStepControl.h.

Constructor & Destructor Documentation

ChangeStep::ChangeStep ( Solver s,
DriveCaller pStrategyChangeDrive 
)

Definition at line 106 of file TimeStepControl.cc.

References NO_OP.

107 : s(s),
108 pStrategyChangeDrive(pStrategyChangeDrive),
109 dMinTimeStep(-1.)
110 {
111  NO_OP;
112 }
Solver * s
#define NO_OP
Definition: myassert.h:74
DriveCaller * pStrategyChangeDrive
doublereal dMinTimeStep
ChangeStep::~ChangeStep ( void  )
inline

Definition at line 93 of file TimeStepControl.h.

References pStrategyChangeDrive, and SAFEDELETE.

93  {
95  };
DriveCaller * pStrategyChangeDrive
#define SAFEDELETE(pnt)
Definition: mynewmem.h:710

Member Function Documentation

doublereal ChangeStep::dGetNewStepTime ( StepIntegrator::StepChange  currStep,
doublereal  iPerformedIters 
)
virtual

Implements TimeStepControl.

Definition at line 115 of file TimeStepControl.cc.

References TimeStepControl::dCurrTimeStep, DriveOwner::dGet(), DriveCaller::dGet(), dMinTimeStep, MaxTimeStep, pStrategyChangeDrive, and StepIntegrator::REPEATSTEP.

116 {
117  doublereal dNewStep = pStrategyChangeDrive->dGet();
118  doublereal dMaxTimeStep = MaxTimeStep.dGet();;
119 
120  // are we sure we intend to change the time step if repeat is requested?
121  if (currStep == StepIntegrator::REPEATSTEP && dNewStep == dCurrTimeStep) {
122  return (dCurrTimeStep = dMinTimeStep/2.);
123  }
124 
125  return (dCurrTimeStep = std::max(std::min(dNewStep, dMaxTimeStep), dMinTimeStep));
126 }
DriveOwner MaxTimeStep
DriveCaller * pStrategyChangeDrive
doublereal dMinTimeStep
doublereal dCurrTimeStep
virtual doublereal dGet(const doublereal &dVar) const =0
doublereal dGet(const doublereal &dVar) const
Definition: drive.cc:664
double doublereal
Definition: colamd.c:52

Here is the call graph for this function:

void ChangeStep::Init ( integer  iMaxIterations,
doublereal  dMinTimeStep,
const DriveOwner MaxTimeStep,
doublereal  dInitialTimeStep 
)
virtual

Implements TimeStepControl.

Definition at line 135 of file TimeStepControl.cc.

References TimeStepControl::dCurrTimeStep, DriveOwner::dGet(), dMinTimeStep, MBDYN_EXCEPT_ARGS, DriveCaller::pCopy(), DriveOwner::pGetDriveCaller(), and DriveOwner::Set().

136 {
137  this->dCurrTimeStep = dInitialTimeStep;
138  this->MaxTimeStep.Set(MaxTimeStep.pGetDriveCaller()->pCopy());
139  this->dMinTimeStep = dMinTimeStep;
140 
141  doublereal dInitialMaxTimeStep ;
142  if (typeid(*MaxTimeStep.pGetDriveCaller()) == typeid(PostponedDriveCaller)) {
143  dInitialMaxTimeStep = std::numeric_limits<doublereal>::max();
144 
145  } else{
146  dInitialMaxTimeStep = MaxTimeStep.dGet();
147  }
148 
149  if (dMinTimeStep > dInitialMaxTimeStep) {
150  silent_cerr("error: minimum time step " << dMinTimeStep << " greater than maximum (initial) time step " << dInitialMaxTimeStep << std::endl);
152  }
153 
154  if (dInitialTimeStep < dMinTimeStep) {
155  silent_cerr("error: initial time step " << dInitialTimeStep << " less than minimum time step " << dMinTimeStep << std::endl);
157  }
158 
159  if (dInitialTimeStep > dInitialMaxTimeStep) {
160  silent_cerr("error: initial time step " << dInitialTimeStep << " greater than maximum (initial) time step " << dInitialMaxTimeStep << std::endl);
162  }
163 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
doublereal dMinTimeStep
DriveCaller * pGetDriveCaller(void) const
Definition: drive.cc:658
doublereal dCurrTimeStep
virtual DriveCaller * pCopy(void) const =0
void Set(const DriveCaller *pDC)
Definition: drive.cc:647
doublereal dGet(const doublereal &dVar) const
Definition: drive.cc:664
double doublereal
Definition: colamd.c:52

Here is the call graph for this function:

void ChangeStep::SetDriveHandler ( const DriveHandler driveHandler)
virtual

Implements TimeStepControl.

Definition at line 129 of file TimeStepControl.cc.

References pStrategyChangeDrive, and DriveCaller::SetDrvHdl().

130 {
131  pStrategyChangeDrive->SetDrvHdl(driveHandler);
132 }
DriveCaller * pStrategyChangeDrive
virtual void SetDrvHdl(const DriveHandler *pDH)
Definition: drive.cc:487

Here is the call graph for this function:

Member Data Documentation

doublereal ChangeStep::dMinTimeStep
private

Definition at line 88 of file TimeStepControl.h.

Referenced by dGetNewStepTime(), and Init().

DriveOwner ChangeStep::MaxTimeStep
private

Definition at line 89 of file TimeStepControl.h.

Referenced by dGetNewStepTime().

DriveCaller* ChangeStep::pStrategyChangeDrive
private

Definition at line 87 of file TimeStepControl.h.

Referenced by dGetNewStepTime(), SetDriveHandler(), and ~ChangeStep().

Solver* ChangeStep::s
private

Definition at line 86 of file TimeStepControl.h.


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